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

Product Collections regardless is_salable and in_stock? 
 
oliverjn
Jr. Member
 
Total Posts:  29
Joined:  2012-11-28
 

Hey there,

I’d like to list products using Product Collections that list ALL products regardless is_salable or in_stock are false. Is there a way I can disable all is_salable or in_stock checks for

Mage::getResourceModel('catalog/product_collection')
?

Getting the product collection is done using:

$selections Mage::getResourceModel('catalog/product_collection')
                ->
addAttributeToSelect('*')
                ->
addMinimalPrice()
                ->
addFinalPrice()
                ->
addTaxPercents()
                ->
addStoreFilter()
                ->
addIdFilter($selection_idsfalse)
                ->
addAttributeToFilter('status'Mage_Catalog_Model_Product_Status::STATUS_ENABLED);
            
            
$selections->load();

$selection_ids
is an array of product ids some of which are might be out of stock but should be listed.

Thanks for any help or hint towards the right direction!

 
Magento Community Magento Community
Magento Community
Magento Community
 
oliverjn
Jr. Member
 
Total Posts:  29
Joined:  2012-11-28
 

Very weird. Can’t really tell why, but removing

addFinalPrice()
fixed the issue. Obviously
addFinalPrice()
removes all products that aren’t saleable/in stock.
 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top