fugasok Posted September 18, 2018 Share Posted September 18, 2018 Hello Having problem with a carrier module. When i disable module on module page it is still showing up as enabled in BackOffice->shipping->carriers and in front-office also. What should i add to code to remove this problem? When module is disabled on backoffice modules list page carrier status must be changed to disabled in Shipping -> carriers Link to comment Share on other sites More sharing options...
fugasok Posted September 19, 2018 Author Share Posted September 19, 2018 I figure out what to add in module php file. If somebody will have same problem just insert this part of a code into your carrier module main fail (dont forget to change YOUR_MODULE_NAME public function disable($force_all = false) { $carriers = Carrier::getCarriers($this->context->language->id, true, false, false, null, Carrier::CARRIERS_MODULE); foreach ($carriers as $carrier) { if ($carrier['external_module_name'] == 'YOUR_MODULE_NAME') { $carrierObj = new Carrier($carrier['id_carrier']); $carrierObj->active = '0'; $carrierObj->save(); } } return parent::disable($force_all); } public function enable($force_all = false) { $carriers = Carrier::getCarriers($this->context->language->id, false, false, false, null, Carrier::CARRIERS_MODULE); foreach ($carriers as $carrier) { if ($carrier['external_module_name'] == 'YOUR_MODULE_NAME') { $carrierObj = new Carrier($carrier['id_carrier']); $carrierObj->active = '1'; $carrierObj->save(); } } return parent::enable($force_all); } 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