Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Bug in Quantity Price Breaks Per Product?


Recommended Posts

Posted

I have a client with over 2500 items in their catalog. The sysadmin hosting the site contacted us with an urgent request to fix a script which was returning the entire 2500 record result set, and was grinding the server down. Upon investigation, I found it was in the PriceFormatter::loadProduct() method. The query in this method has a couple of left outer joins, the second of which isn't sufficiently constrained, so it returns all the records.

 

I'm not 100% certain, but I think PriceFormatter.php comes from the above-captioned contribution at:

 

http://www.oscommerce.com/community/contributions,1242

 

To fix this problem, simply replace the last line of the query with this:

 

"   and pd.language_id = '". (int)$language_id ."'" .
"   and p2c.products_id = '". (int)$product_id ."'";

 

We're basicly just adding the p2c constraint, and that causes the query to return a single record, which is what we're looking for.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...