php 我的重写类的方法不工作prestashop 8

3gtaxfhh  于 5个月前  发布在  PHP
关注(0)|答案(1)|浏览(55)

我在一个模块中覆盖了类Cart,并在prestashop 1.7中使用了它,现在我将其升级到prestashop 8,我在覆盖中添加的方法不再工作,它说“调用未定义的方法Cart::getOrderTotalGross()”这是我覆盖Cart.php类中的代码

use PrestaShop\PrestaShop\Adapter\ServiceLocator;

class Cart extends CartCore
{
 private const DEFAULT_ATTRIBUTES_KEYS = ['attributes' => '', 'attributes_small' => ''];
    public function getOrderTotalGross($with_taxes = true, $type = Cart::BOTH, $products = null, $id_carrier = null, $use_cache = true,  bool $keepOrderPrices = false, $small = false)
    {
        return $this->getOrderTotal($with_taxes, $type, $products, $id_carrier, $use_cache, $keepOrderPrices, true);
    }
}

字符串
这是我在模块的主文件中使用方法的部分

public function hookDisplayHeader($params)
    {
        if ((int) Configuration::get('ACOMPTE_CHOICE') == 1) {
            Context::getContext()->cookie->__set('installmentpayment_type', 1);
        }

        $cart = Context::getContext()->cart;
        if (Context::getContext()->cart->getOrderTotalGross(true) < (float) Configuration::get('ACOMPTE_MIN_AMOUNT')) {
            $id_cart = (int) $this->context->cart->id;
            Db::getInstance()->delete('installmentpayment', 'id_cart=' . (int) $id_cart);
            return;
        }


有人能帮忙吗?我在主模块文件的许多部分使用了该方法,但只有这一部分不起作用,我不知道为什么

hpcdzsge

hpcdzsge1#

你已经完全清除了你的商店的该高速缓存了吗?看起来你的安装中没有加载覆盖。
也许尝试打开调试模式,以禁用大多数PrestaShop缓存;也总是worto检查是否在后台启用覆盖。

相关问题