Magento tutorial: custom product listing order

Many store owners using Magento as their e-commerce platform are frustrated by the lack of flexibility and control in terms of how their products are displayed on the frontend.

Ideally, we would like a screen where you can view your products, then simply drag them up and down to change the order in which they appear when in list view.

Unfortunately, when it comes to user-friendliness, Magento is way behind other CMSs like WordPress.

Still, there is a fairly straightforward way to re-arrange the default product listing order in Magento – if you know where to click.

First of all, in your admin area go to Catalog > Attributes > Manage Attributes > Add New Attribute and create a custom attribute. Give it an attribute code of “listing_order”, leave it as a text field, make it a required value to ensure you remember to set this when you add new products. Also set the “Input validation” to integer number. Then scroll to the bottom and change the “Used for Sorting in Product Listing” field to “yes”. You also need to give the new attribute a label, call it “Listing Order”.

Save to exit this screen, then go to Catalog > Attributes > Manage Attribute Sets, click on your attribute set (usually “default” unless you have created more sets). You will see “listing_order” under “Unassigned Attributes”, just drag it into the General group, anywhere you like (see, Magento CAN do drag and drop – when the developers make the effort to implement it). Save the attribute set.

At this point you may get a message about re-indexing data, so do that.

Now go to each individual product (I know, it’s a pain if you have hundreds of products, but it’s the only way) and under the general options find your new “Listing Order” field. It is now a required field, which means Magento won’t let you exit this screen until you have set a value. Start from the product you want to display at the top of your list view and give it a low value, but nowhere near 0. You will want to create new products in future and display them at the top, so leave plenty of room. If you have about a hundred products, start from, say, 1000 as the first number. For the next product, enter 1100, then 1200, and so on (always better to leave plenty of values available in between products, just in case you expand a certain range and need to display the new products next to existing ones).

Save each product and re-index your catalog through the cache management screen.

Lastly, go to System > Configuration > Catalog > Frontend and under “Product Listing Sort by” you should see the option “Listing Order”. Select it, save and… hopefully, when you refresh your list view, your products will have re-arranged themselves in the order you set.

From now on, you have complete control over the listing order, instead of being restricted to the Magento default choices.

Posted on Monday, August 8th, 2011.