我想使用列出所有产品的产品收藏品列出产品,而不论is_salable或in_stock都是错误的。有什么方法可以禁用所有is_salable或in_stock检查 Mage::getResourceModel('catalog/product_collection') ?

使用以下方式获取产品收集:

$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();

但是,因为“显示出库存的产品”设置为“否”,所以它会自动擦除所有未库存的产品。

有没有办法绕过“ show_out_of_stock”检查?感谢您的帮助!

有帮助吗?

解决方案

很奇怪。不能说明为什么,但要删除->addFinalPrice() 修复了问题。显然,AddFinalPrice()删除了所有不可销售/库存的产品。

其他提示

使用Magento 1.8,评论 AddminimalpriceAddFinalPrice 在 * mage_catalog_model_layer :: prepareProductCollection() *以显示出库存产品 展示缺货的产品 设置为否。

许可以下: CC-BY-SA归因
scroll top