osCommerce and osCMax shopping cart software forums

Shopping Cart Software

osCommerce with teeth!

 
 

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 ...


Go Back   osCommerce and osCMax shopping cart software forums > osCMax v2.0 Forums > osCMax v2 Customization/Mods

Register FAQ Members List Calendar Mark Forums Read


Free community membership! Fast easy FREE membership
Closed Thread

 

LinkBack Thread Tools
  #1  
Old 05-17-2006, 06:07 PM
New Member
 
Join Date: Dec 2004
Posts: 14
Thanks: 0
Thanked 3 Times in 2 Posts
Rep Power: 0
davem
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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Sponsored Links
Advertisement
  #2  
Old 05-17-2006, 08:33 PM
michael_s's Avatar
osCMax Developer

 
Join Date: Jul 2002
Location: Phoenix, AZ
Posts: 10,982
Thanks: 80
Thanked 345 Times in 324 Posts
Rep Power: 10
michael_s has a reputation beyond reputemichael_s has a reputation beyond reputemichael_s has a reputation beyond reputemichael_s has a reputation beyond reputemichael_s has a reputation beyond reputemichael_s has a reputation beyond reputemichael_s has a reputation beyond reputemichael_s has a reputation beyond reputemichael_s has a reputation beyond reputemichael_s has a reputation beyond reputemichael_s has a reputation beyond repute
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 Templates - Hundreds of premium quality templates designed for osCMax 2. Loyalty discounts up to 30% off!
    Each purchase supports the osCMax project with much needed funds!

  • xShop for osCMax - Windows Based osCMax administration. Improved workflow, security, speed and convenience.

  • osCMax Hosting - From basic hosting to High Availability, Load Balanced arrays, the most experienced osCMax host. Default multi server configuration for exceptional performance!

  • osCMax Template Tutorial - Learn how to make your own custom templates and how to use the powerful features of the osCMax template system.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
  #3  
Old 05-18-2006, 03:08 AM
New Member
 
Join Date: Dec 2004
Posts: 14
Thanks: 0
Thanked 3 Times in 2 Posts
Rep Power: 0
davem
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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
  #4  
Old 05-18-2006, 10:03 AM
michael_s's Avatar
osCMax Developer

 
Join Date: Jul 2002
Location: Phoenix, AZ
Posts: 10,982
Thanks: 80
Thanked 345 Times in 324 Posts
Rep Power: 10
michael_s has a reputation beyond reputemichael_s has a reputation beyond reputemichael_s has a reputation beyond reputemichael_s has a reputation beyond reputemichael_s has a reputation beyond reputemichael_s has a reputation beyond reputemichael_s has a reputation beyond reputemichael_s has a reputation beyond reputemichael_s has a reputation beyond reputemichael_s has a reputation beyond reputemichael_s has a reputation beyond repute
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 Templates - Hundreds of premium quality templates designed for osCMax 2. Loyalty discounts up to 30% off!
    Each purchase supports the osCMax project with much needed funds!

  • xShop for osCMax - Windows Based osCMax administration. Improved workflow, security, speed and convenience.

  • osCMax Hosting - From basic hosting to High Availability, Load Balanced arrays, the most experienced osCMax host. Default multi server configuration for exceptional performance!

  • osCMax Template Tutorial - Learn how to make your own custom templates and how to use the powerful features of the osCMax template system.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
  #5  
Old 05-21-2006, 05:33 PM
New Member
 
Join Date: Dec 2004
Posts: 14
Thanks: 0
Thanked 3 Times in 2 Posts
Rep Power: 0
davem
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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Sponsored Links
Advertisement
Closed Thread

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads

Thread Thread Starter Forum Replies Last Post
Anyone use Product Attributes Sort Order? illumn8r osCMax v2 Customization/Mods 3 08-01-2006 06:36 AM
sort order to pot!! moreduff osCMax v1.7 Discussion 0 04-12-2005 05:57 AM
Product Sort Order xtech osCMax v1.7 Discussion 6 04-08-2005 08:49 AM
Change sort order on new products Lord osCommerce 2.2 Modification Help 2 03-23-2005 03:05 AM
Setting Sort Order for Products? sheikyerbouti osCommerce 2.2 Installation Help 6 11-12-2003 11:25 PM


All times are GMT -8. The time now is 01:31 AM.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO
http://www.oscmax.com/forums/
Copyright 2008 osCMax