Magento 1 Get Visible Products

This is how you get products that are in stock and at the same time are visible on frontend.

$collection = Mage::getModel( 'catalog/product' )->getCollection()
                  ->addAttributeToSelect( 'stock_location', 'is_in_stock' ) // Only products that are in stock
                  ->addFieldToFilter( 'visibility', Mage_Catalog_Model_Product_Visibility::VISIBILITY_BOTH );

 


Lukas
Lukas Stranovsky
I am the guy who made this. Sorry for typos.