Jeff VIP
Total posts: 745
17 Oct 2015 02:43

Hi,

I would like to have a very simple layout to choose plans from, where each plan is represented by a radio button and where there is only one submit button.

subscription

I'm not sure how to get this working.

Best regards, Jeff

Last Modified: 19 Oct 2015



Sergey
Total posts: 13,748
19 Oct 2015 07:07

All you have to understand to do this is that purchase confirmation is a simple URL

index.php?option=com_emerald&view=empayment&sid=60&Itemid=135

For example you created this HTML

<form id="myForm">
<input name="plan" value="<?php echo JRoute::_('index.php?option=com_emerald&view=empayment&sid=1') ?>"> Plan A
<input name="plan" value="<?php echo JRoute::_('index.php?option=com_emerald&view=empayment&sid=3') ?>"> Plan B
<input name="plan" value="<?php echo JRoute::_('index.php?option=com_emerald&view=empayment&sid=5') ?>"> Plan C
<input name="plan" value="<?php echo JRoute::_('index.php?option=com_emerald&view=empayment&sid=17') ?>"> Plan D

<input type="button" id="purchase" value="Purchase" >
</form>

Then you can use following javascript

(function($){
    $('#purchase').click(function(){
        var url = $('input[name=plan]:checked', '#myForm').val();
        window.location = url;
    })
}(jQuery))

Of course this is a concept. Not tested but I am sure you get an idea.


Jeff VIP
Total posts: 745
19 Oct 2015 07:42

Excellent, Sergey

Works like a charm!

+1

Powered by Cobalt