I have searched a lot about opencart triggers but didn't find a proper example. In opencart 2.0 there are triggers on which developer can hook function and perform something just like wordpress action and filters i guess. For example in
catalog/model/checkout/order.php
there is a trigger $this->event->trigger('post.order.history.add', $order_id)
Can someone help me to hook my function on the above trigger?
Important Note: this answer applies to OC >2.0.x.x and <2.2.x.x.
The problem here is a wrong word being used (and searched for) - the right one you should be searching for is event, and from it derived event listener and trigger event (unfortunately, hadn't luck when trying to search for those either and the documentation for 2.0 is still missing).
Now I believe the whole background is much more understandable, especially if you have some knowledge about events from other frameworks (maybe jQuery?) but here is just a quick guide how to work with events (in OC 2.0):
first we need to register an event listener, like this:
$this->event->register('post.order.history.add', 'checkout/order/send_email');
on certain places an event is triggered, e.g.
$this->event->trigger('pre.order.history.add', $order_id);
and
$this->event->trigger('post.order.history.add', $order_id);
if the event (identified by it's name post.order.history.add
) listener was registered it will be invoked on trigger
For more information or to figure it out on your own you may have a look into system/engine/event.php
(there is nothing more to work with right now).