AbanteCart Development > Extensions and Add-Ons

Best place to hook for a completed order?

(1/1)

dhigz:
Hi,

What is the best controller and method to hook to in order to capture a successfully completed order with payment made. Is ControllerPagesCheckoutSuccess the best controller? Or do you recommend another controller/method?

I do see the value for $this->session->data['processed_order_id'] is created after validation. Are there any other indicators of a successful order?

Thanks.

abolabo:
you can write hook directly to model.
Also you can play with func_get_args() there ;-)
See public_html/storefront/model/checkout/order.php:330 for details.


--- Code: ---public function afterModelCheckoutOrder_confirm() {
       /* @var ModelCheckoutOrder * /
      $that = $this->baseObject;

     //YOUR CODE HERE
}

--- End code ---

P.S. btw same trick works with "create" method

dhigz:
Thanks abalabo,

I see the hook for this function as well as others. Not sure why it did not notice them before. I did find some hooks in the core/lib/order.pdf file specifically $this->extensions->hk_ProcessData($this, 'build_order_data', $order_info);.

If I want to add data to the build_order_data function $order_info array, what would be the proper function name to use?

Thanks

dhigz:
abolabo,

I seem to have run into another issue. I created the function afterModelCheckoutOrder_confirm() and I am able to get the order_id value with func_get_args(). But it seems not matter what I do I cannot call a query in the normal manor:  $that->model_catalog.... I even tried loading the model with this instead of that and using this-> for the query and they did not work either. I get the error: Call to a member function queryName() on null.

My assumption is that since I am not actually hooking on a controller, the normal rules do not apply. Any suggestions of how I can get a query to work in this case? 

Navigation

[0] Message Index

Go to full version
Powered by SMFPacks Social Login Mod