Jump to content

integrated paypal form - want to apply coupon


njdirt

Recommended Posts

Hello,

  I am working on applying a coupon code option to a Paypal integrated store html page on my website.  I want the user to have the ability to enter a Coupon Code for a discount on each item.  I pirated some sample how-to code from a site (sorry I don't have the info), but I think the fact that I have multiple items listed on the page prevents it from working.  I've posted the relevant code below.

 

I think the problem may be in the assigning of the discount_rate variable where I use 'document.contra.discount_rate.value = "10"; 

 

Total JS noob too so I'm trying to figure it out as i go.  Thanks in advance!

 

<form name="contra" method='POST' action='https://www.paypal.com/cgi-bin/webscr' target='paypal' onSubmit="paypal=window.open('https://www.paypal.com/cgi-bin/webscr','paypal','width=680,height=400,status=yes,location=no,menubar=no,scrollbars=yes,resizable=yes');paypal.focus();" >
<input type="hidden" name="business" value ="xxxxx"> 
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="cmd" value="_cart"> 
<input type="hidden" name="add" value="1">
<select name='os0' size='1' style='background-color: #FFFFFF; color: #000000;'>
<option value='Select Top Tube'>Select Top Tube</option>
<option value="21.5"">21.5"</option>
<option value="22"">22"</option>
</select>
<input type='hidden' name='on0' value='Top Tube'>
<select name='os1' size='1' style='background-color: #FFFFFF; color: #000000;'>
<option value='Select Color'>Select Color</option>
<option value='Black'>Neon Green</option>
<option value='Brown'>Dark Orange</option>
<option value="Orange">Black</option>
</select>
<input type='hidden' name='on1' value='Color'><br><br>Qty <input type='text' name='quantity' size='3' value='1'> <input type='submit' onclick='if(os0.selectedIndex==0){alert(os0.options[0].value);os0.focus();return(false);}if(os1.selectedIndex==0){alert(os1.options[0].value);os1.focus();return(false);}' value='Add to Order' name='B1' style='background-color: #ff6600; color: #000000; font-weight: bold'>
 <input type='submit' value='View Order' name='display' style='background-color: #ff6600; color: #000000; font-weight: bold'>
<!-- promo code -->
<br>
<input type="text" name="promo">     <input type="button" value="Check It" name="Submit" onclick=javascript:validate(promo.value,"GOLD10") > 
<script language="javascript">
function validate(text1,text2) { 
if (text1 == text2)
{
window.alert("Nice, you get a 10% Discount!");
document.contra.discount_rate.value = "10";
document.contra.discount_rate2.value = "10";
document.contra.on3.value = "Coupon Entered";
document.contra.os3.value = "GOLD10";
}
if (text1 !== text2)
{
window.alert("Sorry, No Discount!");
}
}
</script>
<!-- end promo code -->
<br><br><noscript>Please enable Javascript to order this item</noscript><input type='hidden' name='item_number' value=''>
<input type='hidden' name='item_name' value='MOB'>
<input type='hidden' name='amount' value='399.99'>
</form>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.