Tkey1 Posted June 25, 2017 Share Posted June 25, 2017 Hello i've been trying to make my first test module to learn about modules development i've done the main steps but when i try to install it, it wont let me, it says the same error as this thread some people there say it is a syntaxis error on the code but im not sure... Can someone help me please? Here is the code i have.. <?php if(!defined('_PS_VERSION_')){ exit; } use PrestaShop\PrestaShop\Core\Module\WidgetInterface; class mimodulon extends Module implements WidgetInterface{ public function __construct(){ $this->name = "Test Module"; $this->tab = 'front_office_features'; $this->version = '1.0.0'; $this->author = 'Awiwi'; $this->need_instance = 0; $this->bootstrap = true; parent::__construct(); $this->displayName = $this->trans('First Test Module', array(), 'Module.mimodulon'); $this->description = $this->trans('First Module Test', array(), 'Module.mimodulon'); $this->ps_version_compilancy = array('min' => '1.7.0.0', 'max' => _PS_VERSION_); } public function install(){ Configuration::updateValue('MIMODULO', false); return parent::install()&& $this->registerHook('header') && $this->registerHook('backOfficeHeader')&& $this->registerHook('displayHome')&& $this->registerHook('displayLeftColumn')&& $this->registerHook('footer'); } public function uninstall() { Configuration::deleteByName('MIMODULO', false); return parent::uninstall(); } public function renderWidget($hookName, array $configuration) { } public function getWidgetVariables($hookName, array $configuration) { } } I dont know what im missing please i really need help.. im lost now. Link to comment Share on other sites More sharing options...
bellini13 Posted June 26, 2017 Share Posted June 26, 2017 I believe the name variable of the module needs to match the class name. Your modules class name is mimodulon Your modules variable name is "Test Module" Change this.. $this->name = "Test Module"; to $this->name = 'mimodulon'; And then refresh the modules page and try to install again Link to comment Share on other sites More sharing options...
Tkey1 Posted June 26, 2017 Author Share Posted June 26, 2017 I believe the name variable of the module needs to match the class name. Your modules class name is mimodulon Your modules variable name is "Test Module" Change this.. $this->name = "Test Module"; to $this->name = 'mimodulon'; And then refresh the modules page and try to install again Thank you for your answer... i cant believe that was the problem... oh my god.. i spent 2 days trying to figure it out so at the end the obligatory names are the module folder, the module.php name and the module class name.. all of them should be the same or either wont work, thank you so much! Link to comment Share on other sites More sharing options...
bellini13 Posted June 27, 2017 Share Posted June 27, 2017 For future reference http://doc.prestashop.com/display/PS16/Creating+a+first+module 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