Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Page 2 of 2
How do I list ‘Out of Stock’ products
 
Honey45
Jr. Member
 
Total Posts:  3
Joined:  2013-09-11
 
rleising - 01 August 2012 11:37 AM

I know this is a couple months old, and not sure if this is what you’re looking for, but it works pretty well for me, and is simpler than other solutions.

$_oosCollection Mage::getResourceModel('catalog/product_collection')->addFieldToFilter('attribute_set_id'4)->addFieldToFilter('type_id''simple')->addFieldToFilter('status'1)->addAttributeToSelect('*');
foreach(
$_oosCollection as $oos){
    $isinstock 
$oos->getStockItem()->getData();
    if(
$isinstock['is_in_stock'== 0){
        
// action to take on out of stock products, i.e. echo name
    
}
}

That model will return everything, so I’m filtering out anything not a simple product, and any disabled products, as well as by attribute set.

The first line in the foreach will get an array that contains the is_in_stock property. Then you just check that and you have your out of stock products. 0 is out of stock, 1 is in stock.

I’ll tell you soon, after confirmation from, one of my friend..Will get you soon.

gloria hotel dubai booking | http://sylvanianfamilies.org

 
Magento Community Magento Community
Magento Community
Magento Community
 
vjtemplates
Guru
 
Avatar
Total Posts:  408
Joined:  2010-12-15
Washington, USA
 

Our Product Badges extension will automatically list and label all Out-of-Stock products.

By giving the labels, your buyers can easily see which products are Out-of-Stock and which products are In-Stock.

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top
Page 2 of 2