Quant Posted September 11, 2020 Share Posted September 11, 2020 Inventory management is enabled in my store and it is not allowed to order with zero stock. One page checkout enabled. PS_STOCK_MANAGEMENT = 1 PS_ORDER_OUT_OF_STOCK = 0 PS_ORDER_PROCESS_TYPE = 1 TB_VERSION = 1.1.0-1.1.x Bleeding edge THEME - Niara -------- The following happens: Product A has 10 units remaining. Customer1 puts all 10 units in the cart yesterday and stops. Today Customer2 comes in and buys Product A in the amount of 4 units. After that, today Customer1 continues ordering, enters the Cart and sees that 10 units are available. The real balance of Product A is already 6 units. Until he saves the account, he does not see a warning about the lack of quantity of Item A. Ok, he saved the account and sees a warning: An item (Product A) in your cart is no longer available in this quantity. You cannot proceed with your order until the quantity is adjusted. Ok, but he doesn't understand how much he needs to change the quantity. In the Shopping Cart, he clicks the Downgrade button and sees the message: There aren't enough products in stock. He doesn't know what to do. It is better to fix this behavior of the Shopping Cart. P.S. For myself, as a temporary solution, I fixed the processChangeProductInCart method in the Cart class. If the real balances of the goods are already less, to check ($ qtyToCheck) set the real quantity. We decrease the quantity ($ this-> qty) by the difference between the quantity in the basket and the real quantity, or if the actual quantity is less than or equal to 0, then we will remove the item from the cart. if (Tools::getValue('op', 'up') == 'down') { //$qtyToCheck -= $this->qty; if ($cartProduct['stock_quantity'] < $cartProduct['cart_quantity']) { $this->qty = ($cartProduct['stock_quantity'] > 0) ? $cartProduct['cart_quantity'] - $cartProduct['stock_quantity'] : -1; $qtyToCheck = $cartProduct['stock_quantity']; $this->ajax_refresh = true; } else { $qtyToCheck -= $this->qty; } } else { $qtyToCheck += $this->qty; } 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