1 回答

TA貢獻1875條經驗 獲得超3個贊
在我看來,您只是忘記在自定義鉤子添加后重置模塊。有必要在系統中注冊您的鉤子。或者,您可能沒有在方法中添加返回語句。hookDisplayModProfit
如果您正確遵循下一個說明,一切都應該像超級按鈕一樣工作
覆蓋樹枝模板文件。將同名文件放在模塊內的正確目錄中。在您的情況下,它是 并擴展原始文件 。不要忘記,我們只能擴展原始模板中存在的塊。例如:
your_module/views/PrestaShop/Admin/Product/CatalogPage/Lists/list.html.twig
{% extends 'PrestaShopBundle:Admin/Product/CatalogPage/Lists:list.html.twig' %}
{% block product_catalog_form_table_row %} {{ renderhook('displayModProfit') }} {% endblock %}
在您的模塊主php文件中添加到安裝方法中。
$this->registerHook('displayModProfit')
public function install() { return parent::install() && $this->registerHook('displayModProfit'); }
在主 php 文件中,添加一個帶有 return 語句的方法
hookDisplayModProfit
public function hookDisplayModProfit() { return 'Hello world!'; }
重置模塊以注冊新掛鉤。
- 1 回答
- 0 關注
- 161 瀏覽
添加回答
舉報