Reputation: 39
i have this error in prestashop 1.7.5, when a user pay (any payment method), the payment is made, but in the order confirmation page, I have a 500 error, the only information that i have is the log with the following message:
Frontcontroller::init - Cart cannot be loaded or an order has already been placed using this cart
Does anyone know how to fix this error? I've been standing on this for a few days to launch my e-commerce,
Thanks in advance!
Upvotes: 3
Views: 6804
Reputation: 2182
In your case "Frontcontroller::init - Cart cannot be loaded or an order has already been placed using this cart" most likely triggered because the condition in PaymentModule::validateOrder is false. It can as well happen in the FrontController.
Anyways it comes from Cart::orderExists method. The reason cart is considered as existing can be unsynchronization of ps_cart and ps_orders tables. Try the following: run in mysql the following queries:
SELECT id_cart FROM ps_cart ORDER by id_cart DESC LIMIT 1;
SELECT id_cart FROM ps_orders ORDER by id_cart DESC LIMIT 1;
To me the first was giving 345 while the second 1891, meaning AUTOINCREMENT value for ps_cart was set less then existing id_cart values in ps_orders. What makes a newly created cart quite a candidate to exist already in ps_orders.
So I simply increased the value of AUTOINCREMENT:
ALTER TABLE ps_cart AUTO_INCREMENT = 2000;
and it fixed the issue to me.
Upvotes: 4
Reputation: 1857
Not a prestashop expert, so take this with a grain of salt. I think you maybe trying to create a new order with an older cart reference.
As in:
Order Id 1 tried to with Cart Id 1 reference : Successfully created order
Order Id 2 tried to create with Cart Id 1 reference : Failed
This is because I think an order must be associated with a unique cart. Take a look at the order schema by using the webservice, you'll notice a single reference to a cart.
Hope this helped.
Upvotes: 0