Post by opencart.my » Sun Oct 28, 2018 1:09 am

Hello,

Currently, we can use the Event System to extend the functionalities of OpenCart neatly without having to modify any core files or use modifications/vQmod.

It would be very useful if the Event System is implemented in library classes as well, especially for cart.php and other cart related libraries.

The only way right now is to use modifications or vQmod to modify the code of these library core files if we want to perform any cart related customizations, which is less than ideal when you have several 3rd party extensions and modules installed modifying the same files, causing serious code conflicts.

As these files in the library are considered the core of an e-commerce framework, I'd rather them not to be touched.

Thanks!

Developing Quality OpenCart Extensions since 2011. View my Extensions.


User avatar
New member

Posts

Joined
Mon Jan 22, 2018 6:03 pm


Post by JNeuhoff » Sun Oct 28, 2018 2:19 am

I agree, it would be useful to have some more event triggers in at least some of the more important library classes.

It would also be useful to have a fully functioning view/*/before event handlers which would allow both the modification of variables as well as modifications of templates before the final rendering. OpenCart 3.1.x.x uses callback filters, invoked from the template adapter classes, for template modifications, but I think it would have been better to use events for this.

BTW.: In our Override Engine we have a Controller method like this:

Code: Select all

	public function preRender( $template_buffer, $template_name, &$data ) {
		// This newly introduced hook method can be overridden 
		// by extended controller classes.
		// The template buffer or variables can be modified here.
		return $template_buffer;
	}
Controllers can be extended, and this method can be overridden to implement specific template modifications. Something similar should be made possible via event handlers.

MHC Web Design
Override Engine * Integrated VQMod * Multilingual SEO * Instant Option Price Calculator * TrustPilot Reviews * Google Rich Snippets * Google Tag Manager * Export/Import Tool * Template Switcher PHP/Twig


User avatar
Expert Member

Posts

Joined
Wed Dec 05, 2007 3:38 am

Who is online

Users browsing this forum: No registered users and 7 guests