have created a 'new page' as 'latest products' and i want to show all the products in this page but sorted 'datewise' i.e. new first .. i got from google was to use this code

<reference name="content">
  <block type="catalog/product_new" name="home.catalog.product.new" alias="product_new" template="catalog/product/new.phtml" after="cms_page">
  <action method="addPriceBlockType"><type>bundle</type><block>bundle/catalog_product_price</block><template>bundle/catalog/product/price.phtml</template></action>
  <action method="setColumnCount"><columns>4</columns></action>
  <action method="setProductsCount"><count>4</count></action> 

but with this approach i have to set the product attribute " New from Date" . in 'backend' i have a table where i have products with "Date Created" column is it possible to pull products from that table, sorted 'datewise' and show in the 'new page' ?? if yes, How ?? thanks for the help


You can do this by logging into the admin panel . A "new page" means a page under Admin Panel -> CMS -> Pages, you can select the page, edit the content and add a widget called "Catalog new product list".

the catalog new product list widget

There are times when an approach of editing files and writing code is needed as it is more powerful, but you should try to use Magento's build in functionality when possible, since it will be more tested that stuff you will write and will save you time;)


It will be better to create new block class which is extends Mage_Catalog_Block_Product_New class.

Then on new class join product collection with your custom table using join query.

class Amit_Custommodule_Block extends Mage_Catalog_Block_Product_New{
 protected function _getProductCollection()
        $todayStartOfDayDate  = Mage::app()->getLocale()->date()

        $todayEndOfDayDate  = Mage::app()->getLocale()->date()

        /** @var $collection Mage_Catalog_Model_Resource_Product_Collection */
        $collection = Mage::getResourceModel('catalog/product_collection');

        $table = 'Your_Table';
        $collection = $this->_addProductAttributesAndPrices($collection)
           /*  ->addAttributeToFilter('news_from_date', array('or'=> array(
                0 => array('date' => true, 'to' => $todayEndOfDayDate),
                1 => array('is' => new Zend_Db_Expr('null')))
            ), 'left')
            ->addAttributeToFilter('news_to_date', array('or'=> array(
                0 => array('date' => true, 'from' => $todayStartOfDayDate),
                1 => array('is' => new Zend_Db_Expr('null')))
            ), 'left')
                    array('attribute' => 'news_from_date', 'is'=>new Zend_Db_Expr('not null')),
                    array('attribute' => 'news_to_date', 'is'=>new Zend_Db_Expr('not null'))
              ) */
            ->addAttributeToSort('news_from_date', 'desc')
             $collection->getSelect()->join(array('AliasnameTable' => $table),
    'AliasnameTable.prodduct_id = e.entity_id', array('date_created'))->setOrder('AliasnameTable.date_created','desc');

        return $collection;


xml code:

Create a custom module and custom block type


Then change from catalog/product_new to custommodule/new .

See how to create Custom module

  • i will try this as well
    – MaX
    May 11 '15 at 5:36
  • @Amit how can we get the collection within the layered navigation so that the collection is properly filtered?
    – Haim
    Mar 21 '17 at 20:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.