Results 1 to 9 of 9
  1. #1
    Join Date
    Mar 2009
    Posts
    435
    Plugin Contributions
    0

    Default how can I sort products into assending price order in one category only?

    is there a way to sort products in particular categories so that they appear on the product listing page from lowest to highest price or vice versa.
    I'm aware there may be an option in admin for this to be applied for products in all categories but we do not want this, we want to be able to only apply this to one category at the moment.

    I know I could achieve this by manually giving the products in this category a number in order to sort them into lowest up to highest price but this would take ages as I'd have to note down which is cheapeast then the next highest etc etc and give them a number in relation to this, which would take forever and I day in this particular category as there's so many products.

    If anyone has any idea of how you can sort them into price order just in one category id be most grateful.

    Many thanks

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

    Default Re: how can I sort products into assending price order in one category only?

    You could customize the default_filter.php where it is set, when not set by the customer:
    Code:
    // 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;
      }
    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
    Mar 2009
    Posts
    435
    Plugin Contributions
    0

    Default Re: how can I sort products into assending price order in one category only?

    hi thanks for your response, which file would I need to edit and what would I need to put in, i really dont know. Also would this only affect one category as ive requested?

    P.s

    I have an urgent issue I have posted about already that im wondering if you can help with...If you see at the bottom of every page, theres a blue tool bar with the link 'home' id also like to add in a link called 'top of page' but I really have no idea which file I need to edit to put this in, if you could help me on this id be forever grateful!

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

    Default Re: how can I sort products into assending price order in one category only?

    You need to edit the file:
    /includes/index_filters/default_filter.php

    Where the code is that I posted you need to test for the current categories_id and change the sort order, when the customer has not set a sort order to use the one needed for price, if it is the category that you want sorted by price ...

    The code I posted is where the sort order is set to the default sort order setting when the customer has not changed the sort order themselves ...

    Without actually seeing your site it is hard to guess what settings are needed to manage this as I do not know the categories_id that you want to sort by price nor do I know the sort setting for the price column on your site ...
    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
    Mar 2009
    Posts
    435
    Plugin Contributions
    0

    Default Re: how can I sort products into assending price order in one category only?

    Hi, thanks again for your reply, my site is at http://www.thegreatgiftshop.co.uk/zencart hope you can help a bit more now from seeing this.

    Tahnk you very much indeed.

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

    Default Re: how can I sort products into assending price order in one category only?

    Let's say you want categories_id 10 to sort by Price but all the others to use your default setting ...

    You can customize the code to read:
    Code:
    // bof: set sort order to Price for categories_id 10 when sort order is not set by customer
      if (!isset($_GET['sort']) and $current_category_id == 10) {
        $_GET['sort'] = '3a';
      }
    // eof: set sort order to Price for categories_id 10 when sort order is not set by customer
    
    // 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;
      }
    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
    Posts
    435
    Plugin Contributions
    0

    Default Re: how can I sort products into assending price order in one category only?

    Ah I see, ok thank you so much! I'll try that asap.

  8. #8
    Join Date
    Mar 2009
    Posts
    435
    Plugin Contributions
    0

    Default Re: how can I sort products into assending price order in one category only?

    Brilliant, thats just the job, inserted that code a couple of times so that two categories I wanted are now sorted lowest to highest by default on the product listing.

    Thanks!

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

    Default Re: how can I sort products into assending price order in one category only?

    Thanks for the update that this is now working for you to manage to sort 2 of your categories in a different manner than the default sort on the listings ...
    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!

 

 

Similar Threads

  1. I like to sort one product into more than one category
    By soso838 in forum Setting Up Categories, Products, Attributes
    Replies: 4
    Last Post: 5 Jun 2012, 05:31 PM
  2. Replies: 0
    Last Post: 1 Jul 2009, 05:02 PM
  3. Product Sort Order By price in Category
    By qadir03 in forum Basic Configuration
    Replies: 6
    Last Post: 8 Jan 2007, 04:33 PM
  4. Sort Order products by price within category
    By manage-it in forum General Questions
    Replies: 0
    Last Post: 22 May 2006, 02:52 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