Re: Event system Opencart 4
Nevermind I finally managed to get it working with the after event: public function customExtension(string &$route, array &$data, mixed &$output) { // Load the controller as the $data array will always be empty if the controllers is called through an ajax call $this->load->controller('ch...
Jump to post- Fri Apr 11, 2025 4:51 am
- Replies 8
- Views 1060
Re: Event system Opencart 4
Well, such makes no sense: class CustomExtension extends \Opencart\System\Engine\Controller { public function custom_extension(&$route, &$data) { $json['redirect'] = $this->url->link('checkout/checkout'); } } because you have "only" the $data array to "manipulate" .. Suc...
Jump to post- Fri Apr 11, 2025 1:13 am
- Replies 8
- Views 1060
Re: Event system Opencart 4
I am upgrading one of my extensions to Opencart 4x but I am having trouble getting my code injected using the even system. Use OCMOD. General a bad advice. I know your agruments Paul, but doing such an easy task with a simple event cost a few minutes only. And OCMod is here not required. @Reptile s...
Jump to post- Fri Apr 11, 2025 12:31 am
- Replies 8
- Views 1060
Re: Event system Opencart 4
But when checking the $data in my before or after method it is always an empty array. Is this maybe because the save method returns a JSON response? What do you mean with the $data ? Is it that array handed over from the call? Or what? Would help much if you could post your code here. Yes that is e...
Jump to post- Thu Apr 10, 2025 5:37 pm
- Replies 8
- Views 1060
[SOLVED] Event system Opencart 4 (fetch ajax response and add new value)
I am upgrading one of my extensions to Opencart 4x but I am having trouble getting my code injected using the even system. What I am trying to do is add a few lines of code to the catalog/controller/checkout/register|save method. (Continue button on the checkout page) I have no trouble registering t...
Jump to post- Thu Apr 10, 2025 1:36 pm
- Replies 8
- Views 1060
Re: Favicon
I add this line <link rel="icon" type="image/x-icon" href="/image/favicon.ico"> in header.twig it is work now I just tried to get the favicon working in 4.0.2.1 but I guess they removed the favicon line from the headers.twig or simply forgot to add them. Without any re...
Jump to post- Sun May 14, 2023 2:50 pm
- Replies 21
- Views 11058
Re: Updating extension without losing data?
I tried using the uninstall method but this won’t work. Even if I try to get all settings in the first line of the method I get an empty array. So the module settings are cleared before I can get them. So I added the logic of saving the settings in the Save method instead. And this works fine. Each ...
Jump to post- Thu May 11, 2023 2:53 am
- Replies 17
- Views 6769
Re: Updating extension without losing data?
Hi Reptile, in your case the easiest way would be to write a couple of small functions in your plugin(s), called install() and uninstall(), they must be placed in the (admin) controller of your extension. Opencart calls them automatically when you install/uninstall your extension, you don't have to...
Jump to post- Wed May 10, 2023 12:45 am
- Replies 17
- Views 6769
Re: Updating extension without losing data?
Unfortunately there is no built-in way in OpenCart 4 (that I know of) to upgrade an existing extension without loosing all its data. IMHO the current way OpenCart 4 implements the installation of extensions is poorly implemented. This is just one of many issues which need to be addressed. In genera...
Jump to post- Tue May 09, 2023 5:07 am
- Replies 17
- Views 6769
Re: Updating extension without losing data?
Each versions are different, even by features. Forum rules. Ok 4.0.2.1 then :P Still, at this time, it has been suggested many times by forum supporters that OC v4.x releases not to use it until a stable version gets released. I understand that. But it is good to convert atleast one extension just ...
Jump to post- Mon May 08, 2023 12:26 am
- Replies 17
- Views 6769
Re: Updating extension without losing data?
The OC version still hasn't been posted. By building an API, this can be accomplished. There are lots of extensions on the Marketplace that can accomplish update automations already. I would suggest to take a look. What do you mean by the oc version hasn’t been posted? I’m posting in the Opencart 4...
Jump to post- Mon May 08, 2023 12:04 am
- Replies 17
- Views 6769
Re: Updating extension without losing data?
I don't think you guys understand my question. As from now my extension is installed through the extension installer and show there with a version number let's say version 1.0. Now if I update my extension and make a version 1.1 you can't install this through the extension installer as you get a er...
Jump to post- Sun May 07, 2023 10:54 pm
- Replies 17
- Views 6769
Re: Updating extension without losing data?
I don't think you guys understand my question. As from now my extension is installed through the extension installer and show there with a version number let's say version 1.0. Now if I update my extension and make a version 1.1 you can't install this through the extension installer as you get a err...
Jump to post- Sun May 07, 2023 5:21 pm
- Replies 17
- Views 6769
[SOLVED] Updating extension without losing data?
I just finished my first event driven extension and was wondering how I can update this if I release a new version? Normally with VQMod clients would simply overwrite the files and stored data wouldn’t be affected. But now the extension is installed through the extension installer and the only way t...
Jump to post- Sat May 06, 2023 2:19 pm
- Replies 17
- Views 6769
Re: Trigger path
Yes thanks!
That helped.
The path I used is:
Code: Select all
admin/view/extension/opencart/dashboard/recent_info/after
- Sun Apr 30, 2023 2:23 pm
- Replies 5
- Views 2008
Re: Trigger path
Hi! Just check oc_event table. Also might be helpful https://forum.opencart.com/viewtopic.php?t=227710&start=20#p839606 Thanks for the article. I've already checked the event table but almost all references are to models. But I still can't find an answer to my question. The paths to catalog and...
Jump to post- Sun Apr 30, 2023 12:04 am
- Replies 5
- Views 2008
[SOLVED] Trigger path
I'm almost done with my first event system extension. Only I still don't really understand how some paths works. For example I'm trying to modify something on the main admin dashboard. These files are located in the extension folder. I can't figure out what the trigger path is to: extension/opencart...
Jump to post- Sat Apr 29, 2023 10:54 pm
- Replies 5
- Views 2008
Re: What happened to the invoice styling?
Nevermind. Found the problem. In the order_invoice.twig Simply replace: <link href="{{ bootstrap_css }}" type="text/css" rel="stylesheet" media="screen"/> With: <link href="{{ bootstrap_css }}" type="text/css" rel="stylesheet"/>
Jump to post- Sat Apr 29, 2023 6:39 pm
- Replies 3
- Views 1721
[SOLVED] What happened to the invoice styling?
What happened to the invoice styling?
As from Opencart 4.x the invoice got new styling and it looks ok.
But when you want to print the invoice there is no styling what so ever.
Is this a know problem?
- Fri Apr 28, 2023 9:53 pm
- Replies 3
- Views 1721
Re: Using event to change controller code
You won't see other variables than $data or $json in the event controllers. For that, you need to re-query it. Isn't it possible to use a second event trigger to modify the sale/order controller invoice method to insert the extra variables? Just like I would do with VQMod? I already tried it but I ...
Jump to post- Mon Apr 24, 2023 10:55 pm
- Replies 15
- Views 5086