• 1

Read this first!

We do not monitor these forums. The forum is provided to exchange information and experience with other users ONLY. Forum responses are not guaranteed.

However, please submit a ticket if you have an active subscription and wish to receive support. Our ticketing system is the only way of getting in touch with RSJoomla! and receiving the official RSJoomla! Customer Support.

For more information, the Support Policy is located here.

Thank you!

TOPIC: Newbie stuck with javascript and PayPal custom

Newbie stuck with javascript and PayPal custom 12 years 6 months ago #15410

  • deborah9
  • deborah9's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 1
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.'&currency_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
Last Edit: 12 years 6 months ago by deborah9. Reason: add code
The administrator has disabled public write access.
  • 1

Read this first!

We do not monitor these forums. The forum is provided to exchange information and experience with other users ONLY. Forum responses are not guaranteed.

However, please submit a ticket if you have an active subscription and wish to receive support. Our ticketing system is the only way of getting in touch with RSJoomla! and receiving the official RSJoomla! Customer Support.

For more information, the Support Policy is located here.

Thank you!