0
Admin: Catalog > Manage products
  Choose a product: inventory 
  - Qty = 0
  - Qty for Item's Status to Become Out of Stock = 0
  - Stock availability: in stock

A similar setting in the config:

Admin: System > Configuration
  Inventory: Qty for Item's Status to Become Out of Stock = 0

So a given product has no items in stock, and when there are no items in stock, it should display as "Out of stock" on the frontend. For some reason this doesn't happen and the item stays "in stock".

How can I fix this?

  • 1
    Did you check product stock settings on website and store levels? It is quite common mistake to change qty on website/store level, switch to default settings level, forget and don't understand what's going on. – Dmytro Zavalkin Sep 9 '13 at 19:39
  • Useful comment, but I did this already. In cases like this I work at the lowest level. If I got it working, I move up to make it general. – SPRBRN Sep 10 '13 at 7:41
  • The following file displays in or out of stock: app/design/frontend/default/skin123/template/catalog/product/view/type/default.phtml with the following code: <?php $_product = $this->getProduct(); var_dump($_product['is_in_stock']); if ($_product->isAvailable()): ?>. I suppose $_product['is_in_stock'] and $_product->isAvailable() are the same. Both have value 1. – SPRBRN Sep 11 '13 at 14:32
2

Please check BE > System > Configuration > Inventory > Display out of stock products and set it to 'yes'. Afterwards please refresh your indexes

  • Thanks for the quick reply. This was set to "yes" already. I did refresh all indexes anyway, flushed the cache another time, but no change... – SPRBRN Sep 9 '13 at 15:09
1

I found the following code in another template, and this works as it should. I'm not 100% sure if this is custom code or if it can be used in any template.

<?php if($_product->isSaleable()): ?>
    <?php if((int) Mage::getModel('cataloginventory/stock_item')->loadByProduct($_product)->getQty() < 1): ?>
        <p class="availability"><?php echo $this->__('Availability: not in stock.') ?></p>
<?php else: ?>
    <p class="availability"><?php echo $this->__('Availability: in stock') ?></p>
<?php endif; ?>
<?php else: ?>
    <p class="availability"><?php echo $this->__('Availability: not in stock.') ?></p>
<?php endif; ?>

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.