Magento Show Available Quantities on front end 2 comments


Magento has the ability to globally manage inventory levels for your online store. A number of client’s business model was to sell inventory that they picked up from a distributor and therefore didn’t need to manage all items. They did have situations where they purchased items by the case and wanted to to show how many items are left back in stock.

To set and show how many items are left in stock, do the following:

Open app/design/frontend//default/template/catalog/product/view.html

Add the following code to the page where you want to render the available stock message.

<div class="divider"></div>
<div class="inventory-qty">
    <!--inv-qty-->
    <?php
    $__manStock = $_product->getStockItem()->getManageStock();
    $__invAmt = (int) Mage::getModel('cataloginventory/stock_item')->loadByProduct($_product)->getQty();
    if ($__manStock > 0) {
        echo $this->__("Only $__invAmt Available in Stock");
    }
    ?>
</div>
<div class="divider"></div>

Make sure to set Magento to not manage inventory. On the individual product under the “Inventory” tab using the “Manage Stock” option, un-check “Use Config Settings” and set it to “Yes”. Remember to set the QTY to the amount you have in stock. Make sure to add to your CSS File the styling you want to for the inventory-qty class.

Thanks to : http://www.studio1909.com/2009/10/18/magento-show-quantities/

Share on Facebook




About Pragnesh Karia

Pragnesh Karia, Open Source Enthusiast, Software Professional, Software Developer, Technical Lead ,Magento, Joomla ,Joomla LMS , Moodel LMS ,PHP ,Mysql, Ajax, Javascript, Jquery, Linux, Fan of Open Sources , Annet Technologies , SEO Analyst , Mootools


2 thoughts on “Magento Show Available Quantities on front end