Monday 15 March 2010

magento - How do I show decimal inventory amount on the frontend? -



magento - How do I show decimal inventory amount on the frontend? -

i'm coding website fabric shop sells yard. sell in decimal quanities have figured out how enable. in front end end (list , view) doesn't show decimal amount on end. instance, if there 24.75 yds in stock, displays there 24 yds in stock.

what need prepare that? thanks!

<?php $qty = (int)mage::getmodel('cataloginventory/stock_item')->loadbyproduct($_product)->getqty(); echo $qty; ?>

can remove (int) casting , seek that?

<?php $qty = mage::getmodel('cataloginventory/stock_item')->loadbyproduct($_product)->getqty(); echo number_format((float) $qty, 2, '.', ''); ?>

magento magento-1.8

No comments:

Post a Comment