Posted By

nico65 on 07/01/11


Tagged

magento stock


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

WGenie


magento stock


 / Published in: PHP
 

this snippet works in product list.phtml

  1. <?php if ($_product->isAvailable()): ?>
  2. <p class="availability in-stock"><?php echo $this->__('Availability:') ?> <span><?php echo $this->__('In stock') ?></span></p>
  3. <?php else: ?>
  4. <p class="availability out-of-stock"><?php echo $this->__('Availability:') ?> <span><?php echo $this->__('Out of stock') ?></span></p>
  5. <?php endif; ?>
  6. <div class="clr">&nbsp;</div>
  7. <?php $qtyStock = Mage::getModel('cataloginventory/stock_item')->loadByProduct($_product)->getQty(); ?>
  8. <?php if (( Mage::getModel('cataloginventory/stock_item')->loadByProduct($_product)->getQty()) >(0)): ?>
  9. <p class="availability in-stock"><?php echo $this->__('Availability:') ?> <span><?php echo $this->__('In stock') ?><?php echo $qtyStock; ?></span></p>
  10. <?php else: ?>
  11. <p class="availability out-of-stock"><?php echo $this->__('Availability:') ?> <span><?php echo $this->__('Out of stock') ?></span></p>
  12. <?php endif; ?>
  13. <div class="clr">&nbsp;</div>

Report this snippet  

You need to login to post a comment.