Post by JNeuhoff » Thu Oct 25, 2018 1:24 am

The view/*/before event handlers have been changed between OC 3.0.2.0 and OC 3.1.0.0
In OpenCart 3.0.2.0 the system/loader.php has this:

Code: Select all

		// Template contents. Not the output!
		$template = '';
		
		// Trigger the pre events
		$result = $this->registry->get('event')->trigger('view/' . $trigger . '/before', array(&$route, &$data, &$template));
In OpenCart 3.1.0.0B it now does this:

Code: Select all

		$template = new Template($this->registry->get('config')->get('template_engine'));

		// Trigger the pre events
		$result = $this->registry->get('event')->trigger('view/' . $trigger . '/before', array(&$route, &$data, &$template));
The OpenCart 3.x series was supposed to be using a stable framework, but it keeps changing!
Why is it so hard to implement a proper view/*/before event? Please let us continue using a String $template argument which can take a modified template buffer from pre events, as in OC 3.0.2.0!

Export/Import Tool * SpamBot Buster * Unused Images Manager * Instant Option Price Calculator * Number Option * Google Tag Manager * Survey Plus * OpenTwig


User avatar
Guru Member

Posts

Joined
Wed Dec 05, 2007 3:38 am


Post by Johnathan » Thu Oct 25, 2018 4:07 am

This is exactly why I don't use "events" in any of my extension. The syntax has never been consistent, and it doesn't work in all OpenCart versions, so it's kind of useless if you're trying to create an extension that's compatible with more than a single OpenCart version.

Image Image Image Image Image


User avatar
Administrator

Posts

Joined
Fri Dec 18, 2009 3:08 am


Post by thekrotek » Thu Nov 01, 2018 3:47 pm

Johnathan wrote:
Thu Oct 25, 2018 4:07 am
This is exactly why I don't use "events" in any of my extension. The syntax has never been consistent, and it doesn't work in all OpenCart versions, so it's kind of useless if you're trying to create an extension that's compatible with more than a single OpenCart version.
Events in OpenCart is a joke in general comparing to Joomla events or WordPress hooks. Never use it myself as well, don't see any point, especially considering the VQMod/OCMod option.

I'm not against any changes. What bothers me most is lack of any backward compatibility. Never ever this simple part was seriously considered and implemented. The backward compatibility in 2.3 was half-baked and then immediately stripped.

Professional OpenCart extensions, support and custom work.
Contact me via email or Skype by support@thekrotek.com


User avatar
Expert Member

Posts

Joined
Sun Jul 03, 2016 12:24 am

Who is online

Users browsing this forum: bizco and 172 guests