sergifri Posted May 12, 2020 Share Posted May 12, 2020 Good night everyone, I am programming a module that must change an order status just after it's finished, paid or not (bankwire, cash on delivery, paid with credit card etc). For that I am using hookOrderConfirmation. When a customer finishes an order he should see a confirmation page with the payment and order details for each payment method, but instead he always gets the error "We noticed a problem with your order. If you think this is an error, feel free to contact our expert customer support team." <?php public function hookOrderConfirmation($params) { if ($params) { $objOrder = $params['objOrder']; if (Validate::isLoadedObject($objOrder)) { $id_order = (int)$objOrder->id; $order = new Order($id_order); if (!Validate::isLoadedObject($order)) { return; } /// some code here, new status id will be 50 /// $history = new OrderHistory(); $history->id_order = $id_order; $history->id_employee = 44; $history->changeIdOrderState(50, $id_order); $history->add(true); $history->save(); //should I assign some template here? } } } ?> Order status is succesfully changed, and everything seems ok, but the warning alert is allways shown. I understand that the confirmation template for each payment method is not receiving the $status = 'ok' or whatever it needs to properly show the orders resume and confirmation, but I am a bit lost as how to achieve it. Should I add some code after changing the status, somehow calling another template from my module? Is it not the best hook for my needs? I am using Prestashop 1.6. Any help would be welcome, thanks in advance, Regards! Link to comment Share on other sites More sharing options...
yohanes devin Posted February 5, 2021 Share Posted February 5, 2021 Hi Sergifi, I am also getting the same problem with you. Have you resolved this? Link to comment Share on other sites More sharing options...
sergifri Posted February 6, 2021 Author Share Posted February 6, 2021 Hi Yohanes, Unfortunately, I was in a hurry at the time and I decided to set up a cron job that checked the orders already completed and selected the ones I wanted to change and then just update the order status as I needed. I never got to finish the proper method to do it. The problem is that, in the order_confirmation template, the Order confirmation hook is set before the payment return hook. Whe we use the order confirmation hook, we change the order status and then the payment return hook is called, this will validate the order, and this one is waiting for the original order status. And as I remember, depending on the payment method it could be a status or another: Bankwire Cash on delivery It could help to modify the payment modules or to create a new hook from scratch, but as I said, I never got to it Sorry, hope it helps you. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now