Stolle95 Posted April 3, 2017 Share Posted April 3, 2017 Hello, I'm new to Prestashop and have been testing creating my own module. I have only found guides in 1.6 and starting to think that something is missing. My module won't get loaded automatically. Do I have to do anything more in 1.7? My code: <?php if (!defined('_PS_VERSION_')) exit; class TestModule extends Module { public function __construct() { $this->name = 'testmodule'; $this->tab = 'front_office_features'; $this->version = '1.0'; $this->author = 'John Doe'; $this->ps_versions_comliancy = array('min' => '1.5', 'max' => _PS_VERSION_); $this->need_instance = 0; $this->bootstrap = true; $this->displayName = $this->l('Test Module'); $this->desctiption = $this->l('A module test'); } public funtion install() { if (!parent::install() OR $this->registerHook('displayLeftColumn')) return false; return true; } public function hookDisplayLeftColumn($params) { return 'Hello world'; } } Cheers, Stolle Link to comment Share on other sites More sharing options...
nadie Posted April 3, 2017 Share Posted April 3, 2017 Hi Stolle95,(Official) PrestaShopModule Developer Guide -> Prestashop 1.7: http://developers.prestashop.com/module/index.html Sorry for my English, 1 Link to comment Share on other sites More sharing options...
Stolle95 Posted April 3, 2017 Author Share Posted April 3, 2017 (edited) Hi Stolle95, (Official) PrestaShopModule Developer Guide -> Prestashop 1.7: http://developers.prestashop.com/module/index.html Sorry for my English, Hello! I've been following the guide and nothing happens, and I've also spotted "Here are the possible files and folders for a PrestaShop 1.6 module:" and not 1.7 in the guide, that might just be a miss in the text? It's strange because the module is not being loaded. Can anyone spot something that shouldn't be there. cheers, S Edited April 3, 2017 by Stolle95 (see edit history) Link to comment Share on other sites More sharing options...
bellini13 Posted April 4, 2017 Share Posted April 4, 2017 I think the problem you have is that in PS v1.7, I do not believe many pages use a left column. try using a different hook Link to comment Share on other sites More sharing options...
mrangwala Posted August 21, 2019 Share Posted August 21, 2019 On 4/3/2017 at 11:30 PM, Stolle95 said: Hello, I'm new to Prestashop and have been testing creating my own module. I have only found guides in 1.6 and starting to think that something is missing. My module won't get loaded automatically. Do I have to do anything more in 1.7? My code: <?php if (!defined('_PS_VERSION_')) exit; class TestModule extends Module { public function __construct() { $this->name = 'testmodule'; $this->tab = 'front_office_features'; $this->version = '1.0'; $this->author = 'John Doe'; $this->ps_versions_comliancy = array('min' => '1.5', 'max' => _PS_VERSION_); $this->need_instance = 0; $this->bootstrap = true; $this->displayName = $this->l('Test Module'); $this->desctiption = $this->l('A module test'); } public funtion install() { if (!parent::install() OR $this->registerHook('displayLeftColumn')) return false; return true; } public function hookDisplayLeftColumn($params) { return 'Hello world'; } } Cheers, Stolle Okay i am years late here but i think the error might lie with the structuring of the if condition u could try structuring it like if(parent::install() && $this->registerHook('displayLeftColumn')) { return true; } else { return false; } i think its a long shot it will help you now but just in case someone else like me happens across this : - D cheers! Link to comment Share on other sites More sharing options...
zod Posted May 7, 2020 Share Posted May 7, 2020 I think there is an error in the install function, you should use: public function install() { if (Shop::isFeatureActive()) { Shop::setContext(Shop::CONTEXT_ALL); } if (!parent::install() || !$this->registerHook('leftColumn') ) { return false; } return true; } Source with explanation of the code here: https://devdocs.prestashop.com/1.7/modules/creation/ Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now