5

How can I add additional sort by: price, newest and most popular?

enter image description here

Thanks.

9

There are two ways to do it

1) Using Magento Admin Panel

2) Using Custom Coding

1) To add using Magento Backend you need to follow below steps

a) Goto Catalog->Attributes->Manage Attributes

b) Select the attribute you want to add in Sort By option. Suppose you need to add a Sort By Brand Option.

c) Goto Brand Attribute and check for "Used for Sorting in Product Listing".

d) Make it YES

Thats it you will see Brand attribute in Drop Down on product Listing page Sort by option.

2) Suppose you want to add Sort By option like Price: High-Low etc. These can't be done using attributes. For this you need to add a custom select option. Please check the link of my blog which explains how to do it Universal Coder

As per your question to sort the product by Newest product you need to follow below steps

1) Goto Catalog->Manage Attributes->Set Product as New from Date attribute

2) Mark it as Yes for sorting in product listing page

3) Now you need to add below custom code in catalog->product->list->toolbar.phtml

<option value="<?php echo $this->getOrderUrl('news_from_date','desc') ?>"<?php if($this->isOrderCurrent('news_from_date') && $this->getCurrentDirection() == 'desc'): ?> selected="selected"<?php endif; ?>>
                     Newest
                </option>

this option is to be inserted under Select option for Sort By

  • The price, newest and most popular can be done by Step 1? When I add new Attribute I just put "YES" on the field (Used for Sorting in Product Listing)? And it will automatically sort by price, newest and most popular? – Enalds Mar 26 '14 at 6:39
  • Please see the edited answer for adding Sorting by Newest – Dexter Mar 26 '14 at 6:50
  • For most popular you need to do big digging in code. as i haven't tried it yet – Dexter Mar 26 '14 at 6:55
  • a comment: sort the product by Newest product is not the same as Set Product as New from Date attribute sorting. Because in the second one you must set explicitly a date from value in all the products in order to be able to sort them by this value but what you want is the real Product Added date sort which has to be done with code – aimiliano Oct 24 '16 at 9:30
  • How to sort custom price using default price sorting? @Dexter – Dhaduk Mitesh Apr 18 '18 at 5:55
1

You can achieve it by doing some custom coding because sort by popularity or sort by Rating is not included in Magento default sort by options. You can refer to the article below for all the steps and coding changes.

How to add Sort by popularity

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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