【问题标题】:Magento understanding Product CollectionMagento 了解产品系列
【发布时间】:2011-10-04 04:14:00
【问题描述】:

谁能用通俗的话告诉我下面的代码是什么意思。

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

【问题讨论】:

  • 顶部还有一件事。
  • $collection = Mage::getResourceModel('catalog/product_collection')

标签: magento custom-attributes


【解决方案1】:

这会在当前商店的目录中显示所有将“is facewhatever”属性设置为 1 的产品。检索到的字段是不言自明的,可能是您的 Facewhatever 商店视图所需要的。

此信息是作为对象集合检索的,我认为您的其余代码会迭代这些对象以发布到 Facewhatever。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2013-10-26
    • 1970-01-01
    • 2011-03-10
    • 2015-05-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多