开发者

Magento understanding Product Collection

开发者 https://www.devze.com 2023-03-19 16:44 出处:网络
Can anyone please tell me in layman terms what is meaning of following code below. $collection = Mage::getResourceModel(\'catalog/product_collection\')

Can anyone please tell me in layman terms what is meaning of following code below.

$collection = Mage::getResourceModel('catalog/product_collection')
            ->addAttributeToSelect('name')
            ->addAttributeToSelect('sku')
            ->addAttributeToSelect('price')
            ->addAttributeToSelect('status')
            ->addAttributeToSelect('short_description')
            ->addAttributeToSelect('sm开发者_开发问答all_image')
            ->setStoreId($this->getStoreId())
            ->addMinimalPrice()
            ->addFinalPrice()
            ->addTaxPercents()
            ->addStoreFilter()
            ->addAttributeToFilter('is_facebook', 1)
            ->setVisibility(Mage::getSingleton('catalog/product_visibility')->getVisibleInCatalogIds());
        $collection->load();


That gets all products visible in catalog for the current store that have the 'is facewhatever' attribute set to one. The retrieved fields are self explanatory, presumably those are needed for your Facewhatever store view.

This information is retrieved as a collection of objects that I presume the rest of your code iterates over to post to Facewhatever.

0

精彩评论

暂无评论...
验证码 换一张
取 消