문제

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?

도움이 되었습니까?

해결책 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; ?>

다른 팁

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

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 magento.stackexchange
scroll top