Post by guntis.e » Wed Jul 19, 2017 11:12 pm

Trying out the event system for the first time. Something is not working for me. The code below.

I want to trigger the public function test($input) on product edit. Event installs and uninstalls just fine, but the trigger admin/view/template/catalog/product_form/before does not fire the function test

Code: Select all

class ControllerExtensionModuleProductAdditionalInfo extends Controller {
	
	public function install() {
		
		$code = "product_additional_info";
		$trigger = "admin/view/template/catalog/product_form/before";
		$action = "extension/module/product_additional_info/test";
		$this->load->model('extension/event');
 		$this->model_extension_event->addEvent($code, $trigger, $action);
	}
	
	public function uninstall() {
 		$this->load->model('extension/event');
 		$this->model_extension_event->deleteEvent('product_additional_info');
	}
	
	public function index() {
		$this->document->setTitle("product_additional_info");
	}
	
	public function test($input) {
		$this->log->write("writing input");
		$this->log->write($input);
	}
}
What am i missing?

Guntis
Image Partneris.lv - opencart web site development and support


Active Member

Posts

Joined
Fri Jan 28, 2011 4:20 am

Post by guntis.e » Wed Jul 19, 2017 11:26 pm

Just tested with trigger

Code: Select all

$trigger = "admin/controller/catalog/product/edit/before";
and it worked. But i want to have view admin/view/template/catalog/product_form as trigger

Guntis
Image Partneris.lv - opencart web site development and support


Active Member

Posts

Joined
Fri Jan 28, 2011 4:20 am

Post by daveyoi » Thu Jul 20, 2017 12:28 am

I dont think you need "template" in the path so the below should work

Code: Select all

admin/view/catalog/product_form/before

Image
Tristar Web Solutions


New member

Posts

Joined
Sun Oct 05, 2014 2:38 am

Post by guntis.e » Thu Jul 20, 2017 1:47 am

Thanks a lot Dave, this worked!

Guntis
Image Partneris.lv - opencart web site development and support


Active Member

Posts

Joined
Fri Jan 28, 2011 4:20 am
Who is online

Users browsing this forum: FazalFariz and 69 guests