By default top page menu is regulated by two types of hooks: Top and Home. The Home hook is used when you need your content to be available on the homepage only, while the Top hook is responsible for all other pages.
But what should we do if we need some content to be available both on the homepage and some other page, although not all of them? In this case we need to verify the controller in the Top hook. The following method can be used for this task:
1 2 3 4 5 6 7 8 9 10 |
public function getCurrController() { if (!Tools::getValue('fc')) { if ($controller = Tools::getValue('controller')) { return $controller; } } return 'index'; } |
It will return index for the homepage.
This method should be declared in the class which contains the module. For instance, you can make the following verification in the Top hook:
1 2 3 4 5 6 7 8 9 10 11 |
if ($this->getCurrController() == 'index') { //this is the homepage } if ($this->getCurrController() == 'catalog') { //catalog page } if ($this->getCurrController() == 'product') { //product page } |

Partner With Us
Looking for a partner to grow your business? We are the right company to bring your webstore to success.
Talk to Andrey