My Cart

You have no items in your shopping cart. Buy products from our webshop

How to create a $1 bargains page in Magento

At some of our Magento projects we were required to create custom pages that contained a large collection of products that meet specific requirements. An example? The € 2, - gadgets page at www.chinese-gadgets.nl/2-euro-gadgets. Because the promotion 'Catalog Price Rules' slow down Magento extremely - and in addition to that would be just a workaround. We have solved this problem by creating a custom block on which we apply our filters directly to the productCollection and calling this block through a simple Layout XML Update on a CMS page.

The main advantage of this way of realizing such pages in Magento is that the toolbar, pagination, navigation layered, caches & indexes all continue to function correctly. You could use this method for a variety of things, given that you can obviously use a custom template to display the products anyway you want. You could use this method to create a:

  • 'Favorites' product page
  • $1 bargain page
  • Featered product slider
  • Bestsellers block or page

Enought said, here is how you create a €1 Bargain page in Magento:

Step one
Create a new CMS page, name it and click on the design tab. Place the following in the Layout XML Update field:

Note that I have set 2 as the categoryId, because this the id of my root category. I actually want to display ALL the products in my store that meet the price filters, but you could also use a specific category. Be sure that you use the correct id of your category and be sure that it's set to be an Anchor (or it won't display any products in the first place).

Step two
In the XML update above, you can see we call catalog/product_bargains as the block type. What we are going to do now, is creating a custom block where we actually apply our custom pricefilters. To do so, make a copy of /app/code/core/Mage/Catalog/Block/Product/List.php, create the directory /app/code/local/Mage/Catalog/Block/Product and place it there. Rename this file to Bargains.php

Step three
Edit Bargains.php and change the class definition (the first line of actual code, line number 35):

to 

Then scroll to around line 59, and you'll that this is where your productCollection is build. This is the part that we are going to extend with our filters.  At line 89, you'll see the following defintion:

Below this definition, place the following code:

What the first two lines do is pretty straightforward. We calculate the max price excluding tax (19% in the Netherlands) and CurrencyRate and apply an attribute filter, which is in this case the price. Save the file, and view your bargains CMS page. You'll see that you have successfully created a custom filtered collection page, that behaves exactly as a normal category page.

Erwin Otten

Erwin Otten is a Web Designer / Graphic Designer from Oude Wetering (The Netherlands) and co-founder of Hachmang & Otten. With an education in communication & multimedia design, he is passionate about web design at all levels including (information) architecture, interaction, code, and graphic design. Contact Erwin Otten

Comment and contribute