Results 1 to 5 of 5

Product Sort Order

This is a discussion on Product Sort Order within the osCmax v2 Customization/Mods forums, part of the osCmax v2.0 Forums category; I wanted to give customers the opportunity to sort product listings by price, either low to high or high to ...

      
  1. #1
    New Member
    Join Date
    Dec 2004
    Posts
    14
    Rep Power
    0


    Default Product Sort Order

    I wanted to give customers the opportunity to sort product listings by price, either low to high or high to low. This is not quite as easy as it sounds as some of my products are subject to tax (vat) at 17.5% while others are zero rated. There is also the issue of special prices (again vat on some no vat on others).

    My work around to achieve this included adding a parameter to the query string (which I named pp_so) and modifying the sql along the lines of the one used on the advance search page when min/max prices are included.

    It all seems to work ok but the results can be very slow, particularly is there are quite a few products in a particular category or from a particular manufacturer. This is not surprising as the listing sql needs to select all products and sort them before splitting them into the relevant order/pages.

    As an example of what I mean, please go to:

    www.pramsplus.co.uk

    Select Red Castle from the manufacturers dropdown box in the left column. I have set it up to show the listing_sql used. It will initially use the default (by name) which is fine. If you then select sort by price you will see the revised listing_sql and what I mean about it being slow.

    Can anyone suggest a better way of doing this or how to optimise the sql?

    When the site is finished some categories and manufacturers will have many more products than the number in the example, so my work around will probably be unpractical given the time delays.

    Many thanks

  2. #2
    osCMax Developer

    michael_s's Avatar
    Join Date
    Jul 2002
    Location
    Phoenix, AZ
    Posts
    19,500
    Rep Power
    567


    Default RE: Product Sort Order

    Have you tried adding an index to the products table for the prices? That may help...
    Michael Sasek
    osCMax Developer


    osCmax installation service - Have our professionals install osCmax on your server - same day service!
    osCmax 2.0 User Manual - the must have beginners guide to osCmax v2.0

    Stay Up To Date with everything osCMax:
    Free osCMax Newsletters - Security notices, New Releases, osCMax News
    osCMax on Twitter - Up to the minute info as it happens. Know it first.

    osCmax Documentation

  3. #3
    New Member
    Join Date
    Dec 2004
    Posts
    14
    Rep Power
    0


    Default RE: Product Sort Order

    Michael,

    Thanks for getting back to me. What you suggest is one of the ways I was thinking about going with this. My thoughts were to add a field (say sort_price) to both the products and specials tables. To do it properly I will need to revise the update sql in the relevant admin files so it automatically calculates and inserts the sort price when products are added and/or modified. I also use easypopulate so I would need to modify that as well.

    I was just wondering if anyone with a far better knowledge of sql than me could suggest how to do it "dynamically" with an acceptable load on the server.

    Again, many thanks

  4. #4
    osCMax Developer

    michael_s's Avatar
    Join Date
    Jul 2002
    Location
    Phoenix, AZ
    Posts
    19,500
    Rep Power
    567


    Default RE: Product Sort Order

    I think just adding an index or two to the table, rather than adding a new field should greatly improve the performance. See the mysql website for information on indexing, as it has nothing to do with adding fields or changing sql queries...
    Michael Sasek
    osCMax Developer


    osCmax installation service - Have our professionals install osCmax on your server - same day service!
    osCmax 2.0 User Manual - the must have beginners guide to osCmax v2.0

    Stay Up To Date with everything osCMax:
    Free osCMax Newsletters - Security notices, New Releases, osCMax News
    osCMax on Twitter - Up to the minute info as it happens. Know it first.

    osCmax Documentation

  5. #5
    New Member
    Join Date
    Dec 2004
    Posts
    14
    Rep Power
    0


    Default RE: Product Sort Order

    Michael,

    Many thanks for pointing me in the right direction. Have added a couple of indexes and cleaned up the sql which has much improved the query execution speed.

    For anyone with a pretty basic knowledge of sql (like myself), I found the following article on indexing quite helpful:

    http://www.informit.com/articles/art...77652&rl=1

    Again, many thanks

Similar Threads

  1. Anyone use Product Attributes Sort Order?
    By illumn8r in forum osCmax v2 Customization/Mods
    Replies: 3
    Last Post: 08-01-2006, 06:36 AM
  2. sort order to pot!!
    By moreduff in forum osCmax v1.7 Discussion
    Replies: 0
    Last Post: 04-12-2005, 05:57 AM
  3. Product Sort Order
    By xtech in forum osCmax v1.7 Discussion
    Replies: 6
    Last Post: 04-08-2005, 08:49 AM
  4. Change sort order on new products
    By Lord in forum osCommerce 2.2 Modification Help
    Replies: 2
    Last Post: 03-23-2005, 03:05 AM
  5. Setting Sort Order for Products?
    By sheikyerbouti in forum osCommerce 2.2 Installation Help
    Replies: 6
    Last Post: 11-12-2003, 11:25 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
  •