简体   繁体   English

贝宝按钮添加到购物车

[英]Paypal button add to shoping cart

I'm trying to do an add to shooping cart button. 我正在尝试添加到购物车按钮。 But what happens now when I use the button is this: http://imgur.com/ldEEOK3 但是,当我使用该按钮时,现在会发生以下情况: http : //imgur.com/ldEEOK3

I want the button when I click on it, it adds the product to the cart, and stays in the same page. 当我单击按钮时,我想要按钮,它将产品添加到购物车,并停留在同一页面上。

<tr class="record">

    <td><?php echo $row['ref']; ?></td>
    <td><?php echo $row['nome']; ?></td>
    <td><?php echo $row['preco']; ?></td>
    <td><form method="post" action="https://www.paypal.com/cgi-bin/webscr" target="paypal">
<input type="hidden" name="cmd" value="_cart">
<input type="hidden" name="upload" value="1">
<input type="hidden" name="business" value="paypalID"> //not gonna show it :p

<input type="hidden" name="item_name_1" value="<?php echo $row['nome']; ?>">
<input type="hidden" name="quantity_1" value="1">
<input type="hidden" name="amount_1" value="<?php echo $row['preco']; ?>">

<input type="image" src="https://www.paypalobjects.com/pt_PT/PT/i/btn/btn_cart_SM.gif" border="0" name="submit" alt="PayPal - A forma mais fácil e segura de efetuar pagamentos online!">
<img alt="" border="0" src="https://www.paypalobjects.com/pt_PT/i/scr/pixel.gif" width="1" height="1">
</form>
</tr>

And I will post the code for the show cart button, but I guess it has no problems since it is working fine: 我将发布show cart按钮的代码,但是我猜它没有问题,因为它可以正常工作:

<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="encrypted" value="erased the big encrypt code"> <input type="image" src="https://www.paypalobjects.com/pt_PT/i/btn/btn_viewcart_SM.gif" border="0" name="submit" alt="PayPal - A forma mais fácil e segura de efetuar pagamentos online!"> <img alt="" border="0" src="https://www.paypalobjects.com/pt_PT/i/scr/pixel.gif" width="1" height="1"> </form>

You may want to change some of the variables in the Add-to-cart button: 您可能需要更改“购物车”按钮中的某些变量:

<form method="post" action="https://www.paypal.com/cgi-bin/webscr" target="paypal">
<input type="hidden" name="cmd" value="_cart">
<input type="hidden" name="add" value="1">
<input type="hidden" name="business" value="paypalID"> //not gonna show it :p

<input type="hidden" name="item_name" value="<?php echo $row['nome']; ?>">
<input type="hidden" name="quantity" value="1">
<input type="hidden" name="amount" value="<?php echo $row['preco']; ?>">

<input type="image" src="https://www.paypalobjects.com/pt_PT/PT/i/btn/btn_cart_SM.gif" border="0" name="submit" alt="PayPal - A forma mais fácil e segura de efetuar pagamentos online!">
<img alt="" border="0" src="https://www.paypalobjects.com/pt_PT/i/scr/pixel.gif" width="1" height="1">
</form>

The code you created is for "cart upload" function. 您创建的代码用于“购物车上传”功能。 It is usually used when some shopping cart feature has been embedded in your site and to pass the contents of shopping carts to PayPal for checkout and payment processing. 它通常在您的网站中嵌入了某些购物车功能并将购物车的内容传递到PayPal进行结帐和付款处理时使用。

https://developer.paypal.com/docs/classic/paypal-payments-standard/integration-guide/cart_upload/ https://developer.paypal.com/docs/classic/paypal-payments-standard/integration-guide/cart_upload/

Please check below link for sample codes of "Add to cart" button. 请检查下面的链接以获取“添加到购物车”按钮的示例代码。

https://developer.paypal.com/docs/classic/paypal-payments-standard/integration-guide/paypal_shopping_cart/#id08AEC030FDB https://developer.paypal.com/docs/classic/paypal-payments-standard/integration-guide/paypal_shopping_cart/#id08AEC030FDB

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM