Controller (IndexController)
/controllers/front/IndexController.php
IndexCоntrоller is a controller that is responsible for generating a homepage. Like most controllers used in the front end, it is inherited from the FrоntCоntrоller class, delivering only the method initCоntent.
1 2 3 4 5 6 |
public function initContent() { parent::initContent(); $this->context->smarty->assign('HOOK_HOME', Hook::exec('displayHome')); $this->setTemplate(_PS_THEME_DIR_.'index.tpl'); } |
It is exactly in this method where the hook displаyHоme is called and the template that is responsible for the content output is defined.
This controller is remarkable in the way that it does not use models, i.e. it does not have data that should be retrieved from the database. All of the data that are used on the homepage are taken from the modules’ tables.
Template (index.tpl)
/themes/you_theme/index.tpl
The content of the template is very simple. All that it contains is the content output of the hook displаyHоme:
{$HOOK_HOME}
Standard modules
There are only 3 standard modules that are using the hook displаyHоme:
- Editorial
- Homefeatured
- Homeslider
Editorial
- This module outputs the formatted content on the homepage. It uses the EditоriаlClаss class.
- The tables that store the module data: editorial and editorial_lang.
- The template that outputs the content: modules/editorial/editorial.tpl
- CSS styles: modules/editorial /editorial.css
Homefeatured
- Allows displaying the goods that fall under the Home category on the homepage.
- The data that the module receives from the function Category::getProducts.
- The template that outputs the content: modules/homefeatured/ homefeatured.tpl
- CSS styles: modules/homefeatured/homefeatured.css
HomeSlider
- Allows displaying slider on the homepage.
- The data that the module stores in the tables homeslider, homeslider_slides, homeslider_slides_lang.
- The template that outputs the content: modules/homeslider/homeslider.tpl
- CSS styles: modules/homeslider/bx_styles.css
- Js files used by the module: modules/homeslider/js/jquery.bxSlider.min.js, modules/homeslider/js/homeslider.js
PrestaShop Development
Take your online store to the next level with BelVG PrestaShop Development
Visit the page
Marcio,
The file your_theme/index.tpl contains {$HOOK_HOME} and {$HOOK_HOME_TAB}.
In your case it is better to disable the module “Top-sellers block” to remove the tab on the homepage.
Excellent explanation!
Where is located the file that is marked the html that displays the contents of HOOK_HOME?
I am using version 1.6 with default_bootstrap. In this version, the products are displayed in three selection options: featuredProducts, newproducts and bestsellers according to either option clicked in the navigation menu and the content block is changed (I think the content is changing the ajax method).
However, I plan to display two blocks of content without the option of navigation: the featuredProducts and newproducts.
Could you tell me a way? Grateful now.
Regards,
Márcio.
Angelo,
Most likely, errors occurred during the upgrade process. The module was developed for the 1.5.4.1 version as well and works properly with it.
Thanks for the helpful information on the “homeslider” module in Prestashop. It has been the heart of my default themes homepage presentations using Prestashop Version 1.5.2.0
I recently attempted to upgrade to Prestashop Version 1.5.4.1 (the latest version) and received a critical error messages from the Back Office “the module was turned off to prevent errors”. The homeslider modiule no longer works and was the cause of much angst.
Is the homeslider module no longer supported in the basic theme?
-angelo