I need major help here. I have been reviewing and trying to emulate the info re: 3 ways to create a small Joomla! shopping cart with RSForm!Pro and PayPal - Part 3 and frankly I'm lost.
I want to be able to access the value in two separate radio groups. One group has only 2 options and if Guest is chosen the "var total is increased by $5.00. The other has 4 options with different prices and descriptions. This is how I have the prix fixe items arranged.
$22 Artichoke, Sundried Tomato Penne w/red peppers...
$26 Pan Fried Snapper w/Caribbean Stir Fry nappa...
$24 Roasted Chicken Supreme w/roasted red pepper...
$30 Roasted Prime Rib Dinner w/red wine shallot...
I have the PayPal plugin but that is for my PayPal account. This form is for an association I'm affiliated with which means it has to use their info to transfer the funds appropriately.
Here's what I've got just above the FormLayout area. I've made it as simplistic as I can, at least I thought so just to test it.
<script type="text/javascript">
function calculateTotal()
{
var total = 0;
var radio1 = document.getElementsById([status]);
var radio2 = document.getElementsById([choices]);
if (radio1[1].checked) total = 5.00; // Guest or Member
if (radio2[0].checked) total = total + (22.00 * 1.13); // Artichoke
if (radio2[1].checked) total = total + (26.00 * 1.13); // Pan
if (radio2[2].checked) total = total + (24.00 * 1.13); // Chicken
if (radio2[3].checked) total = total + (30.00 * 1.13); // Prime
document.getElementById('Total').value = total; // hidden field
document.getElementById('Total1').value = total; // textbox
}
</script>
Now here's the PHP script in the process after form section...copied straight from example.
if($_POST['form']['Total'] != '0')
{
$business = 'me@mybusiness.com';
$item_name = 'Products';
$currency_code = 'CAD';
$amount = $_POST['form']['Total'];
$return = 'http://google.com';
header('Location: https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&business='.$business.'&item_name='.$item_name.'¤cy_code='.$currency_code.'&amount='.$amount.'&return='.$return); exit();
}
I have
onchange="calculateTotal();" for both choices and status and nowhere else. I know it's something really stupid and I'm just blind because I've been at it for too long. Thank you for your help.
Pulling my hair out,
Deborah