Question

i have a little question. When the Stock Status is set to "Only qty left in Stock" then is the Message "In Stock" showing too. But i will hide the Message "In Stock", when the Message "Only qty left in Stock" is showing.

Here a example: 10 articles in stock = Message "In Stock" 2 articles left in stock = Message "Only 2 left in Stock"

Can anyone help me?

Was it helpful?

Solution

Ok, i have solved the problem. Here is my code:

<?php
    $__manStock = $_product->getStockItem()->getManageStock();
    $__invAmt = (int)Mage::getModel('cataloginventory/stock_item')->loadByProduct($_product)->getQty();
    if ($__invAmt > 10)
    {
       echo $this->__("In stock.");
    }
       else {
          echo $this->__("Only $__invAmt left in stock.");
       }
?>
Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top