Hi I want to show only two latest product开发者_开发知识库 on home page and remaining product in right side bar. There is one method in my mind that either i will return only two element by following function $_productCollection=$this->getLoadedProductCollection();
But i think there should be a different approach for this. Please put some light on this
Not exactly shure what you are looking for. Do you want to know how to filter the product collection to get the newest products or do you want a module to do this?
Module: http://www.magentocommerce.com/magento-connect/Inchoo/extension/2513/featured-products
Code to get a collection of the most recently added products.
$productsCollection = Mage::getModel("catalog/product")->getCollection()
->addAttributeToSort("entity_id","DESC")
->setVisibility(Mage::getSingleton('catalog/product_visibility')->getVisibleInSiteIds())
->setPageSize(2)
->setCurPage(1);
Take a look to this Magento Wiki article:
http://www.magentocommerce.com/wiki/groups/248/display_products_on_home_page#new_products
精彩评论