How to get the newest products of magento current category

If you ever need listing the newest products of magento current category (or even of a category given by it’s Id, see the code comments)

$totalPerPage = ($this->show_total) ? $this->show_total : 9;
$visibility = array(
// If you want to use a specific category load it by using this
// $cur_category=Mage::getModel('catalog/category')->load($category_id);
// Get current category
$cur_category = Mage::registry('current_category');
$storeId = Mage::app()->getStore()->getId();
$_productCollection = 
                              ->addAttributeToFilter('visibility', $visibility)
                              ->setOrder('created_at', 'desc')
This entry was posted in Categories, Products and tagged , , . Bookmark the permalink.

2 Responses to How to get the newest products of magento current category

  1. gold price says:

    For a client website, they needed to display their newest products on their own page. To do this I created a new CMS page entitled, go figure, “New Arrivals”. Using the ‘custom design’ options that Magento affords for each CMS page I added a block to pull all the products that are marked as ‘new’. To mark a product as new one must have set a date for the “Set Product as New from Date” and “Set Product as New to Date” options in the “General” product information page in the admin. Failure to mark these will keep the block from displaying anything at all.

    • erik says:

      Hi gold price!
      I hope your first intent was not to sindicate your link ;-)
      Yea that’s another way to solve it by inserting in html mode in cms page editor the code for block {{block type=”catalog/product_new” name=”” alias=”product_homepage” template=”catalog/product/new.phtml”}} which will give you all the new products while mine post referred to new products in the context of a category.

      Magento wiki describes it.

Leave a Reply

Your email address will not be published. Required fields are marked *

− 2 = two

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>