Hi!
I am working on a payment module. It was ready for v 4.0.1.1 and decide to try it on v 4.0.2.1.
Unfortunately looks like the differences between both versions are bigger than I expected and some of mine events not working anymore. For example:
$this->model_setting_event->addEvent([
'code' => 'some_name',
'description' => 'Some description',
'trigger' => 'catalog/controller/checkout/checkout/before',
'action' => 'extension/my_module/payment/my_module_class|method_name',
'status' => 1,
'sort_order' => 1,
]);
The event is set in my install() method. Is this still valid way to add events? If not, where I can find documentation for the new way of setting events?
Regards!
I am working on a payment module. It was ready for v 4.0.1.1 and decide to try it on v 4.0.2.1.
Unfortunately looks like the differences between both versions are bigger than I expected and some of mine events not working anymore. For example:
$this->model_setting_event->addEvent([
'code' => 'some_name',
'description' => 'Some description',
'trigger' => 'catalog/controller/checkout/checkout/before',
'action' => 'extension/my_module/payment/my_module_class|method_name',
'status' => 1,
'sort_order' => 1,
]);
The event is set in my install() method. Is this still valid way to add events? If not, where I can find documentation for the new way of setting events?
Regards!
For a starter, use
'action' => 'extension/my_module/payment/my_module_class.method_name',
instead of
'action' => 'extension/my_module/payment/my_module_class|method_name',
'action' => 'extension/my_module/payment/my_module_class.method_name',
instead of
'action' => 'extension/my_module/payment/my_module_class|method_name',
Export/Import Tool * SpamBot Buster * Unused Images Manager * Instant Option Price Calculator * Number Option * Google Tag Manager * Survey Plus * OpenTwig
Let's continue with another question
Thanks to JNeuhoff, I was able to start using Events again, but now I am trying to use a specific event without success.
I use the following trigger:
catalog/controller/checkout/payment_method|save/after
of course I tried with 'before' also, but can not trigger any of those events.
The idea is to trigger an event when change the Payment method (provider).
Any help here?
Regards!
Thanks to JNeuhoff, I was able to start using Events again, but now I am trying to use a specific event without success.
I use the following trigger:
catalog/controller/checkout/payment_method|save/after
of course I tried with 'before' also, but can not trigger any of those events.
The idea is to trigger an event when change the Payment method (provider).
Any help here?
Regards!
Try with
Code: Select all
catalog/controller/checkout/payment_method.save/after
Upgrade Service | OC 2.3.0.2 PHP 8 | My Custom OC 3.0.3.8 | Buy me a beer
on old oc 4 version was used | , but because of some issues was replaced with .
Upgrade Service | OC 2.3.0.2 PHP 8 | My Custom OC 3.0.3.8 | Buy me a beer
Hi, I developed a "page builder" extension recently on Opencart Version 4.0.2.1 and I find that using events via code to be much easier for development because I don't have to trigger install every time to see whether my events are registered and working as intended.
Not sure if this can be an alternative solution for you but the code goes like this.
In my extension startup file:
extension/extension_name/catalog/controller/startup/file_name.php
namespace Opencart\Catalog\Controller\Extension\ExtensionName\Startup;
class FileName extends \Opencart\System\Engine\Controller {
public function index(): void {
$this->event->register('view/*/before', new \Opencart\System\Engine\Action('extension/extension_name/startup/file_name.func_name'));
}
public function func_name(string &$route, array &$args, mixed &$output){
// event logic goes here
} // end of event
} // end of class
___
Click here.
Demo: https://opencart.bio/
Extension: https://www.opencart.com/index.php?rout ... n_id=45133
With the OpenCart TWK Page Builder, you can transform your e-commerce website into a visually captivating masterpiece without any coding or technical expertise.
Who is online
Users browsing this forum: No registered users and 87 guests