我怎么能得到一个 catalog/product 包含所有属性的集合,这些属性被选为“产品清单中使用”,即在平桌上?

有帮助吗?

解决方案

$collection
    ->addAttributeToSelect(
          Mage::getSingleton('catalog/config')->getProductAttributes()
    );

例如,这是在 Mage_Catalog_Model_Layer::prepareProductCollection.

其他提示

好像

Mage::getSingleton('catalog/config')->getProductAttributes()

不包括所有平坦属性。仍然缺少一些属性。使用Flat Reindexer模型,以获取扁平表中的属性:

Mage::getModel('catalog/resource_product_flat_indexer')->getAttributeCodes();
许可以下: CC-BY-SA归因
scroll top