Page 1 of 2 12 LastLast
Results 1 to 10 of 13
  1. #1
    Join Date
    Jul 2005
    Posts
    46
    Plugin Contributions
    0

    Default How do I change the sort order of a category?

    First, I know of these settings, but they do not do what I'm looking for.

    Admin - Product Info - Previous Next - Sort Order
    Admin - New Listing - Display Product Display - Default Sort Order
    Admin - All Listing - Display Product Display - Default Sort Order

    I'm looking to change the default sort order of a specific category. When someone clicks on a category, currently the default is alphabetical. I want it sort by date added.

    I believe I have to modify the default_filter.php file in the /includes/index_filters to make this work (maybe not too). I just don't know how to modify it.

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

    Default Re: How do I change the sort order of a category?

    That is correct ...

    You would need some type of conditional sort order where you see:
    PRODUCT_LISTING_DEFAULT_SORT_ORDER

    in the default_filter.php

    Be sure to keep backups of the original file as well as your changed file ...
    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
    Jul 2005
    Posts
    46
    Plugin Contributions
    0

    Default Re: How do I change the sort order of a category?



    Could I get some help with that conditional?

    I tried changing the $alpha_sort in this code section

    PHP Code:
    // We are asked to show only a specific category
          
    $listing_sql "select " $select_column_list " p.products_id, p.products_type, p.manufacturers_id, p.products_price, p.products_tax_class_id, pd.products_description, if(s.status = 1, s.specials_new_products_price, NULL) AS specials_new_products_price, IF(s.status = 1, s.specials_new_products_price, p.products_price) as final_price, p.products_sort_order, p.product_is_call, p.product_is_always_free_shipping, p.products_qty_box_status
           from " 
    TABLE_PRODUCTS " p left join " TABLE_SPECIALS " s on p.products_id = s.products_id , " .
           
    TABLE_PRODUCTS_DESCRIPTION " pd, " .
           
    TABLE_MANUFACTURERS " m, " .
           
    TABLE_PRODUCTS_TO_CATEGORIES " p2c
           where p.products_status = 1
             and p.manufacturers_id = m.manufacturers_id
             and m.manufacturers_id = '" 
    . (int)$_GET['manufacturers_id'] . "'
             and p.products_id = p2c.products_id
             and pd.products_id = p2c.products_id
             and pd.language_id = '" 
    . (int)$_SESSION['languages_id'] . "'
             and p2c.categories_id = '" 
    . (int)$_GET['filter_id'] . "'" .
          
    $alpha_sort;
       } 
    to

    "ORDER by p.products_date_added DESC";

    but it didn't do anything. Am in the right place with this or way the hell off base?

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

    Default Re: How do I change the sort order of a category?

    You are hot ... but then, unfortunately so is ...

    Follow the setting that is currently used:
    PRODUCT_LISTING_DEFAULT_SORT_ORDER

    This is where the setting is set ...

    You want to alter that on a per Category basis vs on a single setting for the whole shop ...
    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
    Jul 2005
    Posts
    46
    Plugin Contributions
    0

    Default Re: How do I change the sort order of a category?

    LOLOL!!

    Thank you Linda!

    I changed

    $listing_sql .= " order by p.products_sort_order, pd.products_name";

    to this

    $listing_sql .= " order by p.products_date_added DESC, pd.products_name";

    and the category products are displaying showing the newest first.

    Thank you again! Seems you've been helping me with all my questions lately. Appreciate it immensely!

  6. #6
    Join Date
    Oct 2006
    Posts
    40
    Plugin Contributions
    0

    Default Re: How do I change the sort order of a category?

    Would I use this if I wanted to change the order of all of the categories as they display on the menu to be by date added?

  7. #7
    Join Date
    Jun 2007
    Location
    Posadas, Misiones, Argentina
    Posts
    220
    Plugin Contributions
    0

    Default Re: How do I change the sort order of a category?

    It also worked for me!!! Thanks!
    URL: http://www.littledreamswarehouse.com/shop
    Zen Version: 1.3.89h
    Zen Template: orange modified

  8. #8
    Join Date
    Aug 2006
    Location
    portlandish, oregon
    Posts
    799
    Plugin Contributions
    0

    Default Re: How do I change the sort order of a category?

    AHHH FINALLY!!!!!!!!!!!! This took me FOREVER to find. I needed all my categories to sort newest to oldest and this worked!

    There were to places where this code showed up

    $listing_sql .= " order by p.products_sort_order, pd.products_name";

    My products didn't sort right til I replaced the second.

    Thank you!!!!!!!

  9. #9
    Join Date
    Sep 2008
    Posts
    1
    Plugin Contributions
    0

    Default Re: How do I change the sort order of a category?

    I realize this is acouple years later and this is a new version of zen cart so how about go to catalog/categories/products and then on your categories click on the green circle with the "e" in it (for edit) and at the bottom of the page on the left enter your sort order...

  10. #10
    Join Date
    Sep 2008
    Posts
    2
    Plugin Contributions
    0

    Default Re: How do I change the sort order of a category?

    I use this code to change the order of all of the categories as they display on the menu to be by date added.
    $listing_sql .= " order by p.products_date_added DESC, pd.products_name";

    The category products are displaying showing the newest first. But i have a problem.

    When i click in "Item Name" to be list by Name and to replaced the second option. The list continue showing by date added?

    Do you understand-me. I´m Brazilian and my English is not good.

    Can you help-me?

 

 
Page 1 of 2 12 LastLast

Similar Threads

  1. v139h How to change the sort order of the cart contents?
    By Eric Chen in forum General Questions
    Replies: 1
    Last Post: 3 Jan 2014, 09:43 PM
  2. v151 Change sort order of products to date added to category
    By Bee01 in forum Customization from the Admin
    Replies: 2
    Last Post: 25 May 2013, 02:21 PM
  3. v151 Product Sort within Category - having problems changing the default sort order
    By Don Wagner in forum Customization from the Admin
    Replies: 4
    Last Post: 21 Oct 2012, 03:03 AM
  4. Change sort order of products in a category using phpmyadmin
    By mcpisik in forum General Questions
    Replies: 9
    Last Post: 4 Aug 2012, 01:43 PM
  5. v138a how to edit sort order value in the category browsing page of admin?
    By hmdnawaz in forum Setting Up Categories, Products, Attributes
    Replies: 3
    Last Post: 6 Apr 2012, 01:48 PM

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