Product Collections: Get ALL products even though “Show products that are out of stock” set to NO?

magento.stackexchange https://magento.stackexchange.com/questions/6336

문제

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!

도움이 되었습니까?

해결책

Very weird. Can't really tell why, but removing ->addFinalPrice() fixed the issue. Obviously addFinalPrice() removes all products that aren't saleable/in stock.

다른 팁

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 magento.stackexchange
scroll top