Post by xdicolt » Thu Dec 07, 2023 8:04 pm

Hey, everybody.
I have a question for the experts.
The situation is as follows: when I make a theme, I connect an event:

Code: Select all

$this->event->register('view/*/before', new \Opencart\System\Engine\Action('act'));
This event works great for the theme.

But I also need to develop a module that uses the event

Code: Select all

'trigger' => "catalog/view/common/header/after"
The event is added via addEvent.

Of course the event for the module doesn't work because the theme has changed.
How can I use the event and 'str_replace' for the module to make it work?
Thanks a lot



Sun Nov 19, 2023 5:00 pm

Post by JNeuhoff » Thu Dec 07, 2023 11:06 pm

You normally add an event like this in your module's install function:

Code: Select all

			$data = [
				'code'        => $code,
				'description' => '',
				'trigger'     => $trigger,
				'action'      => $action,
				'status'      => true,
				'sort_order'  => 0
And see this post on how the modify a template via an event handler.

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

User avatar
Guru Member


Wed Dec 05, 2007 3:38 am

Who is online

Users browsing this forum: No registered users and 3 guests