Automatically add subscription to Membership by registration for an event

  • Pascal
  • Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
More
1 month 6 days ago #130540 by Pascal
Hi there

I have a special usecase, for our trips you have to be part of the community. By registration for the event the user should automatically added to a subscription, which end automatically by the end of the year.
But this subscription should show up separately on the invoice.
And if the user register for a second event in the same year, the subscription is not needed for the second event.

Do you easily see a solution therefore?

Best regards
Pascal

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

More
1 month 5 days ago #130563 by Tuan Pham Ngoc
Hi Pascal

This is a special requirement, and not supported in the extension. If you need it, you will have to hire a developer to develop a plugin for you to create a subscription record for the user when they register for an event

Tuan

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

  • Pascal
  • Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
More
1 month 4 days ago #130579 by Pascal
Hi Tuan

Thank you for your Answer. So the question is, if you would do something like this? The most cleanist way would be a connection between the two components "Event Booking" and "Membership Pro"?
I do develop myself, but never really interested in website. So can you explain in two sentences, where I would need to override sources, or extend them?

Thank you
Pascal

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

More
1 month 4 days ago #130580 by Tuan Pham Ngoc
Hi Pascal

You would need to develop a plugin for Events Booking eventbookingdoc.joomservices.com/develop...mentation/dev-plugin

The event which you need to listen for is onAfterPaymentSuccess(which is triggered after payment for the registration is paid)

On that method, you will need to write code to create a new subscription or the user for the plan you want. You can borrow some code from plugins/user/osmembership/osmembership.php, method onUserAfterSave to see how to add new subscription record for a user

Tuan

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

  • Pascal
  • Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
More
4 weeks 6 hours ago #130786 by Pascal
Hi Tuan

Thank you for your short introduction. I have now a very first simple solution, which I will extend once, but for now it's alright.
One "small" thing I still have, you may could help me. The participant will be registered automatically to a subscription, this is working. But the email with the invoice is not send.

$model = new OSMembershipModelApi();
try {
$model->store($data);

These lines works, but do not create an email with the invoice. First is this a bug? Or on purpose?
If I go manually in to the component and "resend emails" it creates the email I wish for. But not automatically.

I saw the helper function OSMembershipHelperMail::sendEmails() but I don't know where I get the param ($row=OSMembershipTableSubscriber) from. Or is there an even smarter way to solve that issue?

Thank you
Pascal

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

More
4 weeks 3 hours ago #130787 by Tuan Pham Ngoc
Hello

You need to call API to send email manually. Something like:

$row = $model->store($data);

$config = OSMembershipHelper::getConfig();

OSMembershipHelper::sendEmails($row, $config);

Tuan

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

  • Pascal
  • Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
More
3 weeks 6 days ago #130810 by Pascal
Hi Tuan

Yes, this kind of works. The email for the membership subscriptions is now sent, but the event registering is not finishing anymore... Now a blank page appears. If I activate error handling, folllowing error appears:

Notice: Undefined index: none_taxable_fee in /joomla/components/com_osmembership/helper/helper.php on line 890
Notice: Undefined index: act in /joomla/components/com_osmembership/helper/helper.php on line 994
Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in /joomla/components/com_eventbooking/tcpdf/tcpdf.php on line 17782
Fatal error: Cannot declare class TCPDF, because the name is already in use in /joomla/components/com_eventbooking/tcpdf/tcpdf.php on line 132

The invoice pdf for the membership is generated and send correctly per email, but I don't get any email for the event registration anymore.

Do you see the issue?

Thank you
Pascal

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

  • Pascal
  • Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
More
3 weeks 12 hours ago #130899 by Pascal

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

More
3 weeks 3 hours ago #130911 by Tuan Pham Ngoc
Hello

From what I see, it causes by the conflict between the two extensions when TCPDF is loaded on both. You can try the solution below:

- Open the file components/com_osmembership/helper/helper.php
- Find the method generateInvoicePDF
- Change the code from:
require_once JPATH_ROOT . '/components/com_osmembership/tcpdf/tcpdf.php';
		require_once JPATH_ROOT . '/components/com_osmembership/tcpdf/config/lang/eng.php';

to:
if (!class_exists('TCPDF'))
		{
			require_once JPATH_ROOT . '/components/com_osmembership/tcpdf/tcpdf.php';
			require_once JPATH_ROOT . '/components/com_osmembership/tcpdf/config/lang/eng.php';	
		}

Then try again. Maybe it would address the issue

Tuan
The following user(s) said Thank You: Pascal

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

  • Pascal
  • Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
More
2 weeks 5 days ago #130941 by Pascal
Thank you very much. This worked. I just had to add it in the event booking helper and not the membership pro helper.

Thank you very much
Pascal

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

Moderators: Tuan Pham Ngoc