mrsparrow Posted March 20, 2019 Share Posted March 20, 2019 (edited) I am trying to create a custom payment module for prestashop 1.7 Everything goes well I get a reply from them once the transaction is checked and successful. it then redirects from payment controller to validation controller as intended to create the order from cart. $cart = $this->context->cart; $customer = new Customer($cart->id_customer); if (!Validate::isLoadedObject($customer)) { Tools::redirect('index.php?controller=order&step=1'); } $currency = $this->context->currency; $total = (float)$cart->getOrderTotal(true, Cart::BOTH); $this->module->validateOrder((int)$cart->id, Configuration::get('PS_OS_PAYMENT'), $total, $this->module->displayName, null, array(), (int)$currency->id, false, $customer->secure_key); Tools::redirect('index.php?controller=order-confirmation&id_cart='.(int)$cart->id.'&id_module='.(int)$this->module->id.'&id_order='.$this->module->currentOrder.'&key='.$customer->secure_key); This causes an error for some reason, but the cart is converted to an order. Without this line the cart isn't converted so I have no clue why it complains like it's already done. This is the error I get : Cart cannot be loaded or an order has already been placed using this cart Any tips if I am missing something? UPDATE: after a bit of digging I figured out that Validate::isLoadedObject($this->context->cart) in PaymentsModule.php is returning false. I checked and cart_id has a value. Edited March 20, 2019 by mrsparrow add more info (see edit history) Link to comment Share on other sites More sharing options...
mrsparrow Posted March 20, 2019 Author Share Posted March 20, 2019 (edited) Ok so the validateOrder function seems to be called twice and the second time it seems to have a cart id of 0. No idea where the second call is coming from though, If I remove the call in validation controller then it's not called at all. validate Edited March 20, 2019 by mrsparrow (see edit history) Link to comment Share on other sites More sharing options...
Innla Posted February 16 Share Posted February 16 Hi! Did you finally been able to solve this? I have the same issue, validateOrder method is been called twice and that is causing me other problems. Thanks in advance! 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