Hi there,
I'm trying to create a Facebook register/login extension for our shop, but need some help with the event system.
In the file catalog/controller/account/login.php inside the validate() method there's this line:
$this->event->trigger('pre.customer.login');
and this:
$this->event->trigger('post.customer.login');
What code gets executed when this even triggers?
From the docs this is how to register event:petsoukos wrote:In the file catalog/controller/account/login.php inside the validate() method there's this line:
$this->event->trigger('pre.customer.login');
and this:
$this->event->trigger('post.customer.login');
What code gets executed when this even triggers?
Code: Select all
$this->model_extension_event->addEvent('my_module', 'post.customer.login', 'folder/file/method');
To look all registered event you can look at database table 'event'.
The event table is empty.qahar wrote: From the docs this is how to register event:What code executed is depend on what action is registered for the triggered event.Code: Select all
$this->model_extension_event->addEvent('my_module', 'post.customer.login', 'folder/file/method');
To look all registered event you can look at database table 'event'.
So, the triggers are there for other developers to execute their custom code?
eg. when the post.customer.login triggers, my 'extension' can execute something?
Yes, the events is designed for developer who need to do an action or change specific Event data.petsoukos wrote:The event table is empty.
So, the triggers are there for other developers to execute their custom code?
eg. when the post.customer.login triggers, my 'extension' can execute something?
But to do some action when Event triggered, it's simple and handy feature compared to modification (ocmod/vqmod)
Even thought OpenCart have this event, it's still not covering all modification requirement.
Let say I have extension that offering multi-language url alias. I can use event to grab current alias on save and put language code prefix. Change from my-link to en-my-link or in Indonesian id-my-link then save it to correct database in my Event code.
But to provide completely custom multi-language url alias with user input, Event can't help.
We need to use modification ocmod/ vqmod to create new multi-language url-alias input at product page, than modificate front seo_url.php to ensure the multi language url alias is not just mapped to corect product but also change the site language to the correct language.
Who is online
Users browsing this forum: No registered users and 2 guests