I'm migrating extension for Opencart 2.3 to Opencart 3. Everything seems to work fine, except that I can't enable the extension. When I go to extension->shipping the status doesn't change it stays disabled, however if I go to settings, the drop down shows that enabled is selected. There aren't any errors on the front-end, or in the log files. I tried debugging but everything seems fine. Any ideas what may be wrong? Also the setting in the database(extensionName_status) is 1
Note: the extension is large, and it will be too much if I post it here. If you need specific fragment of code, I will provide it.
Asked
Active
Viewed 1,981 times
2

Vy Do
- 46,709
- 59
- 215
- 313

Deyan Georgiev
- 343
- 3
- 15
-
Have you changed the name of the status flag? If the shipping module is named `foo` the status flag is now `shipping_foo` (whereas it was just `foo` in 2.3). – Scott C Wilson Aug 31 '17 at 19:18
-
1Thank you, this seems to have cause the problem, unfortunately I failed to notice this change. Mind if you give this as an answer, so I can mark it as best answer. – Deyan Georgiev Aug 31 '17 at 19:22
2 Answers
2
The tricky thing about the 2.3->3.0 migration was that some variable names changed in a subtle way (as noted in my comment above). The status variable could be your problem. Here's Better Together 3.0 (left) vs 2.3 (right) in the controller file:
< $data['total_better_together_status'] = $this->config->get('total_better_together_status');
---
> $data['better_together_status'] = $this->config->get('better_together_status');

Scott C Wilson
- 19,102
- 10
- 61
- 83
1
If your OpenCart 3.x module is labeled in the Modules category, then:
if (isset($this->request->post['module_mymodule_status'])) {
$data['module_mymodule_status'] = $this->request->post['module_mymodule_status'];
} else {
$data['module_mymodule_status'] = $this->config->get('module_mymodule_status');
}
Or if it's labeled in the Analytics category, then you just change the module
to analytics
as shown below:
if (isset($this->request->post['analytics_mymodule_status'])) {
$data['analytics_mymodule_status'] = $this->request->post['analytics_mymodule_status'];
} else {
$data['analytics_mymodule_status'] = $this->config->get('analytics_mymodule_status');
}

Carol-Theodor Pelu
- 906
- 2
- 10
- 26