Jump to content

Checking cart multi-store payments last step


Recommended Posts

Good afternoon:


I'm riding a multi-store version of prestashop where stores share amounts available to sell.


I encountered a big problem with the cart.

If two customers fill their carts with the same product for which there is only one in stock and go to step "How to Pay", without the other client has completed the purchase, both can buy the product and pay!!.


That is, the last step, which is the most sensitive, does not verify that the parts have in stock, check the cart just as if the other client has not reached this step.

Whereupon the seller may be in an undesirable situation of having to contact the client by the lack of stock of a product postpaid ... and if the client is an international ... then imagine the mess to return the money.


How can we fix this and also check in this last step of the cart?




Link to comment
Share on other sites

  • 1 month later...



I fixed this by adding a validation of available quantities to PaymentModule.php


public function validateOrder

$this->context->cart = new Cart($id_cart);
 //START: added code to check avilable quantities
 if (!$this->context->cart->checkQuantities())
  Tools::displayError('An item in your cart is no longer available in this quantity, you cannot proceed with your order.');
   return false;
 $this->context->customer = new Customer($this->context->cart->id_customer);




Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...