在我的控制器中,我有运费的成本价值。我试图将其发送到getOrderShippingCost
功能。但我的购物车显示出货free
Controller.php这样
$cost_val=120; //this value can be change
include_once(_PS_MODULE_DIR_.'delivery_scheduler/delivery_scheduler.php');
$DeliveryWeekSched=new delivery_scheduler();
$DeliveryWeekSched->getOrderShippingCost($cost_val,$cost_val);
delivery_scheduler.php
public function getOrderShippingCost($params, $shipping_cost)
{
if (Context::getContext()->customer->logged == true)
{
$id_address_delivery = Context::getContext()->cart->id_address_delivery;
$address = new Address($id_address_delivery);
return 100; // i want to return `$shipping_cost`
}
return $shipping_cost;
}
在购物车中显示$shipping_cost
时返回free
运费值。当100
返回购物车运费值显示100
时。为什么会这样?如何返回我的价值?
答案 0 :(得分:0)
您可以通过将运营商的额外费用(例如tax和handling_rates)设置为零来解决此问题,然后设置为"不免费"