Just to answer some questions or "theories":
1.
mikeinterserv wrote: ↑Sat Mar 12, 2022 2:27 am
So far I can see absolutely NO WAY of converting some OCMods usingEVENTS. If you are so sure I am wrong just show me an example.
Well, I would say, let make us a challenge.
Post an OCMod here you think it will not be possible.
There are a few quite good developers around here, would surprise me it not one can find a solution.
2.
mikeinterserv wrote: ↑Sat Mar 12, 2022 4:09 am
as an example here from OC
https://www.opencart.com/blog?filter_au ... log_id=174
Code: Select all
<?php
class ControllerEventChangeViewCommonHeader extends Controller {
public function before_view(&$route, &$data, &$output){
$route = str_replace('common/header', 'common/my_custom_header', $route);
}
}
Now WHAT HAPPENS when you try to upload your my_custom_header' to the common folder ?
What happens - nothing.
Why?
Because this IS THE WRONG approach!
With OpenCart 3.0.2.x following was introduced (to prevent fullfilling the system with unwanted extensions and code):
Code: Select all
// A list of allowed directories to be written to
$allowed = array(
'admin/controller/extension/',
'admin/language/',
'admin/model/extension/',
'admin/view/image/',
'admin/view/javascript/',
'admin/view/stylesheet/',
'admin/view/template/extension/',
'catalog/controller/extension/',
'catalog/language/',
'catalog/model/extension/',
'catalog/view/javascript/',
'catalog/view/theme/',
'system/config/',
'system/library/',
'image/catalog/'
);
Which means, extensions (and their files) can only be uploaded and used if they are copied into one of these folders!
Taking the above sample, the correct code should be:
Code: Select all
class ControllerEventChangeViewCommonHeader extends Controller {
public function before_view(&$route, &$data, &$output){
$route = str_replace('common/header', 'extension/module/my_custom_header', $route);
}
btw: extensions from Dreamvention are not the best recommendation ..
3.
mikeinterserv wrote: ↑Sat Mar 12, 2022 4:09 am
Also how would anybody know that $route = str_replace('common/header', 'common/my_custom_header', $route); can be used from the DOCUMENTATION.
Well, using
str_replace(..) or any other method like
preg_replace(..) etc. is the difference between "good" developer and someone else.
4.
paulfeakins wrote: ↑Tue Mar 15, 2022 12:31 am
Events really cannot do much and have many problems. Mod systems like vQmod and OCMOD are the best method I have ever seen of applying extensions to code without changing that code, breaking updates, or conflicting. Yes of course those problems sometimes happen, but you can simply disable offending mods to resolve conflicts.
Well, just one opinion.
Nothing else - and not more.
VQMod and OCMod were really helpfully with OC 2.x and 3.x
With OC 4.x they are obsolete (and will not come back .. well I am sure, some so called clever "devs" will create a new extension for them to use it again.
pssst .. to these "devs": it they want to have their extension(s) also listed in the OpenCart Cloud, they should learn how to code ..
The argument
Events really cannot do much and have many problems .. is useless because has no base at all.
Instead, events can much more you can imagine!
To be honest: I have developeed several hundred extensions over the years I am working with OpenCart.
And it was easy to work with VQMod and OCMod.
But once you have discovered what all you can do with events, you will not miss one of these two.
In very rare situations (to stay honest) a solution based on events may need time to find the correct method, but finally it is here and can be done.
5.
straightlight wrote: ↑Tue Mar 15, 2022 1:32 am
.. free extensions on the Marketplace where these solutions have already been provided ..
The main problem there is, that no selection after events only is possible.
And - when looking at many extensions, it's really hard to find extensions made only with events.