Jumprit's Knowledge

Jumprit's knowledge and references to share.

How To Display Available Quantity in Magento Front End (Product Page) —

To display quantity of products available in product page,

Open /app/design/frontend/default/YOURTHEME/template/catalog/product/view.phtml

Then paste this code anywhere you want the stock quantity to display:

<?php if($_product->isAvailable()):?><pclass="availability in-stock"><?php echo $this->__('Qty Available:')?><span><!--<?php echo $this->__('In stock') ?>--><?=(int)Mage::getModel('cataloginventory/stock_item')->loadByProduct($_product)->getQty()?></span></p><?php else:?><pclass="availability out-of-stock"><?php echo $this->__('Availability:')?><span><?php echo $this->__('Out of stock')?></span></p><?php endif;?>

Categorised as: Magento



Leave a Reply