我怎么能在prestashop中删除钩子?

时间:2018-04-18 18:43:50

标签: php prestashop prestashop-1.6

    public function install()
{
    if (parent::install()===false) {
        return false;
    }

    if ($this->registerHook('actionValidateOrder') == false) {
        return false;
    }
    if ($this->registerHook('actionObjectOrderSlipAddAfter') == false) {
        return false;
    }
    $this->saveDefaultConfig();
    // replace some a part of tpl file
    require_once(_PS_MODULE_DIR_ . "ba_prestashop_invoice/includes/helper.php");
    BAInvoiceHelper::configOldTplFile();
    return true;
}

在安装模块期间它将这些元素插入钩子中,我不知道如何删除它? 因为我得到这个错误livraison
致命错误:未捕获错误:调用未定义的方法OrderInvoice :: getDeliveryNumberFormatted()?

2 个答案:

答案 0 :(得分:0)

只需使用:     $这 - > unregisterHook( 'HookName'); 但我认为你的错误与钩子无关

答案 1 :(得分:0)

只需转到admin / themes / default / template / controllers / orders / _documents.tpl 在第79行上删除或注释这些代码行 它将解决您的问题

{if get_class($document) eq 'OrderInvoice'}
    {if isset($document->is_delivery)}
        {$document->getDeliveryNumberFormatted($current_id_lang, $order->id_shop)}
    {else}
        {$document->getInvoiceNumberFormatted($current_id_lang, $order->id_shop)}
    {/if}
{elseif get_class($document) eq 'OrderSlip'}
    {$document->getCreditSlipsNumberFormatted($current_id_lang, $order->id_shop)}
{/if}