- PrestaShop Module Development
- Fabien Serny
- 392字
- 2021-08-05 17:12:27
Changing the position of your module on a hook
You have to know that a module attached to a hook has a position. The positions represent the order in which the modules are called. When you attach a module to a hook, the module will be automatically set in the last position. However, you will be able, for most of the hooks, to change the order of the modules in PrestaShop's back office (by navigating to Main menu | Modules | Positions).
In our case, if you didn't install any other module than mymodcomments
since you installed your shop, you should have only one other module attached to the hook: displayProductTabContent
that results in Product Comments (which is a module similar to the one we are creating):

As you can see, the position number and arrows are displayed for each module attached to this hook. You can change the position either by clicking on the position of My Module of product comments, and without releasing your click, drag it up just above the Product Comments module, or by clicking on one of the arrows. The new position will then be automatically saved.
If you go back to your front office, you will see that Display me on product page is now displayed above the No customer comments for the moment content:

This was just to show you how positions work, but currently, we do not need to keep the Product Comments native module. So you can uninstall it or unhook it.
To unhook a module, you just have to click on the arrow on the right of the Edit button and select Unhook:

It will unregister the module from the hook; however, in the case of the Product Comments module, it will still be attached to the displayProductTab
hook.
Removing a module from one hook can be interesting in some cases, but if you want to remove the module from all the hooks, the best way is to uninstall it. So, go and uninstall the Product Comments module.
Note
You can also attach a module to a hook manually by using the Transplant a module button at the top of your page. However, the module has to contain the method associated with the hook on which you want to attach the module (for example, the hookDisplayProductTabContent
class method for the displayProductTabContent
hook).
- 電子商務(wù)概論(第2版)
- 網(wǎng)上店鋪運(yùn)營(yíng)實(shí)務(wù)
- 9堂課輕松玩轉(zhuǎn)短視頻
- 首席視頻官:5G時(shí)代的短視頻布局與營(yíng)銷革命
- 手機(jī)淘寶運(yùn)營(yíng)攻略: 開(kāi)店 裝修 管理 推廣實(shí)戰(zhàn)
- 區(qū)塊鏈+醫(yī)療:新技術(shù)賦能醫(yī)療的應(yīng)用與未來(lái)
- 微商操盤手冊(cè):微商品牌新零售運(yùn)營(yíng)寶典
- 互聯(lián)網(wǎng)思維到底是什么:移動(dòng)浪潮下的新商業(yè)邏輯
- 微信的秘密:智能手機(jī)時(shí)代的新?tīng)I(yíng)銷寶典
- 淘寶天貓開(kāi)店必備技能速查速用手冊(cè)
- 體驗(yàn)為王:世界知名零售企業(yè)開(kāi)創(chuàng)移動(dòng)互聯(lián)新時(shí)代
- 玩轉(zhuǎn)O2O:商業(yè)分析+運(yùn)營(yíng)推廣+營(yíng)銷技巧+實(shí)戰(zhàn)案例
- 淘寶天貓美工實(shí)戰(zhàn)從入門到精通:圖像處理、寶貝拍攝、視頻制作、店鋪裝修一本就夠
- 網(wǎng)店美工:網(wǎng)店視覺(jué)設(shè)計(jì)實(shí)操指南
- 區(qū)塊鏈+未來(lái)應(yīng)用