Prestashop 自定义挂钩不显示
Prestashop custom hook doesn't shows
我创建了一个自定义挂钩,如 PrestaShop 文档所述,经过几次尝试后,我仍然无法将其显示在前面。它显示在背面和 Positions 页面中,但我有什么地方做得不对吗?
钩子
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');
}
报名
{
if (!parent::install()
|| !$this->registerHook('displayProductsListBottom')
) {
return false;
}
return true;
}
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:...
模板:
<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>
你犯了一个小错误:)
public function displayProductsListBottom($params)
应该是:
public function hookDisplayProductsListBottom($params)
我创建了一个自定义挂钩,如 PrestaShop 文档所述,经过几次尝试后,我仍然无法将其显示在前面。它显示在背面和 Positions 页面中,但我有什么地方做得不对吗? 钩子
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');
}
报名
{
if (!parent::install()
|| !$this->registerHook('displayProductsListBottom')
) {
return false;
}
return true;
}
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:...
模板:
<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>
你犯了一个小错误:)
public function displayProductsListBottom($params)
应该是:
public function hookDisplayProductsListBottom($params)