News:

AbanteCart v1.4.2 is released.

Main Menu

Do you like AbanteCart? Please rate AbanteCart or share your experience with other eCommerce entrepreneurs. Go to Softaculous rating page to add your rating or write a review

Checkout order update hook

Started by renato.aloi, March 30, 2017, 04:58:11 PM

Previous topic - Next topic

renato.aloi

Hi there!

I am developing a payment extension and at the end of payroll process I want to update the order status.

I was calling update function from Checkout order model, but I noticed a strange rule is in place:

$order_query = $this->db->query("SELECT *
                               FROM `" . $this->db->table("orders") . "` o
                               LEFT JOIN " . $this->db->table("languages") . " l ON (o.language_id = l.language_id)
                               WHERE o.order_id = '" . (int)$order_id . "' AND o.order_status_id > '0'");

if ($order_query->num_rows){ ...

Why is that? Why can I only update order statuses greater than '0'?

So I decided to Hook up the function adding the following code to my core extension php:

public function onModelCheckoutOrder_update()
   {
      // ...
   }

But the hook is not triggering! Any ideas?

Thank you!

Best Regards,
Renato

abolabo

until order confirmed it have order_status_id=0 (incomplete order). When you click confirm button on checkout/confirm page you should call confirm method of model_checkout_order object. It will set some order status, for example "processing". Then  when payment transaction is complete you should to update order status to complete, failed etc.

See extensions/default_pp_pro/storefront/controller/responses/extension/default_pp_pro.php as example or try to find usage $this->model_checkout_order->confirm().

Also you can hook to model via
public function beforeModelCheckoutOder_confirm(){

}

"No one is useless in this world who lightens the burdens of another."
― Charles Dickens

renato.aloi

Hi!

My bad! Now I see! I am using default_pp_pro as guideline for my development, but I missed the confirm function call right after ACK==Success!

It is crystal clear for me now! Thank you!

Forum Rules Code of conduct
AbanteCart.com 2010 -