Product Collections: Get ALL products even though “Show products that are out of stock” set to NO?
-
16-10-2019 - |
Question
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_ids, false)
->addAttributeToFilter('status', Mage_Catalog_Model_Product_Status::STATUS_ENABLED);
$selections->load();
but because "Show products that are out of stock" ist set to NO it automatically wipes all products that are not in stock.
Is there a way to bypass the "show_out_of_stock" check? Thanks for any assistance!
Solution
Very weird. Can't really tell why, but removing
->addFinalPrice()
fixed the issue. Obviously addFinalPrice() removes all products that aren't saleable/in stock.
OTHER TIPS
With Magento 1.8, comment addMinimalPrice and addFinalPrice in *Mage_Catalog_Model_Layer::prepareProductCollection()* to show out of stock products with Show products that are out of stock set to NO.