应用折扣后我需要进行运费计算
例如。
购物车总额:65 $
免费送货开始:65 $
折扣:5%
折扣后,价格降至65 $以下,并且仍然免费送货 我需要它来计算发货之前的折扣
答案 0 :(得分:2)
首先按运营商设置范围(0-65:X欧元,高于65:0欧元)
重写Cart.php类
Rewrite function getPackageShippingCost
行后
// Order total in default currency without fees
$order_total = $this->getOrderTotal(true, Cart::BOTH_WITHOUT_SHIPPING, $product_list);
添加此
//Recalcul total pour panier et livraison gratuite
$listeDiscounts = $this->getCartRules();
$total_discounts = 0;
if (is_array($listeDiscounts)) {
if (isset($listeDiscounts[0]['value_real']))
$total_discounts = $listeDiscounts[0]['value_real'];
}
$price_to_apply_shipment = floatval($order_total) - floatval($total_discounts);
替换
//$check_delivery_price_by_price = Carrier::checkDeliveryPriceByPrice($row['id_carrier'], $total_order, (int)$id_zone, (int)$this->id_currency);
by
$check_delivery_price_by_price = Carrier::checkDeliveryPriceByPrice($row['id_carrier'], $price_to_apply_shipment, (int)$id_zone, (int)$this->id_currency);
然后
//$shipping_cost += $carrier->getDeliveryPriceByPrice($the_total_price, $id_zone, (int)$this->id_currency);
By
$shipping_cost += $carrier->getDeliveryPriceByPrice($price_to_apply_shipment, $id_zone, (int)$this->id_currency);
清除缓存并运行