I created a custom hook as the PrestaShop docs states, and after several tries I still can't get it displayed in front. It shows in the back and in the Positions page, though ¿Is there anything I'm not doing right? The hook
public function displayProductsListBottom($params)
{
$this->context->smarty->assign(
array(
'logged' => $this->context->customer->isLogged(),
'module_textbanner_title' => Configuration::get('module_textbanner_title'),
'module_textbanner_subtitle' => Configuration::get('module_textbanner_subtitle'),
'module_textbanner_content' => Configuration::get('module_textbanner_content')
)
);
$this->context->controller->registerStylesheet(
'module-textbanner',
'modules/'.$this->name.'/views/css/module_textbanner.css',
array('position' => 'top', 'priority' => 150)
);
return $this->display(__FILE__, 'views/templates/front/ps_module_textbanner.tpl');
}
The registration
{
if (!parent::install()
|| !$this->registerHook('displayProductsListBottom')
) {
return false;
}
return true;
}
The theme.yml
configuration:
PS_IMAGE_QUALITY: png
modules:
to_enable:
- ps_linklist
to_disable:
- ps_searchbar
hooks:
custom_hooks:
name: displayProductsListBottom
title: displayProductsListBottom
description: Adds some content to products list
modules_to_hook:...
The template:
<div id="js-product-list">
{*<div class="products">*}
{foreach from=$listing.products item="product"}
{block name='product_miniature'}
{include file='catalog/_partials/miniatures/product.tpl' product=$product}
{/block}
{/foreach}
{*</div>*}
{block name='pagination'}
{include file='_partials/pagination.tpl' pagination=$listing.pagination}
{/block}
{hook h='displayProductsListBottom' mod='ps_module_textbanner'}
<div class="visible--mobile text-right up">
<a href="#header" class="btn btn-secondary">
{l s='Back to top' d='Shop.Theme.Actions'}
<i class="material-icons"></i>
</a>
</div>
</div>
You've made a small mistake :)
public function displayProductsListBottom($params)
should be:
public function hookDisplayProductsListBottom($params)