开发者

How can i show new added product on home page in magento

开发者 https://www.devze.com 2023-04-12 00:23 出处:网络
Hi I want to show only two latest product开发者_开发知识库 on home page and remaining product in right side bar.

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

0

精彩评论

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