Post by D3MO » Wed Jun 19, 2024 7:04 pm

Started remaking ocmod modules to event based . and there is so many not clear things:)) for example event trigger it is working all ok

Code: Select all

$this->model_setting_event->addEvent(['code'=>'module_user_group_price', 'description' => '', 'trigger' => 'catalog/model/catalog/product/getProduct/after', 'action' => 'extension/user_groups_pricing_rules/module/user_group_price.SetPrice', 'status'=>1, 'sort_order'=>1]);

and opencart 4.0.2.3 has new folder EXTENSION in root folder and some stock modules preinstalled, so trying to add trigger to a module function : extension/opencart/total/sub_total/getTotal/after and it doesnt ttrigger. also events is a pain to modify returned data from library classes like tax.

Code: Select all

$this->model_setting_event->addEvent(['code'=>'module_user_group_price', 'description' => '', 'trigger' => 'extension/opencart/total/sub_total/getTotal/after', 'action' => 'extension/user_groups_pricing_rules/module/user_group_price.SetSubtotal', 'status'=>1, 'sort_order'=>1]);
maybe someone could share a light here why "'catalog/model/catalog/product/getProduct/after" do work. and "extension/opencart/total/sub_total/getTotal/after' do not works

Opencart Expert | voldemaras@gmail.com

Extensions for Opencart @ https://www.opencartextensions.eu / or Opencart Marketplace

Need Custom Module? debug third party module or simply have any question related to Opencart? feel free to contact directly for a live chat session:) - INSTANT LIVE CHAT


User avatar
Active Member

Posts

Joined
Mon Apr 04, 2011 6:57 am

Post by D3MO » Wed Jun 19, 2024 7:16 pm

found myself. you need to trigger as it would be like in old structure

catalog/model/extension/opencart/total/sub_total/getTotal/after

Now need to find out how to override library class variables.

Opencart Expert | voldemaras@gmail.com

Extensions for Opencart @ https://www.opencartextensions.eu / or Opencart Marketplace

Need Custom Module? debug third party module or simply have any question related to Opencart? feel free to contact directly for a live chat session:) - INSTANT LIVE CHAT


User avatar
Active Member

Posts

Joined
Mon Apr 04, 2011 6:57 am

Post by paulfeakins » Wed Jun 19, 2024 10:28 pm

D3MO wrote:
Wed Jun 19, 2024 7:16 pm
found myself. you need to trigger as it would be like in old structure

catalog/model/extension/opencart/total/sub_total/getTotal/after

Now need to find out how to override library class variables.
What do you think of developing with Events so far vs. OCMOD?

UK OpenCart Hosting | OpenCart Audits | OpenCart Support - please email info@antropy.co.uk


User avatar
Legendary Member
Online

Posts

Joined
Mon Aug 22, 2011 11:01 pm
Location - London Gatwick, United Kingdom

Post by D3MO » Thu Jun 20, 2024 2:30 pm

paulfeakins wrote:
Wed Jun 19, 2024 10:28 pm
D3MO wrote:
Wed Jun 19, 2024 7:16 pm
found myself. you need to trigger as it would be like in old structure

catalog/model/extension/opencart/total/sub_total/getTotal/after

Now need to find out how to override library class variables.
What do you think of developing with Events so far vs. OCMOD?
Well since we used ocmod for decade:))of course we are used to it:) but time do not stand in one place , and everything evolves. With events some features are easier to make than with modules and hooking system is perfect if you want perform some actions before or after some functions, instead of changing the code itself . But ocmod were usefull also if you require to alter very litle code instead of making an event. in my opinion ocmod should be integrated in opencart and user itself could decide to use ocmod module or no. there could be in marketplace selection what type of module event based or xml changes based. because the very same way and events can overlap with each other the very same like ocmods. but there is as is

Opencart Expert | voldemaras@gmail.com

Extensions for Opencart @ https://www.opencartextensions.eu / or Opencart Marketplace

Need Custom Module? debug third party module or simply have any question related to Opencart? feel free to contact directly for a live chat session:) - INSTANT LIVE CHAT


User avatar
Active Member

Posts

Joined
Mon Apr 04, 2011 6:57 am
Who is online

Users browsing this forum: Google [Bot] and 2 guests