Pergunta

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?

Foi útil?

Solução 2

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; ?>

Outras dicas

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

Licenciado em: CC-BY-SA com atribuição
Não afiliado a magento.stackexchange
scroll top