2017-10-20 90 views
0

在我的控制器中,我有shipping.I'm的成本价值试图发送到getOrderShippingCost函数。但我的车出航运free如何在prestashop载体模块开发中插入不同的运输成本

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。那是什么?如何返回我的v ALUE?

回答

0

您可以通过将运营商的附加费用(例如税金和handling_rates)设置为零来解决此问题,然后将其设置为“不自由”