Pass coupon code from pricing table view to subscription form

More
10 months 1 week ago #164200 by Pete
Hi,

When a user comes to the pricing table view with a coupon code in the URL, I would like this to get passed on to the subscription form page. For example I give the user a link like: index.php?option=com_osmembership&view=plans&layout=pricingtableflat&id=0&coupon_code=MYCODE
The coupon_code should be appended to all buttons on the page that take you to the subscription form. I know the subscription form already supports the coupon_code parameter so there is no change required there.

I'm currently doing this with a template override but it would be a nice feature to have natively. Here is the code I added:
/components/com_osmembership/view/common/tmpl/pricingtable_flat_plans.php
Code:
// at the beginning, like line 27 $coupon = JFactory::getApplication()->input->getString('coupon_code', ''); $appendCoupon = $coupon ? '?coupon_code=' . $coupon : ''; // add in line 102 after signupUrl is created $signUpUrl .= $appendCoupon;
 

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

More
10 months 1 week ago #164213 by Tuan Pham Ngoc
Hi Pete

This is a special use-case, so override like you did is needed. This is something we won't add to the core package

Just one minor thing, on that code, JFactory should be replaced with it's namespaced class Factory to make sure it works well with future releases of Joomla

Regards,

Tuan

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