3
$product1 = Mage::helper('catalog/product')->getProduct(42, $storeId);

不能使用,因为它需要我提供产品 ID。类别方法也需要类别 ID。

有什么建议么?

4

2 回答 2

6
$collection = Mage::getResourceModel('reports/product_collection');
$collection->addStoreFilter();
$total_products_in_store = $collection->getSize();
于 2012-07-14T10:31:57.330 回答
2
$storeId = 2;

/** @var $collection Mage_Catalog_Model_Resource_Product_Collection */
$collection = Mage::getResourceModel('catalog/product_collection');
$collection->addStoreFilter($storeId);

// Retrieve product count in collection
$size = $collection->count(); // or $collection->getSize()
于 2012-07-14T10:33:34.687 回答