I have written a shipping extension which works fine but I need opencart event to update the shipping API using curl but it seems not to be working.
I have the following written at admin/controller/extension/module/post_order.php
<?php
class ControllerExtensionModulePostOrder extends Controller
{
public function install()
{
$this->load->model('setting/event');
$this->model_setting_event->addEvent('post_order', 'catalog/model/checkout/order/addOrderHistory/after', 'extension/module/post_order/addOrderHistory');
}
public function uninstall()
{
$this->load->model('setting/event');
$this->model_extension_event->deleteEvent('post_order');
}
}
and I also have catalog/controller/extension/module/post_order.php
<?php
class ControllerExtensionModulePostOrder extends Controller {
public function postOrderData(&$route, &$args, &$output) {
$this->log->write('test');
}
}
the code seems not to be running as I cant see the event listed in the event section of admin not also logging the test.
Thanks
Well first fix your code.
Your event is calling
yet your module method is
You need to call the correct method
For testing events IMO, it's easier to just manually insert the events via your DB and once confirmed working then write the module to install them.
Also use code tags when posting in the future.
Your event is calling
Code: Select all
extension/module/post_order/addOrderHistory
Code: Select all
postOrderData()
Code: Select all
extension/module/post_order/postOrderData
Also use code tags when posting in the future.
Full Stack Web Developer :: Send a PM for Custom Work.
Backup and learn how to recover before you make any changes!
Who is online
Users browsing this forum: No registered users and 237 guests