Magento – Create Category page which displays all Special Price products

categoryextensionspriceproduct-listsales

Basically, I've created a category 'Products on Sale', which I would like to automatically contain all products in my catalog that have had a Special Price applied to them (via Catalog > Manage Products). I would like the page to retain the layered navigation and sorting capabilities that a standard Magento Category page contains.

It seems like this is something that would be valuable to a majority of Magento users, and I'm surprised it is not included as part of the core functionality.

I've tried over a dozen Stack Exchange answers, blog posts, and forums, and nothing has worked thus far. Does anyone have a programmatic solution for this?

=== EDIT ===

Based on @pspahn's critique in the comments below, I've decided to pursue an alternate method of achieving similar functionality. With that said, if you are interested in pursuing this line, @sander-mangel describes a method which seems entirely feasible.

Best Answer

Easiest way to do this is to create a custom extension that works with an Observer and a Cronjob.

Create a category for the sales products. This way you can use the normal Magento functionalities in the frontend like layered navigation etc.

To get the products in this category automatically we will use the observer and cronjob. The observer will observe the catalog_product_save_after event that is triggered when a product is saved in the backend. When this happens you can check the special_price, special_price_from date and special_date_to date to determine if you need to put the product in the sales category or remove it from there.

The cronjob is there for the special from and to dates. Every night after midnight first empty the sales category of all the products. Then use a collection to retrieve all products that have a special price and are falling within the special from and to date. If so move them to this sales category.