我有价格为 29 美元的普通产品,我想要的是在这上面加收 10 美元,然后再给另一件商品(相同的产品),意思是 29 美元买一个,39 美元买两个。
为此,我使用此代码将产品添加到购物车
<?php
if($_POST['duplica_las_flores'] != '' && isset($_POST['duplica_las_flores']))
{
$customProdcutId = $_POST['productID'];
if(is_numeric($customProdcutId))
{
global $Shopp; //load up our $Shopp variable
$Product = new Product(absint($customProdcutId)); //We have to create a Product object to use in our add to cart function.
if(!empty($Product->id)){
$pricing = 10.00;
$result = $Shopp->Order->Cart->add(1, $Product, $pricing, false, array(), array()); //This is where "the magic happens"
}
}
?>
如果在单个产品页面中选中复选框,那么这将添加另一个具有我的自定义价格(10 美元)的产品,但这是添加具有相同价格(29 美元)的新产品。
如何在此处更改第二个产品的价格,或者有其他方法可以做到这一点吗?
谢谢