Questions tagged «cataloginventory»

4
如何获取缺货的产品集合-与addInStockFilterToCollection()相反?
我需要在两个列表中显示类别的产品-一个用于库存商品,另一个用于缺货商品。 我在用着 Mage::getSingleton('cataloginventory/stock')->addInStockFilterToCollection() 过滤我的库存商品的产品集合,但是似乎没有等效的方法来过滤缺货的商品-我研究了Mage_CatalogInventory_Model_Stock模型,定义了上述方法。 我已经看到了以下示例,该示例用于检索缺货的产品: $collection->joinField( 'is_in_stock', 'cataloginventory/stock_item', 'is_in_stock', 'product_id=entity_id', '{{table}}.stock_id=1', 'left' ) ->addAttributeToFilter('is_in_stock', array('eq' => 0)); ...但是可以肯定的是,这不仅是实现这一目标的最佳方法,还是最佳方法?
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.