From what I can gather, it is a way of adding additional methods in the model files, but not the controller files.
There are three scenarios where I can imagine adding an event may be relevant :
- Say I have an extension that requires additional fields in the product table, I would normally use Vqmod to edit the model/catalog/product file that does this and add an additional mysql UPDATE query for the additional fields in both the addProduct and editProduct functions leaving the original queries untouched.
- Sometimes, I want to change the output from a core function either in terms of the actual data returned or the way it is formatted; in this case I would normally (via vqmod) add a similarly named custom version of the function and edit the the calling code accordingly
Code: Select all
//BEFORE $data = $this->model_catalog_product->someFunction(); //AFTER $data = $this->model_catalog_product->myCustomisedFunction();
- In other cases, I might want to create a completely new function within a core script, so I would simply add it to the model file using vqmod as in the above scenario and edit the controller file to add a new variable to hold the new output.
- Where would I place the code to register the events (is it added to the controller file of the script I'm editing, or the install.php file as indicated in the github Modification System wiki)?
- How would I remove the event when the module is uninstalled (is there an uninstall.php file?)
- Once registered, do the Events remain in place, or do they naturally expire when the next page is loaded?