문제

I am showing new products on homepage with the code

{{block type="catalog/product_new" name="home.catalog.product.new" alias="product_homepage" template="catalog/product/new.phtml"}}

Now the results are shown from the oldest to newest.

How can i configure the ascending / descending, so i can see the newest to oldest ?

도움이 되었습니까?

해결책

Welcome to Magento.SE! This is quite easy to do and will require that you make a module to rewrite the functionality of Mage_Catalog_Block_Product_New.

Once you've done that, you need to just make an edit to the _getProductCollection method modifying the collection:

protected function _getProductCollection()
{
    $collection = parent::_getProductCollection();    
    $collection->addAttributeToSort('news_from_date', 'desc');

    return $collection;
}
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 magento.stackexchange
scroll top