- To get all products collection from a particular category id ,
$categoryId = 10;// category id as 10.
$category = Mage::getModel('catalog/category')->load($categoryId);
$storeid = 1;
$collection = Mage::getModel('catalog/product')->getCollection()
->addAttributeToSelect('sku')
->addAttributeToSelect('price')
->addAttributeToSelect('special_price')
->addAttributeToSelect('name')
->addAttributeToSelect('short_description')
->addAttributeToSelect('attribute_set_id')
->addAttributeToSelect('type_id')
->addAttributeToSelect('image')
->joinField('qty',
'cataloginventory/stock_item',
'qty',
'product_id=entity_id',
'{{table}}.stock_id=1',
'left');
$collection->setStoreId($storeid);
$collection->joinAttribute('product_title', 'catalog_product/name', 'entity_id', null, 'inner', $storeid);
$collection->joinAttribute('status', 'catalog_product/status', 'entity_id', null, 'inner', $storeid);
$collection->joinAttribute('visibility', 'catalog_product/visibility', 'entity_id', null, 'inner', $storeid);
$collection->joinAttribute('price', 'catalog_product/price', 'entity_id', null, 'left', $storeid);
$_products = $collection->addCategoryFilter($category);
foreach($_products as $_product)
{
echo $_product->getName();
echo $_product->getProductUrl();
}
Hi Ravi,
ReplyDeleteHow to delete orders of particular user/customer in Magento?
Hi
DeletePlease refer my Latest Post.
http://ravichandranjothi.blogspot.in/2013/07/magento-how-to-delete-particular-orders.html
Hi,
ReplyDeleteThis is Awesome post.. Great Thank you very much for sharing..
Web Development India | Wedding Websites
This comment has been removed by the author.
ReplyDelete