Pay Later option ONLY for logged in users

  • Matia
  • Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
10 years 4 months ago #39770 by Matia
I am using the offline payment option along with the FirstData payment option (hopefully) at checkout. I would like to make the offline option available ONLY for those logged in though. So if the user isn't logged in, then it will only show the FirstData option. If they are logged in, it will show both the offline option and the FirstData option. Is there an easy way of doing this? If not, can you point me to the file that would need editing so I won't have to waste a bunch of time digging around for it? Thanks!

Please Log in or Create an account to join the conversation.

More
10 years 4 months ago #39790 by Tuan Pham Ngoc
Replied by Tuan Pham Ngoc on topic Re: Pay Later option ONLY for logged in users
Try to edit the code in the file components/com_eventbooking/payments/os_payments.php, function getPaymentMethods .

You know programming, so you should be able edit the code for that. lets me know if you need more help on this item.

Regards,

Tuan

Please Log in or Create an account to join the conversation.

  • Matia
  • Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
10 years 4 months ago #39823 by Matia
Thanks, that worked perfect! I just put an IF statement around the $sql variable, and changed the SQL statement to include the published payment methods and the os_offline payment method if the user is logged in: 'SELECT * FROM #__eb_payment_plugins WHERE published=1 OR name = "os_offline" ORDER BY ordering'.

Please Log in or Create an account to join the conversation.

  • Matia
  • Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
10 years 4 months ago #39826 by Matia
Now they only want the additional Offline option to show under certain categories if the user is logged in. So when the user is logged in the SQL statement will need to be surrounded by something like:
If (event category id is 6) Then
$sql = 'SELECT * FROM #__eb_payment_plugins WHERE published=1 OR name = "os_offline" ORDER BY ordering';,
Else $sql = 'SELECT * FROM #__eb_payment_plugins WHERE published=1 ORDER BY ordering'.

I am unsure how to get the category id number of the form the user is on though. This will need to go in the condition of the IF statement. I tried $this->category_id but I think I'm missing something because it didn't work. Could you let me know how to access the category id of the event the user is on from within the os_payments.php page? Please let me know if this isn't clear.

Please Log in or Create an account to join the conversation.

More
10 years 4 months ago #39915 by Tuan Pham Ngoc
Replied by Tuan Pham Ngoc on topic Re: Pay Later option ONLY for logged in users
Since you know programming, from the given event id, you can read the category id from #__eb_event_categories database table to find it's category.

Regards,

Tuan

Please Log in or Create an account to join the conversation.

  • Matia
  • Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
10 years 4 months ago #39936 by Matia
I think I'm going to need an example. I'm not sure how to grab the given event id. It is typically $this->something, but I'm not sure what the "something" is.

Please Log in or Create an account to join the conversation.

More
10 years 4 months ago #39974 by Tuan Pham Ngoc
Replied by Tuan Pham Ngoc on topic Re: Pay Later option ONLY for logged in users
Hi Matia

I can help you with this custom coding as well. But what if other modifications needed? I cannot always be available to help you with custom coding. It seems your customers require many customization, so I would suggest you to find a experienced developer to help you with the custom code like that. It will save time (and money) for both of us.

Regards,

Tuan

Please Log in or Create an account to join the conversation.

  • Matia
  • Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
10 years 4 months ago #39996 by Matia
You really haven't done much but give me some file locations and a couple hints. I've done the coding myself and some of the forum posts I opened I ended up figuring out on my own. And I'm still waiting on a FirstData payment module I paid for that you have been working on for months now. I would like to use the JoomDonation component too but since it's taking so much time just to get the EventBooking FirstData module working I doubt we have the time to wait for that component too. If I'm looking at the code right all I need is a reference to the event id from within the os_payments.php file. Since the references that are used in other files aren't working in this one I figured there was a difference in the coding somewhere that I didn't see. All I need is something to assign to $variable that references the current event id. Thankfully the site is finishing up so hopefully I can stop bugging you.

Please Log in or Create an account to join the conversation.

More
10 years 4 months ago #40012 by Tuan Pham Ngoc
Replied by Tuan Pham Ngoc on topic Re: Pay Later option ONLY for logged in users
I just tell you the file and the hints because I thought you have good Joomla programming experience. That's why I tell you that you need a developer. If you cannot find out how to get event id from the file, then it will be difficult for you to do other customization you need.

To get Event ID, you can use the code below :
Code:
$eventId = JRequest::getInt('event_id', 0);

Regards,

Tuan

Please Log in or Create an account to join the conversation.

  • Matia
  • Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
10 years 4 months ago #40054 by Matia
Thank you, I was not thinking in terms of Joomla, but in terms of EventBooking so this method did not come to mind.

Please Log in or Create an account to join the conversation.

Moderators: Tuan Pham Ngoc