I'm new to this (2 days new) so please bear with me.
I want have a form & button working with a paypal order so that when
the user puts in the order quantity on my page, the javascript selects
the correct price based on quantity and sends those 2 numbers to
paypal.
I have no idea how to do this. I don't know if it should go in the
ShowPRice function or if it should be done in a form. Would someone
help me?
What I have written so far:
<html>
<head>
<script language="javas cript" type="text/javascript">
<!--
function CalculatePrice( NumOrdered)
{
if (NumOrdered>=6 && NumOrdered<=10)
{var ItemPrice = 5.00 }
else if (NumOrdered >=11 && NumOrdered<=25)
{var ItemPrice = 4.50 }
else if (NumOrdered >=26 && NumOrdered<=80)
{var ItemPrice = 4.00 }
else if (NumOrdered> 80)
{var ItemPrice = 3.50 }
else if (NumOrdered< 6)
{alert("Minimum wholesale order is 6") ;
var ItemPrice = 5.00 }
else
{alert("You did not enter a number!");
var ItemPrice = 5.00}
return ItemPrice ;
}
function ShowPrice(NumOr dered)
{
var FinalPrice=Calc ulatePrice(NumO rdered);
alert("Price per unit: "+FinalPric e)
}
// -->
</script>
</head>
<body>
<***** now this form fm2a works very nicely and shows me the correct
<***** price
<form name="fm2a">
Enter quantity :
<input type="text" name="quantity" >
<input type="button" name="dis" value="Add to Cart"
onClick='ShowPr ice(document.fm 2a.quantity.val ue)'>
</form>
<***** But what I really want is the button to do place a paypal
order,
<***** inserting the quantity ordered and the correct price. What
I've
<***** done here does not work.
<form name="submit" target="paypal"
action="https://www.paypal.com/cgi-bin/webscr" method="post">
Enter quantity :
<input type="text" name="quantity" >
<input type="button" name="dis" value="Add to Cart"
onClick='ShowPr ice(document.su bmit.quantity.v alue)'>
<input type="hidden" name="add" value=NumOrdere d>
<input type="hidden" name="cmd" value="_cart">
<input type="hidden" name="business" value="paypal@m ystore.com">
<input type="hidden" name="item_name " value="Wholesal e item">
<input type="hidden" name="item_numb er" value="WRTH">
<input type="hidden" name="amount" value=FinalPric e>
<input type="hidden" name="no_note" value="1">
<input type="hidden" name="currency_ code" value="USD">
<input type="hidden" name="lc" value="US">
</form>
</body>
</html>
I want have a form & button working with a paypal order so that when
the user puts in the order quantity on my page, the javascript selects
the correct price based on quantity and sends those 2 numbers to
paypal.
I have no idea how to do this. I don't know if it should go in the
ShowPRice function or if it should be done in a form. Would someone
help me?
What I have written so far:
<html>
<head>
<script language="javas cript" type="text/javascript">
<!--
function CalculatePrice( NumOrdered)
{
if (NumOrdered>=6 && NumOrdered<=10)
{var ItemPrice = 5.00 }
else if (NumOrdered >=11 && NumOrdered<=25)
{var ItemPrice = 4.50 }
else if (NumOrdered >=26 && NumOrdered<=80)
{var ItemPrice = 4.00 }
else if (NumOrdered> 80)
{var ItemPrice = 3.50 }
else if (NumOrdered< 6)
{alert("Minimum wholesale order is 6") ;
var ItemPrice = 5.00 }
else
{alert("You did not enter a number!");
var ItemPrice = 5.00}
return ItemPrice ;
}
function ShowPrice(NumOr dered)
{
var FinalPrice=Calc ulatePrice(NumO rdered);
alert("Price per unit: "+FinalPric e)
}
// -->
</script>
</head>
<body>
<***** now this form fm2a works very nicely and shows me the correct
<***** price
<form name="fm2a">
Enter quantity :
<input type="text" name="quantity" >
<input type="button" name="dis" value="Add to Cart"
onClick='ShowPr ice(document.fm 2a.quantity.val ue)'>
</form>
<***** But what I really want is the button to do place a paypal
order,
<***** inserting the quantity ordered and the correct price. What
I've
<***** done here does not work.
<form name="submit" target="paypal"
action="https://www.paypal.com/cgi-bin/webscr" method="post">
Enter quantity :
<input type="text" name="quantity" >
<input type="button" name="dis" value="Add to Cart"
onClick='ShowPr ice(document.su bmit.quantity.v alue)'>
<input type="hidden" name="add" value=NumOrdere d>
<input type="hidden" name="cmd" value="_cart">
<input type="hidden" name="business" value="paypal@m ystore.com">
<input type="hidden" name="item_name " value="Wholesal e item">
<input type="hidden" name="item_numb er" value="WRTH">
<input type="hidden" name="amount" value=FinalPric e>
<input type="hidden" name="no_note" value="1">
<input type="hidden" name="currency_ code" value="USD">
<input type="hidden" name="lc" value="US">
</form>
</body>
</html>
Comment