z3l Posted November 13, 2018 Share Posted November 13, 2018 Hello. I have my own custom module, a file called: apialigato.php inside /modules/apialigato folder. <?php if (!defined('_PS_VERSION_')) { exit; } class Api_Aligato extends Module { public function __construct() { $this->name = 'Api Aligato'; $this->tab = 'front_office_features'; $this->version = '1.0.0'; $this->author = 'Marcin Zelek'; $this->need_instance = 0; $this->ps_versions_compliancy = [ 'min' => '1.6', 'max' => _PS_VERSION_ ]; $this->bootstrap = true; parent::__construct(); $this->displayName = $this->l('Api Aligato'); $this->description = $this->l('A SOAP Api.'); $this->confirmUninstall = $this->l('Are you sure you want to uninstall?'); if (!Configuration::get('api_aligato_name')) { $this->warning = $this->l('No name provided'); } } public function install() { if (Shop::isFeatureActive()) { Shop::setContext(Shop::CONTEXT_ALL); } if (!parent::install() || !$this->registerHook('leftColumn') || !$this->registerHook('header') || !Configuration::updateValue('api_aligato_name', 'my friend') ) { return false; } return true; } public function uninstall() { if (!parent::uninstall() || !Configuration::deleteByName('api_aligato_name') ) { return false; } return true; } } ?> The module doesn't get loaded at modules tab in admin panel. Why ? Link to comment Share on other sites More sharing options...
z3l Posted November 13, 2018 Author Share Posted November 13, 2018 (edited) Thank you, hovewer the module is still not visible there. <?php if (!defined('_PS_VERSION_')) { exit; } class ApiAligato extends Module { public function __construct() { $this->name = 'apialigato'; $this->tab = 'others'; $this->version = '1.0.0'; $this->author = 'Marcin Zelek'; $this->need_instance = 0; $this->ps_versions_compliancy = [ 'min' => '1.6', 'max' => _PS_VERSION_ ]; $this->bootstrap = true; parent::__construct(); $this->displayName = $this->l('Api Aligato'); $this->description = $this->l('A SOAP Api.'); $this->confirmUninstall = $this->l('Are you sure you want to uninstall?'); if (!Configuration::get('api_aligato_name')) { $this->warning = $this->l('No name provided'); } } public function install() { if (Shop::isFeatureActive()) { Shop::setContext(Shop::CONTEXT_ALL); } if (!parent::install() || !$this->registerHook('leftColumn') || !$this->registerHook('header') || !Configuration::updateValue('api_aligato_name', 'my friend') ) { return false; } return true; } public function uninstall() { if (!parent::uninstall() || !Configuration::deleteByName('api_aligato_name') ) { return false; } return true; } } ?> Edited November 13, 2018 by z3l (see edit history) Link to comment Share on other sites More sharing options...
z3l Posted November 13, 2018 Author Share Posted November 13, 2018 (edited) The same, still not visible. <?php if (!defined('_PS_VERSION_')) { exit; } class apialigato extends Module { public function __construct() { $this->name = 'apialigato'; $this->tab = 'others'; $this->version = '1.0.0'; $this->author = 'Marcin Zelek'; $this->need_instance = 0; $this->ps_versions_compliancy = [ 'min' => '1.6', 'max' => _PS_VERSION_ ]; $this->bootstrap = true; parent::__construct(); $this->displayName = $this->l('Api Aligato'); $this->description = $this->l('A SOAP Api.'); $this->confirmUninstall = $this->l('Are you sure you want to uninstall?'); if (!Configuration::get('api_aligato_name')) { $this->warning = $this->l('No name provided'); } } public function install() { if (Shop::isFeatureActive()) { Shop::setContext(Shop::CONTEXT_ALL); } if (!parent::install() || !$this->registerHook('leftColumn') || !$this->registerHook('header') || !Configuration::updateValue('api_aligato_name', 'my friend') ) { return false; } return true; } public function uninstall() { if (!parent::uninstall() || !Configuration::deleteByName('api_aligato_name') ) { return false; } return true; } } ?> Edited November 14, 2018 by z3l Adding new info (see edit history) Link to comment Share on other sites More sharing options...
z3l Posted November 14, 2018 Author Share Posted November 14, 2018 Module is visible now, I had to use this information on stackoverflow, https://stackoverflow.com/questions/42851868/prestashop-1-7-unable-to-display-custom-module - I had to edit \src\PrestaShopBundle\Controller\Admin\ModuleController.php file. However, I still have a strange happening, even with developers mode enabled, this code works: <?php if (!defined('_PS_VERSION_')) { exit; } class apialigato extends Module { public $soapClient; public function __construct() { $this->name = 'apialigato'; $this->tab = 'others'; $this->version = '1.0.0'; $this->author = 'Marcin Zelek'; $this->need_instance = 0; $this->ps_versions_compliancy = [ 'min' => '1.6', 'max' => _PS_VERSION_ ]; $this->bootstrap = true; parent::__construct(); $this->displayName = $this->l('Api Aligato'); $this->description = $this->l('A SOAP Api.'); $this->confirmUninstall = $this->l('Are you sure you want to uninstall?'); if (!Configuration::get('api_aligato_name')) { $this->warning = $this->l('No name provided'); } // Apialigato soap $this->soapClient = 5; } public function install() { if (Shop::isFeatureActive()) { Shop::setContext(Shop::CONTEXT_ALL); } if (!parent::install() || !$this->registerHook('leftColumn') || !$this->registerHook('header') || !Configuration::updateValue('api_aligato_name', 'my friend') ) { return false; } return true; } public function uninstall() { if (!parent::uninstall() || !Configuration::deleteByName('api_aligato_name') ) { return false; } return true; } } $inst = Module::getInstanceByName('apialigato'); var_dump($inst->soapClient); exit; ?> It dumps me 5, however this code does not work. Why ? <?php if (!defined('_PS_VERSION_')) { exit; } class apialigato extends Module { public $soapClient; public function __construct() { $this->name = 'apialigato'; $this->tab = 'others'; $this->version = '1.0.0'; $this->author = 'Marcin Zelek'; $this->need_instance = 0; $this->ps_versions_compliancy = [ 'min' => '1.6', 'max' => _PS_VERSION_ ]; $this->bootstrap = true; parent::__construct(); $this->displayName = $this->l('Api Aligato'); $this->description = $this->l('A SOAP Api.'); $this->confirmUninstall = $this->l('Are you sure you want to uninstall?'); if (!Configuration::get('api_aligato_name')) { $this->warning = $this->l('No name provided'); } // Apialigato soap $this->soapClient = new SoapClient('http://api.aligato.pl/server.php?wsdl'); } public function install() { if (Shop::isFeatureActive()) { Shop::setContext(Shop::CONTEXT_ALL); } if (!parent::install() || !$this->registerHook('leftColumn') || !$this->registerHook('header') || !Configuration::updateValue('api_aligato_name', 'my friend') ) { return false; } return true; } public function uninstall() { if (!parent::uninstall() || !Configuration::deleteByName('api_aligato_name') ) { return false; } return true; } } $inst = Module::getInstanceByName('apialigato'); var_dump($inst->soapClient); exit; ?> Link to comment Share on other sites More sharing options...
joseantgv Posted November 14, 2018 Share Posted November 14, 2018 23 hours ago, z3l said: The same, still not visible. <?php if (!defined('_PS_VERSION_')) { exit; } class apialigato extends Module { public function __construct() { $this->name = 'apialigato'; $this->tab = 'others'; $this->version = '1.0.0'; $this->author = 'Marcin Zelek'; $this->need_instance = 0; $this->ps_versions_compliancy = [ 'min' => '1.6', 'max' => _PS_VERSION_ ]; $this->bootstrap = true; parent::__construct(); $this->displayName = $this->l('Api Aligato'); $this->description = $this->l('A SOAP Api.'); $this->confirmUninstall = $this->l('Are you sure you want to uninstall?'); if (!Configuration::get('api_aligato_name')) { $this->warning = $this->l('No name provided'); } } public function install() { if (Shop::isFeatureActive()) { Shop::setContext(Shop::CONTEXT_ALL); } if (!parent::install() || !$this->registerHook('leftColumn') || !$this->registerHook('header') || !Configuration::updateValue('api_aligato_name', 'my friend') ) { return false; } return true; } public function uninstall() { if (!parent::uninstall() || !Configuration::deleteByName('api_aligato_name') ) { return false; } return true; } } ?> This code worked in my installation. Please clear cache and ensure that you don't have any filter enabled. 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