我用的是预铺1.6。我的网站提供“免费送货”为购买超过80美元。我的网站也有一个推广“买1得到1免费”。
现在,一个项目可以花费大约60美元的和我坚持客户购买两个产品从同一类别,以便有权购买1 get 1。
如果客户购买一种产品,它应该花费60美元(不免费送货,因为最终价格< 80)。
如果顾客购买2= 120美元,但是在“购买1得到1免费”促销之后,最终的总价是60。所以说,这个客户不是免费送货,但是我的网站给这个客户免费送货,因为“免费送货”的逻辑是基于折扣前的总价(120美元)。
我该怎么解决这个问题?我希望免费送货的计算是基于最终的总价(折扣后)。

发布于 2016-06-02 08:10:27
您必须从getPackageShippingCost()重写Cart.php方法。
并改变这些行文:
} else {
if ($shipping_method == Carrier::SHIPPING_METHOD_WEIGHT) {
$shipping_cost += $carrier->getDeliveryPriceByWeight($this->getTotalWeight($product_list), $id_zone);
} else { // by price
$shipping_cost += $carrier->getDeliveryPriceByPrice($order_total, $id_zone, (int)$this->id_currency);
}
}
} else {
if ($shipping_method == Carrier::SHIPPING_METHOD_WEIGHT) {
$shipping_cost += $carrier->getDeliveryPriceByWeight($this->getTotalWeight($product_list), $id_zone);
} else {
$shipping_cost += $carrier->getDeliveryPriceByPrice($order_total, $id_zone, (int)$this->id_currency);
}
}将$order_total替换为$orderTotalwithDiscounts
} else {
if ($shipping_method == Carrier::SHIPPING_METHOD_WEIGHT) {
$shipping_cost += $carrier->getDeliveryPriceByWeight($this->getTotalWeight($product_list), $id_zone);
} else { // by price
$shipping_cost += $carrier->getDeliveryPriceByPrice($orderTotalwithDiscounts, $id_zone, (int)$this->id_currency);
}
}
} else {
if ($shipping_method == Carrier::SHIPPING_METHOD_WEIGHT) {
$shipping_cost += $carrier->getDeliveryPriceByWeight($this->getTotalWeight($product_list), $id_zone);
} else {
$shipping_cost += $carrier->getDeliveryPriceByPrice($orderTotalwithDiscounts, $id_zone, (int)$this->id_currency);
}
}如果您不知道如何重写类,请查看这份文件。
https://stackoverflow.com/questions/37575809
复制相似问题