简体   繁体   中英

How to get product collection of given main category id?

In my website I have several stores available. One particular store contains both the simple and configurable products. This is a huge collection of products. What is the fastest way to get all enabled products (including child products of configurable products) collection of this store by store id?

Note: I tried this lot of different ways. But it takes loo much time. Sometimes cause to crash the server even.

Note : I'm using Magento CE 1.3

Any suggestions will be appreciated.

$collection = Mage::getModel('catalog/product')->getCollection();
$collection->addAttributeToSelect(array('name', 'url_key','price','lowest_price','service_id','description','short_description'));

$collection->addStoreFilter();

instead of use addAttributeToSelect('*') use only specific attributes which you needed because it effect performance of site

hope this will help you

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM