In Magento 1.9.2.x I would like to create a custom module that will show all sale items (anything with a current special price) within a different section of the store but retaining the normal category hierarchy/structure and filtered navigation etc.


Standard category URLs showing non-sale items:


New URLs showing only sale items within those same categories:


Previously we have done this by creating the "Sale" category and replicating the standard category tree beneath that and assigning products to those categories.

This quickly becomes un-manageable for a large catalogue, and when special prices end it is almost impossible to remember to remove the items from the Sale categories. A previous dev tried scripting the removal of products from sale categories but I don't feel that is the right approach either.

This guide from Inchoo looks like it will help me achieve most of what I want. The missing part is how I could implement the normal (/) and sale (/sale/) category URL structure.

Any ideas how I may handle this?

1 Answer 1


you could write a custom module and register 'sale' as its frontname and the category's url_key as a parameter (eg. /sale/category/books) i have some hints here for you regarding loading the products. when you want to have all filters available from the layered nav you should load the products via the catalog/layer model...




class Namespace_Module_IndexController extends Mage_Core_Controller_Front_Action
    public function indexAction()

in the layout file /design/frontend/base/default/layout/sale.xml:

<?xml version="1.0"?>
<layout version="0.1.0">
        <reference name="content">
            <block type="sale/product_list" name="product_list" template="catalog/product/list.phtml">
                <block type="catalog/product_list_toolbar" name="product_list_toolbar" template="catalog/product/list/toolbar.phtml">
                    <block type="page/html_pager" name="product_list_toolbar_pager"/>
                <action method="addColumnCountLayoutDepend"><layout>empty</layout><count>6</count></action>
                <action method="addColumnCountLayoutDepend"><layout>one_column</layout><count>5</count></action>
                <action method="addColumnCountLayoutDepend"><layout>two_columns_left</layout><count>4</count></action>
                <action method="addColumnCountLayoutDepend"><layout>two_columns_right</layout><count>4</count></action>
                <action method="addColumnCountLayoutDepend"><layout>three_columns</layout><count>3</count></action>
                <action method="setToolbarBlockName"><name>product_list_toolbar</name></action>

and a Block in Namespace/Module/Block/Product/List.php :

class Namespace_Module_Block_Product_List extends Mage_Catalog_Block_Product_List
 protected function _getProductCollection()

        $category = Mage::getModel('catalog/category')->setStoreId(Mage::app()->getStore()->getId())->load($this->getRequest()->getCategory(), 'url_key');
        Mage::register('current_category', $category);
        $productCollection = Mage::getSingleton('catalog/layer')->getProductCollection();

        return $productCollection;


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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