如何在Prestashop载体模块开发中插入不同的运输成本



在我的控制器中,我有运输的成本值。我正在尝试将其发送到getOrderShippingCost函数。 但是我的购物车显示运输free

控制器.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时 .为什么会这样?如何退货?

您可以通过

将运营商的额外费用(例如税费和handling_rates)设置为零,然后将"不免费"设置为"不免费"来解决此问题

最新更新