- PrestaShop Module Development
- Fabien Serny
- 225字
- 2021-08-05 17:12:27
Chapter 2. Hooks
A hook is the most essential concept to understand if you want to code a PrestaShop module, but as you will see, it's very easy.
Hooks are points on which you can attach modules in a way to change the normal behavior of the shop. In the PrestaShop 1.5/1.6 source code, their names are usually prefixed with display or action, depending on their purpose.
The display type hooks are generally used to add HTML or JS code on all or specific pages (for example, to add a block in a column, add an accessories link on a product page, add a field in a form, add information on a confirmation order page, and so on).
The action type hooks are used to change the behavior of the software by adding actions when events are triggered (for example, to add loyalty points to a customer when he or she places an order, logging modifications when a product is updated, send an e-mail to the merchant when a product is out of stock, and so on).
In this chapter, we will:
- Register a module on a hook (to display comments form on the front office)
- Use a database class (to register user comments in database)
- Discover how hooks are triggered
- Learn how to add new hooks
- Learn how to use dynamic hooks
- 重構(gòu)跨境電商:阿里巴巴中小企業(yè)全球化實(shí)踐
- 互聯(lián)網(wǎng)+:中外電商發(fā)展路線圖
- 網(wǎng)絡(luò)快富:賺錢最快胡生意經(jīng)
- APP運(yùn)營(yíng)推廣:搶占移動(dòng)互聯(lián)網(wǎng)入口、引爆下載量、留住用戶(精彩圖解版)
- 跨境電商業(yè)務(wù)一本通
- 網(wǎng)絡(luò)整合營(yíng)銷的道與術(shù)
- 玩轉(zhuǎn)大數(shù)據(jù):商業(yè)分析+運(yùn)營(yíng)推廣+營(yíng)銷技巧+實(shí)戰(zhàn)案例
- 日進(jìn)3萬3:微店這樣開才賺錢
- 互聯(lián)網(wǎng)+微創(chuàng)業(yè)
- 公眾號(hào)運(yùn)營(yíng)實(shí)戰(zhàn)手冊(cè):57招讓你實(shí)現(xiàn)從0到10萬+
- 一本書學(xué)會(huì)人情世故
- 前廳部運(yùn)營(yíng)管理
- 獲利時(shí)代:移動(dòng)互聯(lián)網(wǎng)的新商業(yè)模式
- 電子商務(wù)多平臺(tái)運(yùn)營(yíng)與實(shí)踐
- 品質(zhì)電商運(yùn)營(yíng)實(shí)戰(zhàn):消費(fèi)升級(jí)時(shí)代的電商變革