Page 1 of 2 12 LastLast
Results 1 to 10 of 12
  1. #1
    Join Date
    Nov 2008
    Location
    Slovenija
    Posts
    119
    Plugin Contributions
    0

    Default Newest product first - sort product by date

    I would like that my products is sorted by date. The newest product should appear first.


    Did you have some suggestions?
    I love internet and the power of information... Best Wishes!!

  2. #2
    Join Date
    Aug 2005
    Location
    Arizona
    Posts
    27,755
    Plugin Contributions
    9

    Default Re: Newest product first - sort product by date

    Your options are at

    admin > config > layout settings > Categories/Products Display Sort Order
    Zen-Venom Get Bitten

  3. #3
    Join Date
    Nov 2008
    Location
    Slovenija
    Posts
    119
    Plugin Contributions
    0

    Default Re: Newest product first - sort product by date

    There isn't any option to sort by date, only by name, quantity and price.
    I love internet and the power of information... Best Wishes!!

  4. #4
    Join Date
    Dec 2009
    Location
    Richmond, VA
    Posts
    160
    Plugin Contributions
    3

    Default Re: Newest product first - sort product by date

    I would like to do this too, my products seem to do what they want... sometimes its by sort order, sometimes not. Date added would be much nicer.

  5. #5
    Join Date
    Nov 2010
    Posts
    57
    Plugin Contributions
    0

    Default Re: Newest product first - sort product by date

    Hey, so what's the answer? How to sort by date? NEed help too..

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

    Default Re: Newest product first - sort product by date

    There are a number of places where the Products are listed ...

    Could you give more details on where you are trying to get Products listed by date?
    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!

  7. #7
    Join Date
    Mar 2009
    Location
    Shenzhen
    Posts
    10
    Plugin Contributions
    0

    Default Re: Newest product first - sort product by date

    Quote Originally Posted by Ajeh View Post
    There are a number of places where the Products are listed ...

    Could you give more details on where you are trying to get Products listed by date?
    Hello Ajeh,

    I just want them sorted by date added in the search results any time, how should i do?

    Thanks very much.

    --Schumi

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

    Default Re: Newest product first - sort product by date

    You would need to change the:
    $order_str

    in the file:
    /includes/modules/pages/advanced_search_results/header_php.php

    most likely around line 454:
    Code:
    $listing_sql = $select_str . $from_str . $where_str . $order_str;
    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!

  9. #9
    Join Date
    Mar 2009
    Location
    Shenzhen
    Posts
    10
    Plugin Contributions
    0

    Default Re: Newest product first - sort product by date

    Quote Originally Posted by Ajeh View Post
    You would need to change the:
    $order_str

    in the file:
    /includes/modules/pages/advanced_search_results/header_php.php

    most likely around line 454:
    Code:
    $listing_sql = $select_str . $from_str . $where_str . $order_str;
    Thanks the reply.

    I found out the code in header_php.php, but i don't know where to put the code or change the $order_str with "p.products_date_added"

    I try to put it everywhere but then error happened

    Please check the code there:
    Code:
     // if set to nothing use products_sort_order and PRODUCTS_LIST_NAME is off
      if (PRODUCT_LISTING_DEFAULT_SORT_ORDER == '') {
        $_GET['sort'] = '20a';
      }
    } else {
      $sort_col = substr($_GET['sort'], 0 , 1);
      $sort_order = substr($_GET['sort'], 1);
      $order_str = ' order by ';
      switch ($column_list[$sort_col-1]) {
        case 'PRODUCT_LIST_MODEL':
        $order_str .= "p.products_model " . ($sort_order == 'd' ? "desc" : "") . ", pd.products_name";
        break;
        case 'PRODUCT_LIST_NAME':
        $order_str .= "pd.products_name " . ($sort_order == 'd' ? "desc" : "");
        break;
        case 'PRODUCT_LIST_MANUFACTURER':
        $order_str .= "m.manufacturers_name " . ($sort_order == 'd' ? "desc" : "") . ", pd.products_name";
        break;
        case 'PRODUCT_LIST_QUANTITY':
        $order_str .= "p.products_quantity " . ($sort_order == 'd' ? "desc" : "") . ", pd.products_name";
        break;
        case 'PRODUCT_LIST_IMAGE':
        $order_str .= "pd.products_name";
        break;
        case 'PRODUCT_LIST_WEIGHT':
        $order_str .= "p.products_weight " . ($sort_order == 'd' ? "desc" : "") . ", pd.products_name";
        break;
        case 'PRODUCT_LIST_PRICE':
        //        $order_str .= "final_price " . ($sort_order == 'd' ? "desc" : "") . ", pd.products_name";
        $order_str .= "p.products_price_sorter " . ($sort_order == 'd' ? "desc" : "") . ", pd.products_name";
        break;
      }
    }
    
    $listing_sql = $select_str . $from_str . $where_str . $order_str;
    // Notifier Point
    $zco_notifier->notify('NOTIFY_SEARCH_ORDERBY_STRING', $listing_sql);
    Could you help me?

    Have a nice christmas!
    --Schumi

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

    Default Re: Newest product first - sort product by date

    The sort order is defined by the contents of the:
    $order_str

    If you want the display order to be different than any of the existing sort orders, you can change its content before that line so it contains an ORDER BY statement to match your needs ...

    Something like adding the line in red:
    Code:
    $order_str = " ORDER BY p.products_date_added DESC, pd.products_name ";
    $listing_sql = $select_str . $from_str . $where_str . $order_str;
    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!

 

 
Page 1 of 2 12 LastLast

Similar Threads

  1. v154 Sorting Product list by newest Product added
    By cyberfolli in forum Templates, Stylesheets, Page Layout
    Replies: 3
    Last Post: 20 Aug 2016, 12:20 PM
  2. Sort by date in product listing?
    By waterbender in forum General Questions
    Replies: 0
    Last Post: 14 Aug 2013, 07:08 AM
  3. Sort by Date Added New to Old (etc) on Product Listing Pages?
    By limelites in forum Templates, Stylesheets, Page Layout
    Replies: 1
    Last Post: 25 May 2009, 09:21 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. Newest First?
    By ekat in forum Templates, Stylesheets, Page Layout
    Replies: 6
    Last Post: 18 Sep 2007, 12:45 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