Page 3 of 9 FirstFirst 12345 ... LastLast
Results 21 to 30 of 86
  1. #21
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

    Default Re: Product Listing Default Sort Order

    Quote Originally Posted by kwarner View Post
    It does not matter what settings I change, the products on my site in every category are listed in alphabetical order by product name. Am I missing something? How do I change it so all my products are listed by date added, newest on top? I cannot believe how confusing this is!
    Maybe we are confusing where you are when you think you want to sort by date ...

    What URL do you want to sort by date?

    NOTE: the Product Listing that is used when you select a Category does not have built in a Sort by Date ... you would need to customize the code for this ...

    This is one of the reasons why there is a handy dandy New Products Listing ...
    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!

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

    Default Re: Product Listing Default Sort Order

    Quote Originally Posted by edwardtilbury View Post
    But what does the SORT value do? You know , when you export the store to easy populate and there is a SORT value for each product?

    How can I enable this?
    If you mean the field products_sort_order ... this is for when you want to physically sort the products in an order that is not natural to a logical sort order based on a field in the products or products_description tables ... so you manually apply the sort order of the products yourself ...
    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. #23
    Join Date
    Jan 2009
    Posts
    2,123
    Plugin Contributions
    0

    Default Re: Product Listing Default Sort Order

    This one has me puzzled too.... I'm trying to make the default sort order newest to oldest... How can this be achieved?

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

    Default Re: Product Listing Default Sort Order

    This is not built into the Product Listing to sort by date ...

    You would have to customize it for this feature ...

    NOTE: There is always the New Products Listing for sorting by date and then leave the Product Listing for the other 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!

  5. #25
    Join Date
    Jan 2009
    Posts
    2,123
    Plugin Contributions
    0

    Default Re: Product Listing Default Sort Order

    I know, but new products listing displays only products a few days old (depending on settings) and will display products from all categories.

    I wonder how difficult it'd be to manipulate the code to display default new to old images.

  6. #26
    Join Date
    Aug 2006
    Location
    UK
    Posts
    449
    Plugin Contributions
    0

    Default Re: Product Listing Default Sort Order

    The listing order for the index page and categories appears to be controlled by the file.. includes/index_filters/default_filter.php - this cannot be overrided.

    This 'hack' seems to work, but will need thorough testing...

    line 101
    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";

    //        $listing_sql .= " order by p.products_sort_order, pd.products_name";
              
    $listing_sql .= " order by p.products_date_added DESC, pd.products_name"
    ~Steve~

  7. #27
    Join Date
    Jan 2009
    Posts
    2,123
    Plugin Contributions
    0

    Default Re: Product Listing Default Sort Order

    s_t_e_v_e, I can't believe you! I think the guru's should take a leaf from your book though.

    You've helped me now with a dozen or so problems and each and every time, you've responded with a one liner and each and every time it's been 100% spot on perfect.

    You've hit the nail on the head here again and it seemed effortless, you're amazing!!

    To summarise then, for anyone who wants the default order of their product listings to be newest-to-oldest then here's all you need do:

    Admin/Product Listing/Product Listing/Display Product Listing Default Sort Order make sure that you edit this and leave it blank... don't put anything in there at all.... (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)

    Now:

    edit /includes/index_filters/default_filter.php:

    replace approx lines 123-129:

    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";
              
    $listing_sql .= " order by p.products_sort_order, pd.products_name";
              break;
            }
          } 
    with this:

    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";
              
    $listing_sql .= " order by p.products_date_added DESC, pd.products_name";
              break;
            }
          } 
    Again Steve, thank you for your time. True genius!!

  8. #28
    Join Date
    Aug 2006
    Location
    UK
    Posts
    449
    Plugin Contributions
    0

    Default Re: Product Listing Default Sort Order

    Glad it worked! and the instructions you've given will help others.
    ~Steve~

  9. #29
    Join Date
    Apr 2008
    Posts
    178
    Plugin Contributions
    0

    Default Re: Product Listing Default Sort Order

    Many thanks S_t_e_v_e and limelites, this also worked for me

  10. #30
    Join Date
    Apr 2009
    Posts
    53
    Plugin Contributions
    0

    Default Re: Product Listing Default Sort Order

    I also have an issue with the product sort order. No matter what setting I put (4a) the listing does not change.

    I checked my default_filter.php file and found some strange comments around almost all of the lines for this:

    // set the default sort order setting from the Admin when not defined by customer
    if (!isset($_GET['sort']) and PRODUCT_LISTING_DEFAULT_SORT_ORDER != '') {
    $_GET['sort'] = PRODUCT_LISTING_DEFAULT_SORT_ORDER;
    }

    if (isset($column_list)) {
    if ((!isset($_GET['sort'])) || (isset($_GET['sort']) && !ereg('[1-8][ad]', $_GET['sort'])) || (substr($_GET['sort'], 0, 1) > sizeof($column_list)) ) {
    for ($i=0, $n=sizeof($column_list); $i<$n; $i++) {
    if (isset($column_list[$i]) && $column_list[$i] == 'PRODUCT_LIST_NAME') {
    $_GET['sort'] = $i+1 . 'a';
    //$listing_sql .= " order by p.products_sort_order, pd.products_name";
    break;
    } else {
    // 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;
    }
    }
    // 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);
    $listing_sql .= ' order by ';
    switch ($column_list[$sort_col-1]) {
    case 'PRODUCT_LIST_MODEL':
    //$listing_sql .= "p.products_model " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name";
    break;
    case 'PRODUCT_LIST_NAME':
    //$listing_sql .= "pd.products_name " . ($sort_order == 'd' ? 'desc' : '');
    break;
    case 'PRODUCT_LIST_MANUFACTURER':
    //$listing_sql .= "m.manufacturers_name " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name";
    break;
    case 'PRODUCT_LIST_QUANTITY':
    //$listing_sql .= "p.products_quantity " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name";
    break;
    case 'PRODUCT_LIST_IMAGE':
    //$listing_sql .= "pd.products_name";
    break;
    case 'PRODUCT_LIST_WEIGHT':
    //$listing_sql .= "p.products_weight " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name";
    break;
    case 'PRODUCT_LIST_PRICE':
    // $listing_sql .= "final_price " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name";
    //$listing_sql .= "p.products_price_sorter " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name";
    break;
    }
    }
    }


    Did TM screw me again? Should I just un comment the lines to fix? errrrrrrrrrrrrrrrr.

    I uncommented the first two instances of:

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

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

    Now it works. Don't you just love it when you figure it out after you've typed up a post?

    But I REALLY want to know why all those other lines are commented out, is this normal!??

 

 
Page 3 of 9 FirstFirst 12345 ... LastLast

Similar Threads

  1. Replies: 14
    Last Post: 22 May 2013, 04:00 AM
  2. All Listing - default sort order
    By only777 in forum General Questions
    Replies: 0
    Last Post: 3 Jul 2009, 08:57 PM
  3. Display Product Listing Default Sort Order
    By SMps in forum General Questions
    Replies: 2
    Last Post: 17 Jan 2009, 08:08 AM
  4. Display Product Listing Default Sort Order
    By Website Rob in forum Setting Up Categories, Products, Attributes
    Replies: 17
    Last Post: 13 Oct 2008, 04:12 PM

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