1

I need to find the stock details of a product how to find that.

1
$product=Mage::getModel('catalog/product')->load('productid');
$stocklevel = (int)Mage::getModel('cataloginventory/stock_item')
                ->loadByProduct($product)->getQty();
  if($stocklevel>0){
        $inStock='1';
    }else{
        $inStock='2';
    }
    $availableQty=$stocklevel;
    $_stock_data = $product->getStockItem()->getData();
    $_qtde_max = (intval($_stock_data['max_sale_qty'])) ? intval($_stock_data['max_sale_qty']) : 10000;
    $_qtde_min=(intval($_stock_data['min_sale_qty'])) ? intval($_stock_data['min_sale_qty']) : 1;
    $maxQty=$_qtde_max;
    $minQty=$_qtde_min;
| improve this answer | |
1
$products=Mage::getModel('catalog/product')->getCollection();
foreach($products as $_product){

$stock = Mage::getModel('cataloginventory/stock_item')->loadByProduct($_product);

echo $stock->getQty();
echo $stock->getMinQty();
echo $stock->getMinSaleQty();

}
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.