Events - the way how OpenCart files should be modified
Posted: Thu Mar 17, 2022 12:54 am
What are Events?
Events are introduced with OpenCart 2.x, enhanced with OpenCart 3.x.
And will (and should) be the only method for file manipulation when OpenCart 4.x will be published.
Please read here about Events: https://github.com/opencart/opencart/wiki/Events-System
And the announcement about disabling OCMod: https://github.com/opencart/opencart/wi ... ion-System
(valid as well for VQMod).
This topic should give answers to questions about Events.
Ask whatever you want, wether you are a developer or a "normal" user.
Or you are looking for a solution - post it.
Or have a solution - then help others, maybe they are searching for an snwer.
And we here try to answer as good as possible.
Below are a few links to already existing discussions/questions and sometimes also solutions.
Sending Email Confirmation to Customer Created in Admin
viewtopic.php?f=202&t=227654#p839058
OC 3.0.x Events System: How to modify twig template file?
viewtopic.php?f=144&t=221533
OpenCart Events
viewtopic.php?f=144&t=221534
How can I get in header.twig (Opencart 3.0.3.6) the product's images urls in order to add rel="preload" ?
viewtopic.php?f=202&t=227618&start=40#p839519
As a "starter package" I have created here 2 installable packages (OpenCart 2.x & 3.x) at GitHub:
https://github.com/osworx/opencart-event-boilerplate
The files include many comments, are ready for php 8.1.x and can be installed as standard extension.
They are accessable as Module (via the default Menu), have a settings page to en-/disable the module (and therefore also the event).
The event is installed automatically at module installation (and also deleted at uninstall).
Esay to adopt for own modules based on Events.
More samples will follow.
Beside this, this topic can be used also to link to the OpenCart Marketplace to extensions using only events.
This, because it was discussed earlier, and the Marketplace has currently no option to select and filter after extensions working only with events.
Example:
Order Copy Free
Robots noindex PRO
Events are introduced with OpenCart 2.x, enhanced with OpenCart 3.x.
And will (and should) be the only method for file manipulation when OpenCart 4.x will be published.
Please read here about Events: https://github.com/opencart/opencart/wiki/Events-System
And the announcement about disabling OCMod: https://github.com/opencart/opencart/wi ... ion-System
(valid as well for VQMod).
This topic should give answers to questions about Events.
Ask whatever you want, wether you are a developer or a "normal" user.
Or you are looking for a solution - post it.
Or have a solution - then help others, maybe they are searching for an snwer.
And we here try to answer as good as possible.
Below are a few links to already existing discussions/questions and sometimes also solutions.
Sending Email Confirmation to Customer Created in Admin
viewtopic.php?f=202&t=227654#p839058
OC 3.0.x Events System: How to modify twig template file?
viewtopic.php?f=144&t=221533
OpenCart Events
viewtopic.php?f=144&t=221534
How can I get in header.twig (Opencart 3.0.3.6) the product's images urls in order to add rel="preload" ?
viewtopic.php?f=202&t=227618&start=40#p839519
As a "starter package" I have created here 2 installable packages (OpenCart 2.x & 3.x) at GitHub:
https://github.com/osworx/opencart-event-boilerplate
The files include many comments, are ready for php 8.1.x and can be installed as standard extension.
They are accessable as Module (via the default Menu), have a settings page to en-/disable the module (and therefore also the event).
The event is installed automatically at module installation (and also deleted at uninstall).
Esay to adopt for own modules based on Events.
More samples will follow.
Beside this, this topic can be used also to link to the OpenCart Marketplace to extensions using only events.
This, because it was discussed earlier, and the Marketplace has currently no option to select and filter after extensions working only with events.
Example:
Order Copy Free
Robots noindex PRO