Frage

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 ?

War es hilfreich?

Lösung

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;
}
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit magento.stackexchange
scroll top