Page 1 of 1

OC 3.x framework keeps changing! Why?

Posted: Thu Oct 25, 2018 1:24 am
by JNeuhoff
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!

Re: OC 3.x framework keeps changing! Why?

Posted: Thu Oct 25, 2018 4:07 am
by Johnathan
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.

Re: OC 3.x framework keeps changing! Why?

Posted: Thu Nov 01, 2018 3:47 pm
by thekrotek
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.