首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >贝宝为handling_cart选项添加到cart按钮html

贝宝为handling_cart选项添加到cart按钮html
EN

Stack Overflow用户
提问于 2015-09-24 10:37:11
回答 1查看 833关注 0票数 0

我在html上还行,但对PayPal并不陌生。我希望能够使用贝宝按钮直接从我的网站,而不必使用第三方购物车。

我唯一的问题是,我是在英国和贝宝不提供邮资/运输选项在这里取决于你要去哪里。因此,例如,贝宝的标准按钮将不允许我收取不同的邮资,无论我是发送产品到美国,或只是附近的城镇。

它们只允许您根据购物车的价值增加邮资/运费。

因此,我一直在查看这里的按钮可用的html变量,htmlvariables/#id08A6HH0D0TA和Stackoverflow上的帖子。

我想知道是否有任何方法组合期权价值。和="handling_cart“来做这件事--请看我在下面的工作。

因此,您可以单击add to cart按钮,然后从下拉菜单中选择航运区域,例如英国、欧洲、世界其他地区。然后,购物车上的手续费将反映您选择的选项。而不是处理购物车的值是NNNN,而是为该选项指定的值,因此对于欧洲,GB5.00。

代码语言:javascript
复制
<form target="paypal" action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_s-xclick">
<input type="hidden" name="hosted_button_id" value="DLNKFJWJGHZFW">
<table>
<tr><td><input type="hidden" name="on0" value="Shipping Options">Shipping Options</td></tr><tr><td><select name="os0">
	<option value="UK Second Class  + £2.85">UK Second Class  + £2.85 £2.85 GBP</option>
	<option value="UK First Class + £3.85">UK First Class + £3.85 £3.85 GBP</option>
	<option value="Europe + £5.00">Europe + £5.00 £5.00 GBP</option>
	<option value="Rest of World + £7.00">Rest of World + £7.00 £7.00 GBP</option>
</select> </td></tr>
<tr><td><input type="hidden" name="on1" value="or call us on +44(0)444444444">or call us on +44(0)444444444</td></tr><tr><td><input type="text" name="os1" maxlength="200"></td></tr>
</table>
<input type="hidden" name="currency_code" value="GBP">
<input type="hidden" name="handling_cart" value="NNNN">
<input type="image" src="https://www.paypalobjects.com/en_GB/i/btn/btn_cart_LG.gif" border="0" name="submit" alt="PayPal – The safer, easier way to pay online.">
<img alt="" border="0" src="https://www.paypalobjects.com/en_GB/i/scr/pixel.gif" width="1" height="1">
</form>

次要问题:这个html从PayPal获得一个直接的错误,可能--除其他外--因为我仍然将它称为宿主按钮(我想我可能需要删除它,并以某种方式将它链接到Merchant??)。

注意,我在这里更改了托管按钮id,因为我担心安全性--我可能不需要这样做。

非常感谢

艾利森

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2015-09-24 16:18:42

您的宿主按钮的格式不正确,无法处理传送下拉列表。此外,您不能修改托管按钮,它将无法工作。我已经创建了一些示例,非托管按钮代码,作为一个例子,什么将工作,如果航运计算器是不可用的在您的地区。

您必须更新业务价值,以反映您的商人id或您的电子邮件地址,以测试按钮代码。

代码语言:javascript
复制
<form target="paypal" action="https://www.paypal.com/cgi-bin/webscr" method="post" >
<input type="hidden" name="cmd" value="_cart">
<input type="hidden" name="business" value="youremail@email.com">
<input type="hidden" name="lc" value="GB">
<input type="hidden" name="item_name" value="Shipping Options">
<input type="hidden" name="button_subtype" value="products">
<input type="hidden" name="no_note" value="0">
<input type="hidden" name="cn" value="Add special instructions to the seller:">
<input type="hidden" name="no_shipping" value="2">
<input type="hidden" name="currency_code" value="GBP">
<input type="hidden" name="add" value="1">
<input type="hidden" name="bn" value="PP-ShopCartBF:btn_cart_LG.gif:NonHosted">
<table>
<tr><td><input type="hidden" name="on0" value="Shipping Options">Shipping Options</td></tr><tr><td><select name="os0">
    <option value="UK Second Class">UK Second Class £2.85 GBP</option>
    <option value="UK First Class">UK First Class £3.85 GBP</option>
    <option value="Europe">Europe £5.00 GBP</option>
    <option value="Rest of World">Rest of World £7.00 GBP</option>
</select> </td></tr>
<tr><td><input type="hidden" name="on1" value="or call us on +44(0)444444444">or call us on +44(0)444444444</td></tr><tr><td><input type="text" name="os1" maxlength="200"></td></tr>
</table>
<input type="hidden" name="currency_code" value="GBP">
<input type="hidden" name="option_select0" value="UK Second Class">
<input type="hidden" name="option_amount0" value="2.85">
<input type="hidden" name="option_select1" value="UK First Class">
<input type="hidden" name="option_amount1" value="3.85">
<input type="hidden" name="option_select2" value="Europe">
<input type="hidden" name="option_amount2" value="5.00">
<input type="hidden" name="option_select3" value="Rest of World">
<input type="hidden" name="option_amount3" value="7.00">
<input type="hidden" name="option_index" value="0">


<input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_cart_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
<img alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1">
</form>
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/32759214

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档