In this article get which product have less then or equal to 5 quantity. In many cases we want to disable product less then any number of quantity. Then we get product by coding. In this code print product sku.
 Here is code....
<?php
 $collection = Mage::getModel('catalog/product')
  ->getCollection()
  ->addAttributeToSelect('*')
  ->joinField('qty',
     'cataloginventory/stock_item',
     'qty',
     'product_id=entity_id',
     '{{table}}.stock_id=1',
     'left')
  ->addAttributeToFilter('qty', array("lt" => 5));
  
 foreach($collection as $res)
 {
  echo $res->getSku() . "<br>";
 }
?>
Labels: Magento