Page 1 of 2 12 LastLast
Results 1 to 10 of 15
  1. #1
    Join Date
    Sep 2007
    Posts
    12
    Plugin Contributions
    0

    Default sort sub-category view by date added

    When someone clicks on a subcategory, for example toys-infant. It shows a list of all infant toys. They are in alphabetical order. I would like them to list in the order they were added to the store, so that the newest products come up first.

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

    Default Re: sort sub-category view by date added

    Currently, the Product Listing is sortable by the fields that you have selected to display ... unfortunately, date added is not one of them ...

    You would have to customize the code to sort by date added then product name vs one of the available fields ...
    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: v1.5.5]
    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
    Sep 2007
    Posts
    12
    Plugin Contributions
    0

    Default Re: sort sub-category view by date added

    where would I look for the code that is doing the sorting?

  4. #4
    Join Date
    May 2007
    Posts
    43
    Plugin Contributions
    0

    Default Re: sort sub-category view by date added

    Open the file [FONT="Courier New"]/includes/index_filters/default_filter.php[/FONT]

    Find the line that says (line 113 in default 1.3.7):

    PHP Code:
    $listing_sql .= ' order by '
    Replace with:

    PHP Code:
    $listing_sql .= ' order by p.products_date_added DESC,'
    Go to Configuration -> Product Listing -> Display Product Listing Default Sort Order. Set this to anything valid, like "2a" for example. This isn't going to do anything, just activates the part of the code in default_filter.php file that does the sorting.


  5. #5
    Join Date
    Sep 2007
    Posts
    12
    Plugin Contributions
    0

    Default Re: sort sub-category view by date added

    that worked! Thanks. - Hunter

  6. #6
    Join Date
    Jan 2004
    Posts
    482
    Plugin Contributions
    0

    Default Re: sort sub-category view by date added

    You rock!! Thank you so much! :)

    Quote Originally Posted by moltar View Post
    Open the file [FONT="Courier New"]/includes/index_filters/default_filter.php[/FONT]

    Find the line that says (line 113 in default 1.3.7):

    PHP Code:
    $listing_sql .= ' order by '
    Replace with:

    PHP Code:
    $listing_sql .= ' order by p.products_date_added DESC,'
    Go to Configuration -> Product Listing -> Display Product Listing Default Sort Order. Set this to anything valid, like "2a" for example. This isn't going to do anything, just activates the part of the code in default_filter.php file that does the sorting.


  7. #7
    Join Date
    Jul 2008
    Posts
    1
    Plugin Contributions
    0

    Default Re: sort sub-category view by date added

    Quote Originally Posted by moltar View Post
    Open the file [FONT="Courier New"]/includes/index_filters/default_filter.php[/FONT]

    Find the line that says (line 113 in default 1.3.7):

    PHP Code:
    $listing_sql .= ' order by '
    Replace with:

    PHP Code:
    $listing_sql .= ' order by p.products_date_added DESC,'
    Go to Configuration -> Product Listing -> Display Product Listing Default Sort Order. Set this to anything valid, like "2a" for example. This isn't going to do anything, just activates the part of the code in default_filter.php file that does the sorting.

    I had this problem for several days
    finally resolved,thank you very much,moltar

  8. #8

    Default Re: sort sub-category view by date added

    I want my most recent products showing first in the sort order on the listing display. This mod worked exactly as I wanted to get that to happen. Thank you.

    Now for a follow up question: is anyone familiar with where I would change the code to do the exact same thing for the Previous/Next logic that cycles through the listing on the Product Info page?

    I know that is set in the Config/Product Info/Previous Next - Sort Order where date added is not an option so I'm assuming I need to customize just like I did for the product listing page.

    Thank you!
    www.pinkchalkfabrics.com - cloth, pattern + tool for modern sewists
    ZC version 1.3.9h, Simple Category Tree, Super Orders

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

    Default Re: sort sub-category view by date added

    Currently, in the Configuration ... Product Info ... there is a setting for:
    Previous Next - Sort Order
    Products Display Order by
    0= Product ID
    1= Product Name
    2= Model
    3= Price, Product Name
    4= Price, Model
    5= Product Name, Model
    6= Product Sort Order
    You would have to customize the code further if you want it to sort by date vs any of the built in settings ...
    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: v1.5.5]
    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!

  10. #10

    Default Re: sort sub-category view by date added

    Thank you Ajeh. That's what I thought. Can you point me to the file that contains the Previous/Next SQL statement or what I would search for in order to find it myself?

    Thank you!

    Kathy
    www.pinkchalkfabrics.com - cloth, pattern + tool for modern sewists
    ZC version 1.3.9h, Simple Category Tree, Super Orders

 

 
Page 1 of 2 12 LastLast

Similar Threads

  1. 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
  2. How to set the products to sort by date added?
    By sharontan in forum Basic Configuration
    Replies: 10
    Last Post: 5 Mar 2012, 03:21 AM
  3. sort by price, date added, etc
    By RollzRoyce in forum Templates, Stylesheets, Page Layout
    Replies: 1
    Last Post: 5 Aug 2010, 05:03 PM
  4. Sort by Date Added/Product ID
    By edadk in forum Setting Up Categories, Products, Attributes
    Replies: 0
    Last Post: 10 Nov 2008, 04:56 PM
  5. Sort By Date Added!!
    By brotherhud in forum Setting Up Categories, Products, Attributes
    Replies: 3
    Last Post: 21 Feb 2007, 01:39 AM

Bookmarks

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
Zen-Cart, Internet Selling Services, Klamath Falls, OR