1
我想添加多個產品進行處理在貝寶上。 訂單總結不顯示任何項目。我正在PayPal沙盒上試用它。PHP貝寶動態地傳遞多個項目
下面是完整的代碼:
<form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post" id="paypal">
<input type="hidden" name="cmd" value="_xclick" />
<input type="hidden" name="upload" value="1">
<input type="hidden" name="cbt" value="Return to max shop" />
<input type="hidden" name="business" value="[email protected]">
<?php
if(isset($_SESSION['products']))
{
$obj=new project;
$i=1;
foreach($_SESSION['products'] as $product)
{
$sql=$obj->get_products($product['id']);
$row=mysql_fetch_array($sql);
?>
<input type="hidden" name="item_number_<?php echo $i ?>" value="<?php echo $i ?>">
<input type="hidden" name="item_name_<?php echo $i ?>" value="<?php echo $row['title'] ?>" />
<input type="hidden" name="amount_<?php echo $i ?>" value="<?php echo $row['cost'] ?>">
<input type="hidden" name="item_quantity_<?php echo $i ?>" value="<?php echo $product['qty'] ?>">
<?php
$i++;
}
}
?>
<input type="hidden" name="button_subtype" value="services" />
<input type="hidden" name="no_shipping" value="1" />
<input type="hidden" name="return" value="http://localhost/oops" />
<input type="hidden" name="currency_code" value="USD"/>
<input type="hidden" id="custom" name="custom" value="invoice_id to track"/>
<input type="hidden" class="btn btn-primary" style="width:100%" alt="PayPal - The safer, easier way to pay online!"/>
<input type="image" src="http://www.paypalobjects.com/en_US/i/btn/x-click-but23.gif" border="0" name="submit" width="68" height="23" alt="Make payments with PayPal - it's fast, free and secure!">
</form>
我也試着像下面的排列格式,但沒有收到任何結果;
<input type="hidden" name="item_number[<?php echo $i ?>]" value="<?php echo $i ?>">
<input type="hidden" name="item_name[<?php echo $i ?>]" value="<?php echo $row['title'] ?>" />
<input type="hidden" name="amount[<?php echo $i ?>]" value="<?php echo $row['cost'] ?>">
<input type="hidden" name="item_quantity[<?php echo $i ?>]" value="<?php echo $product['qty'] ?>">
我想這很好,但它顯示了這個錯誤:「我們已經發現這個購物車的問題,如果問題仍然存在,請與商家聯繫。」 – Kamlesh
可以發佈從您的PHP代碼生成的HTML代碼? – Vimalnath
<輸入類型=「hidden」name =「item_name_2」value =「dffgh」/> – Kamlesh