S
S
Sergey2015-08-01 07:25:12
Prestashop
Sergey, 2015-08-01 07:25:12

How to create hook in prestashop 1.6?

Tell me the info that I just didn’t try, but the hook does not appear in the "Modules\Location" section

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey, 2015-08-04
@alekskondr

I did everything as here prestatips.info/adding-new-hook-prestashop
1. Added a hook in the database:
2. Added CategoryController.php class to override/controllers/front/

class CategoryController extends CategoryControllerCore
{
    /**
     * @see CategoryControllerCore::initContent()
     */
    public function initContent()
    {
        parent::initContent();
 
        $this->context->smarty->assign(
            'HOOK_CATEGORY_TOP', Hook::exec('displayCategoryTop')
        );
    }
}

3. Deleted the cache/class_index.php file
4. Added themes/themename/category.tpl in the view
{if $HOOK_CATEGORY_TOP}
    <div class="hook_category_top">
        {$HOOK_CATEGORY_TOP}
    </div>
{/if}

But the hook is not added to him!

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question