1

I am having an issue with the cartthrob_on_authorize developer hook. I use the hook to carry out some additional processing to the customer order. One such process is to set an order status based on what was ordered. In order to do this, I use the following code:

ee()->order_model->update_order($order_id, $new_status);

Where $new_status = array('status => "Processing");

This is where it gets a little bit confusing. We use Sagepay Server as our offsite payment processor. The code above works perfectly if the customer successfully checks out first time. However, if their first attempt fails (ie they cancel the initial transaction or enter the wrong card details) and then successfully complete the transaction shortly afterwards, the order status defaults to Complete

Has anybody experienced this issue before?

3

I've not seen that before. Odd one! Take a look here at sample code for setting status from that hook. Maybe it will provide some direction.

https://github.com/CartThrob/extension-change_product_status

In theory, sagepay should hit the callback url on payment complete (extload.php) and POST it the payment status flag (Y,C etc) which CT then interprets into the status to set the entry to.

  • 1
    Ah OK so this is much simpler and I feel a bit foolish for not thinking of it myself - it has been a log day!! Essentially this updates the status of the channel entry directly rather than using the CT update_order function. I will give this a go and let you know how it goes. – joedixon Nov 26 '13 at 17:31
  • No worries, i'm glad it worked out for you :) – JohnWBaxter Nov 29 '13 at 20:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.