Magento product model(Object) does not pull the product stock, Quantity and other information
related to product stock. We need to pull this information using cataloginventory model.
Get product quantity and stock by Product ID
$_product = Mage::getModel('catalog/product')->load($products_id); $stockInfo = (int)Mage::getModel('cataloginventory/stock_item') ->loadByProduct($_product); echo '<pre>'; print_r($stockInfo->getData()); echo '</pre>'; // For Quantity echo $stockInfo->getQty();
Similar you can find all product stock information like.. // For Minimum Sale Quantity echo $stockInfo->getMinSaleQty(); // For Maximum Sale Quantity echo $stockInfo->getMaxSaleQty(); // For Maximum Sale Quantity echo $stockInfo->getIsInStock();
//Get product quantity and stock data by product Object
$stockItem = Mage::getModel('cataloginventory/stock_item')->loadByProduct($product); $product is a product object echo '<pre>'; print_r($stockItem->getData()); echo '</pre>';