This has been a transition occurring "slowly" over the last couple of versions. The "mark out-of-stock" part occurs when the product is permitted to be out-of-stock as identified by the various configuration->stock settings.
I can remember a time when I was told that it was undesirable for the system to auto-adjust to the maximum available quantity because it allowed competitors to know the quantity in hand or some other potentially unusual reason. However, now the base code auto-adjusts downward to the largest available if the stored in cart total exceeds the allowable or if more than available is attempted to be added to the cart.
With the setting configuration->stock->Allow Checkout set to true, then the quantity will not be auto-adjusted and will be identified as being "out-of-stock". But, that also will mean that users will be able to checkout with quantity on "back order".
If that behavior is not desired (checkout with insufficient quantity on hand), then in includes/classes/shopping_cart.php if you search for STOCK_ALLOW_CHECKOUT and then in any if statement line that contains that text if you prepend it with a false && then there would not be the auto-adjustment and the quantity would exceed the available and the user would need to correct the total in order to checkout.
So and example would be changing:
Code:
if (STOCK_ALLOW_CHECKOUT == 'false' &&($new_qty > $chk_current_qty)) {
To:
Code:
if (false && STOCK_ALLOW_CHECKOUT == 'false' && ($new_qty > $chk_current_qty)) {
There are other occurrences of STOCK_ALLOW_CHECKOUT within the file, but a similar modification could be made for each of those to prevent the addition from affecting the quantity that had been stored in the cart or is added to the cart from the store.
Bookmarks