我正在处理一个PRESTASHOP覆盖选项,我需要更新getPackageShippingCost()函数,在重写/classes/cart.php中,我希望prestashop只在我的id_carrier是5的情况下才会考虑这个过度,可以吗?
发布于 2016-05-03 11:59:44
是的,你可以这样做:
class Cart extends CartCore
{
public function getPackageShippingCost($id_carrier = null, $use_tax = true, Country $default_country = null, $product_list = null, $id_zone = null)
{
if ($id_carrier !== 5)
{
return parent::getPackageShippingCost($id_carrier, $use_tax, $default_country, $product_list, $id_zone);
}
// YOUR CUSTOM CODE
}
}
添加新的覆盖后,不要忘记删除文件/cache/class_index.php
。
https://stackoverflow.com/questions/37002268
复制相似问题