Results 1 to 6 of 6
  1. #1
    Join Date
    Feb 2005
    Posts
    246
    Plugin Contributions
    0

    Default Reverse sort order of products

    If I understand correctly, when no product sort order is given, the items will display in oldest to newest order when viewing the list of items in a category. I'd imagine if I knew exactly what file to edit, and what MySQL command to edit, it'd be a simple switch of an "ORDER BY" to make it show newest first instead.

    If I'm right, can anyone point me to the right spot on the right file? If I'm missing it, is there another way besides retroactively placing a sort order on every product, then re-number them constantly to keep the newer products at the top of the list? (Will a negative sort order work? That might be the simple alternative. It wouldn't re-order the items with a 0 sort order, but I could put new items above the zeros anyway.)

  2. #2
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

    Default Re: Reverse sort order of products

    There is a setting in the Configuration ... Product Listing ...
    Display Product Listing Default Sort Order
    Product Listing Default sort order?
    NOTE: Leave Blank for Product Sort Order. Sort the Product Listing in the order you wish for the default display to start in to get the sort order setting. Example: 2a
    to know the setting you want to use, go to the Product Listing in your shop and click on the titles until you have the display order the way you want them and look in the URL and see what the setting is for the:
    sort=

    is set to ... that is the setting you would use to display the Products in the order that you want to see them ...
    Linda McGrath
    If you have to think ... you haven't been zenned ...

    Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!

    Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
    Officially PayPal-Certified! Just click here

    Try our Zen Cart Recommended Services - Hosting, Payment and more ...
    Signup for our Announcements Forums to stay up to date on important changes and updates!

  3. #3
    Join Date
    Feb 2005
    Posts
    246
    Plugin Contributions
    0

    Default Re: Reverse sort order of products

    Thanks. I hadn't seen that particular setting, but having seen it, I think I am missing something.
    First, let's make sure we are talking about the same page. It would be like "?main_page=index&cPath=13_14" where the items are displayed.

    Then, let's make sure I communicated correctly that I have many existing items that currently have no sort order on them, and I want to make them display in reverse order of their creation date.

    Reading the default instructions on that setting, and reading your answer, left me scratching my head. I am not new to zen, but could you answer this question as if I were a complete noob?

    (I should specify the cart is ver 1.3.8a)

  4. #4
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

    Default Re: Reverse sort order of products

    That would be a problem as the products_date_added is not one of the built in choices for the Product Listing ...

    You could add that and customize the initial sort order when a sort order has not been selected by the customer yet ...

    Look in the file:
    /includes/index_filters/default_filter.php

    and you can customize the code for:
    Code:
    // sort by products_sort_order when PRODUCT_LISTING_DEFAULT_SORT_ORDER is left blank
    // for reverse, descending order use:
    //       $listing_sql .= " order by p.products_sort_order desc, pd.products_name";
              $listing_sql .= " order by p.products_sort_order, pd.products_name";
              break;
    The current Products Sort Order, Products Name can be adjusted to something like the Date that the Product was added and Products Name ...
    Linda McGrath
    If you have to think ... you haven't been zenned ...

    Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!

    Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
    Officially PayPal-Certified! Just click here

    Try our Zen Cart Recommended Services - Hosting, Payment and more ...
    Signup for our Announcements Forums to stay up to date on important changes and updates!

  5. #5
    Join Date
    Feb 2005
    Posts
    246
    Plugin Contributions
    0

    Default Re: Reverse sort order of products

    Thanks Linda. I'll check that out next week. I should be able to manage that. I just didn't know what file to look in. When I'm successful, I'll post some code.

  6. #6
    Join Date
    Feb 2005
    Posts
    246
    Plugin Contributions
    0

    Default Re: Reverse sort order of products

    Quote Originally Posted by TecBrat View Post
    ...When I'm successful, I'll post some code.
    This seems to have worked:
    PHP Code:
    // sort by products_sort_order when PRODUCT_LISTING_DEFAULT_SORT_ORDER is left blank
    // for reverse, descending order use:
    //       $listing_sql .= " order by p.products_sort_order desc, pd.products_name";
    // zencart default is:
    //        $listing_sql .= " order by p.products_sort_order, pd.products_name";
    // sort by products_date_added, descending to put new items at the beginning of the list.
              
    $listing_sql .= " order by p.products_date_added DESC"

 

 

Similar Threads

  1. v150 New products on index-page in reverse order
    By Handinig in forum Templates, Stylesheets, Page Layout
    Replies: 1
    Last Post: 3 Nov 2012, 05:02 AM
  2. Replies: 0
    Last Post: 14 Sep 2011, 11:54 AM
  3. EZ Page Links are in Reverse Order...
    By audradh in forum General Questions
    Replies: 0
    Last Post: 22 Sep 2008, 08:24 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg