2011-07-13 108 views
4

任何人都可以请告诉我在外行下面的代码是什么意思。Magento了解产品收集

$collection = Mage::getResourceModel('catalog/product_collection') 
      ->addAttributeToSelect('name') 
      ->addAttributeToSelect('sku') 
      ->addAttributeToSelect('price') 
      ->addAttributeToSelect('status') 
      ->addAttributeToSelect('short_description') 
      ->addAttributeToSelect('small_image') 
      ->setStoreId($this->getStoreId()) 
      ->addMinimalPrice() 
      ->addFinalPrice() 
      ->addTaxPercents() 
      ->addStoreFilter() 
      ->addAttributeToFilter('is_facebook', 1) 
      ->setVisibility(Mage::getSingleton('catalog/product_visibility')->getVisibleInCatalogIds()); 
     $collection->load(); 
+0

顶部还有一件事。 – Law

+0

$ collection = Mage :: getResourceModel('catalog/product_collection') – Law

回答

3

在当前商店的产品目录中显示所有产品的'facewhatever'属性设置为1。检索到的字段是自我解释的,大概是您Facewhatever商店视图所需的字段。

这个信息被检索为一个对象的集合,我假设你的代码的其余部分迭代发布到Facewhatever。