4

I have followed the steps of the very helpful solution on Add to cart for out of stock products

Now I can have products with the "Qty for Item's Status to Become Out of Stock" as “-1” instead of “0” whilst having “Stock Availability” as “In Stock”.

“-1” is my default config setting, but I have other products that have overidden this with a value of “0”.

This all seems great. I have run some successful test purchases and the “Qty” successfully changes to “-2” or “-1” in the Admin Panel as expected.

However, the problem I have is that “Stock Availability” does not change from “In Stock” to “Out of stock” when these “Qty for Item's Status to Become Out of Stock” thresholds are reached, meaning that the items continue to be orderable on the frontend. They should change to Out of stock. Please see screenshots.

screenshot1 screenshot2

I didn’t do step 7 of the referenced solution because I still want Magento to switch products to "Out of stock" on the backend and frontend, but perhaps I am confused here. Perhaps that code will somehow do what I want it to do but to be honest I am not sure how to apply it. I can see the code referred to in the list.phtml and view.phtml files, but an not sure what it is I am pasting. Do I paste all of it over part of the code, or just down to __('Out of stock') ?> What is the significance of the space between __('Out of stock') ?> and __('In Stock')?>

Can anyone help please, sorry for my ignorance!

2

This happen because of you set Backorder=Allow Qty below 0
Change it with Backorder = No Backorder

or for all product

you must set is from admin >> system >> configuration >> catalog >> inventory

In product stock option

Backorders = No backorders

or

Qty for Item's Status to Become Out of Stock = 0

after that save it and refresh page.

| improve this answer | |
0

In the post you reference, it seems that it is actually step 3 that alters the out of stock labeling. Step 7 just changes how they display on the frontend. If you just revert the Qty for Item's Status to Become Out of Stock back to 0 they should display properly as Out-of-stock. (You do not need SQL code for that, just edit the product in the backend or import a csv en masse.)

| improve this answer | |
  • thanks for replying, but unfortunately I do need step 3 etc for the same reasons as sr_magento and Simon describe re. backorders. Otherwise whenever an item falls to '0' it cannot be backordered even if backorders below 0 are allowed (I know the 0 qty item can be manually set to 'in stock' again in admin panel or by csv to make this work, but this should not be necessary). I didn't think step 7 would be necessary for me as the front end looks and functions ok, maintaining 'add to basket' and 'out of stock' buttons as appropriate. – Guido Jul 13 '15 at 20:34
  • The point of me following the rest of that solution is because I don't want the 'Qty for Item's Status to Become Out of Stock' to be always '0' but sometimes want it to be '-1'. I just need to get that working properly. Thanks for any help – Guido Jul 13 '15 at 20:34
  • To confirm. You want the item to be available for purchase but to still be labeled as out-of-stock? I don't see how that can be done without changing the core code. If all you need to do is to change the frontend to out of stock, the 'alternate method' from sr_magento should work. – tzvi Jul 13 '15 at 20:55
  • I don’t want the item to be available for purchase if labelled as out of stock. Thank you very much @tzvi for editing the display of the code in the other post – that makes much more sense! I now see how the author displays the frontend as out of stock. – Guido Jul 15 '15 at 4:35
-1

GO in admin >> system >> configuration >> catalog >> inventory

Qty for Item's Status to Become Out of Stock = 0

after that save it and refresh page.

Clear The Cache.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.