Author - Robert Popovic

Founder and Technical Director of LERO9, a web agency specializing in Magento and WordPress design and development.

I launched Magebase in April, 2010 and am its editor and contributor. My main topics of interest are Magento development, customization and how to get the most out of Magento with the least amount of headache.

More Info » Follow me on Twitter »

Reader Comments (57)

  1. John Doyle
    John Doyle
    November 2, 2011 at 10:44 am /

    Why did I not think of that… Thanks

  2. guy
    November 17, 2011 at 4:20 am /

    hi robert , great simple little extension, thankyou ! … except .. it defaults to sorting in the wrong direction .. oldest at the top … maybe im being dumb , but i cant find a way of setting it to sort the other way up !! guy

  3. LL
    November 17, 2011 at 7:44 am /

    Thank you for the extension. It worked in CE 1.6.
    To default newest to oldest (descending direction), change Toolbar.php about line 119 from ‘asc’ to ‘desc’

         * Default direction
         * @var string
        protected $_direction           = 'desc';
    1. gabo
      June 19, 2012 at 2:59 am /

      Where is Toolbar.php ??? If it so, I can use attribute “News from” to sort products in my categories.

  4. jay
    November 29, 2011 at 5:32 am /

    Hey Robert,

    sorry for the dumb question. But what is the best way to install the extension.
    Load the files in the folders and then
    call http://www.myshop/app/code/local/Magebase/SortbyNewest/sql/sortbynewest_setup/mysql4-install-0.1.0.php
    or how it is done?



  5. elvar
    January 4, 2012 at 2:31 am /

    Hi Jay, you can do that rather manually in admin interface instead of installing the app. But if you want still install the app just upload everything to your Magento folder and that is it – on first load Magento will install it for you.

    Robert, is there any posibility that I do not have created_at attribute? I cannot find it in admin and nor in mysql database.

  6. Peter Svegrup
    Peter Svegrup
    July 4, 2012 at 11:20 pm /

    Hi Robert,

    It might be a long shot but is it possible to add stock status to the front end sorting the same way? I dug through the eav_attribute table to no result and from a bit of research it looks like there is only product status available which is not much of use if the store is set to display out of stock products.

    I’d be very grateful if you could let me know the above or a hint to an alternative solution.

    Thanks in advance


  7. Johnny
    July 11, 2012 at 8:23 pm /

    It works fine on Magento 1.6.2 !
    Thank you very much, i was working on since two days… And no way !

  8. atwix
    July 17, 2012 at 3:00 am /

    Hello. Thanks, it’s very useful and important information. We have an article on the similar topic posted here you’re welcome to check it out and leave your feedback.

  9. tyishop
    September 19, 2012 at 8:04 am /

    Thanks for posting this extention. It sounds like just what I need. I am having no luck getting it to work on CE I added the extension and it’s sorting in ascending order. My theme didn’t have a local.xml file in app/design/frontend/default/mytheme/layout. Should I be able to just create a new one and add it there? I tried that with your code and also tried adding the code to catalog.xml to change the sort order to descending but no luck.

    1. Dan
      September 20, 2012 at 5:13 am /

      Ii’m in 1.7.02

      Yes just create a local.xml. I put it in app/design/frontend/default/default/layout

  10. Dan
    September 20, 2012 at 4:21 am /

    Is it possible to make this “Sort by newest” sort become the default sort when the page is opened?
    i have the sort working and defaulting to desc in local.xml thanks

    1. Dan
      September 20, 2012 at 11:53 pm /

      in 1.7.02 the default sort order is in the configuration.

      Config > Catalog > Catalog > Frontend >Product Listing Sort by

  11. Glen
    October 11, 2012 at 4:16 pm /

    Does this work with Magento CE

  12. KUI
    October 12, 2012 at 6:50 pm /

    I have installed frontend link manager extention from mage PSYCHO, and then soon after installed sort by newest extention from you. However, I now don’t see toplinks except my cart, and my account page has totally disappeared .
    Can you get me the fix? It looks like these two extentions are crashing to each other. Please let me know. Thank you

  13. KUI
    October 13, 2012 at 1:46 pm /

    Is it possible to remove completely from the website? I tried removing the files from the database, but there is still drop down menu on the admin panel for newest sort order. I still can not get the toplinks to work out.

  14. KUI
    October 23, 2012 at 8:40 am /

    Oh I forgot to mention toolbar is showing but I disabled the sorter for customers not to adjust.
    When the toolbar and sorter is enabled the newest function works, but when the sorter is disabled from toolbar,
    the default setting is something different, and I don’t know where to change the setting for result page.

  15. Kiranpal
    October 26, 2012 at 3:09 am /

    Great job Robert. It is working well in

    1. Udom
      February 26, 2013 at 7:13 pm /

      How can you do it? Please help me :T_T:

  16. Lman
    November 13, 2012 at 8:14 am /

    Hello, please could anybody help me how to completely remove this module? I have serious problems after installing it. I have still errors with max_user_connections to database. I really need to “uninstall” it. Installation was by copying it to root/app folder.

    Thank you.

    1. Eman
      January 5, 2013 at 10:31 am /

      Same problem as Lman. Does anybody knows how to uninstall it?

    2. Eman
      January 5, 2013 at 10:31 am /

      Same problem as Lman ๐Ÿ™

  17. LittleBigDev
    November 29, 2012 at 11:30 pm /

    Once again, you made my day ๐Ÿ™‚
    Thanks for sharing, there’s never enough guys like you ๐Ÿ™‚

  18. Sonia
    December 28, 2012 at 9:47 pm /

    It’s not working for me… ๐Ÿ™ Anything I should know?

    1. Sonia
      December 28, 2012 at 10:00 pm /

      Only to clarify:
      . What I did to install it was extract the folder to app and then close my browser and open it again. But I don’t have Sort by -> Date on my System -> Configuration -> Catalog / Product listin sort by… Any idea on what’s wrong?

      Please, I really need this >_<

  19. Chintan
    January 28, 2013 at 11:18 pm /

    Works Great in magento 1.5 for me !!!

  20. Renato Medina
    February 7, 2013 at 9:12 pm /

    Tks Robert, it worked for me. Saved me hours!!! cheers mate.

    1. Udom
      February 20, 2013 at 5:27 pm /

      I cannot do it. Can you tell me how to do it? Thanks…

  21. Udom
    February 20, 2013 at 4:44 pm /

    Excuse me, could u tell me how to install and the local to install for the extension file that I just downloaded from here? Thanks…

  22. Damu
    July 4, 2013 at 2:52 pm /

    That was short and sweet code trick, and saved me a headache and time.

  23. jim
    July 8, 2013 at 10:21 pm /

    Thank for details description. Sorting is an important part of e-shop.
    But i use improved sorting extension to make this process more easy.
    And also the extension gives me different opportunities to create blocks of new or bestseller products.
    hope it will be useful for somebody

  24. Pradip
    July 31, 2013 at 6:37 pm /

    It save my time…

  25. raj
    September 19, 2013 at 5:43 pm /

    hello friends ,

    is any one help me regarding “sort by” according to stock quantity at listing page ????

  26. Kayz
    January 7, 2015 at 10:47 am /

    Hi I have installed the module successfully however it doesn’t appear to work for me.

    I am running Magento ver., any help on this would be much appreciated.

    Thank You

  27. vikas
    April 10, 2015 at 7:56 pm /

    Thanks Works like charm ๐Ÿ™‚

  28. Best tutorials for Magento | Ken Nguyen

    […] Magento Sort By Newest Products Made Easy […]

  29. anon
    August 27, 2015 at 10:16 pm /

    Been trying to find out how to do this for a while, this seems to work perfectly, even in Magento 1.9.1.
    Thank you!

  30. anon
    August 27, 2015 at 10:35 pm /

    I do have 1 question, i want the newest option to be the default in my ‘whats new’ category and i would like it to dispaly newest first (so i have changed the default direction as you suggested) – but I want all my other categories to use sort by ‘price’ and so need the direction to be the opposite (lowest first) – is this possible? if so what do I need to do please?

  31. sw
    June 17, 2016 at 4:27 am /

    i extracted the files and then uploaded to my docroot, but nothing seems to have occurred. is there another step i must take? thanks

  32. Pratik Shah
    September 26, 2016 at 9:53 pm /

    best to only install trustworthy Magento extensions ๐Ÿ™‚ that help you to create new product very easily. If you want to create store or increase your product sales by online product designer tools, i recommanded Brush Your Ideas – A web to print magento product designer.


Add a Comment & Join the Discussion

Insert small snippets of code by using [code]{your_code_here}[/code]
For larger code blocks please use and paste your link.

You may also use the following HTML in your comment: <a href="" title=""> <abbr title="">
<acronym title=""> <blockquote cite=""> <cite> <em> <strike> <strong>