[英]how to get multiple products from cart to paypal payment
I want to get multiple products on paypal payment page. 我想在贝宝付款页面上获得多种产品。 I am only getting a single first product at the moment.
我现在只得到一个第一批产品。 can someone help me out where I am wrong.
有人可以帮助我解决我的错误之处。 below is my code..i searched google and found two more things to be changed.
以下是我的代码。.我搜索了google,发现还有两件事需要更改。 ie _xclick to _cart and one more
<input type='hidden' value='1' name='upload'/>
即_xclick到_cart和另外一个
<input type='hidden' value='1' name='upload'/>
hidden'value <input type='hidden' value='1' name='upload'/>
1'name <input type='hidden' value='1' name='upload'/>
Now I am getting your cart is empty. 现在我得到您的购物车是空的。
$query = mysql_query("SELECT * FROM temporderdetails WHERE omid = '$ordermaster_id' " ) or die(mysql_error());
while($row = mysql_fetch_array($query)){
$productid = $row['productid'];
$quantity = $row['qty'];
$price = $row['price'];
$subtotal = $row['subtotal'];
$query1 = mysql_query("select product_name from products where product_id = '$productid'" ) or die(mysql_error());
while($row1 = mysql_fetch_array($query1)){
$product = $row1['product_name'];
<form action='<?php echo $payment_url ;?>' method='post'>
<input type="hidden" name="cmd" value="_cart">
<input type='hidden' name='business' value='<?php echo $payment_email;?>'>
<input type='hidden' name='item_name' value='<?php echo $product;?>'>
<input type='hidden' name='upload' value='1'>
<input type='hidden' name='quantity' value='<?php echo $quantity; ?>'>
<input type='hidden' name='amount' value='<?php echo $grandtotal;?>'>
<input type='hidden' name='currency_code' value='USD'>
<input type='hidden' name='return' value='<?php echo $payment_success;?>'>
<input type='hidden' name='cancel_return' value='<?php echo $payment_failed;?>'>
}
}
In case of multiple products you have to use the following variables for each product: amount_x item_name_x 如果有多个产品,则必须为每个产品使用以下变量:amount_x item_name_x
where x is the product number (starting from 1). 其中x是产品编号(从1开始)。 So, what you have to do is something like this:
因此,您要做的是这样的:
<form action='<?php echo $payment_url ;?>' method='post'>
<input type="hidden" name="cmd" value="_cart">
<input type='hidden' name='business' value='<?php echo $payment_email;?>'>
<input type='hidden' name='upload' value='1'>
<input type='hidden' name='currency_code' value='USD'>
<input type='hidden' name='return' value='<?php echo $payment_success;?>'>
<input type='hidden' name='cancel_return' value='<?php echo $payment_failed;?>'>
In here you can get all your products (your "while" statement), use a counter variable, and then: 在这里,您可以获取所有产品(“ while”语句),使用计数器变量,然后:
<input type='hidden' name='amount_<?php echo $counter;?>' value='<?php $price ?>'>
<input type='hidden' name='item_name_<?php echo $counter;?>' value='<?php echo $product?>'>
<?php $counter++ ?>
Finally close the form 最后关闭表格
</form>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.