16
Great to see your implementation JackJ. After looking at your script, I made a few tweaks to my prior implementation and solved the strange window.open script behavior. Sample cart
here, no longer requiring an IFRAME.
For a simple alternative paypal cart, just create a form with the following script:
<SCRIPT LANGUAGE=JAVASCRIPT TYPE="TEXT/JAVASCRIPT">
function openWin() {
l=(screen.width-525)/2
t=(screen.height-300)/2
a=window.open('','paypal','width=525,height=300,left='+l+',top='+t);
}
SCRIPT>
<form target="paypal" action="https://www.paypal.com/cgi-bin/webscr" method="post" onSubmit="paypal=openWin();paypal.focus();">
<input type="image" src="https://www.paypal.com/en_US/i/btn/x-click-but22.gif" border="0" name="submit" alt="Submit via PayPal" align="texttop" width="87" height="23">https://www.paypal.com/en_US/i/btn/x-click-but22.gif"
border="0" name="submit" alt="Submit via PayPal"
align="texttop" width="87" height="23">
<input type="hidden" name="cmd" value="_cart">
<input type="hidden" name="business" value="YOUREMAILHERE@DOMAIN">
<input type="hidden" name="item_name" value="ITEM NAME">
<input type="hidden" name="amount" value="PRICE">
FORM>
You can add a few more hidden inputs to document item options, currency, etc... There are also more buttons and a similar View Cart form available with full details at the
PayPal merchant web cart site. I recommend you download the PDF manual and code your own forms as these offer many more options than their online HTML creation tool. It can be helpful to see some system-generated examples though.