Closed (fixed)
Project:
Ubercart
Version:
6.x-2.0-rc4
Component:
Code
Priority:
Critical
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
30 Jun 2009 at 13:57 UTC
Updated:
1 Sep 2009 at 17:10 UTC
Jump to comment: Most recent file
Comments
Comment #1
rszrama commentedAre you referring to an additional column in the uc_orders table? If so, sounds good to me, and it could be updated just like the order_total column is.
Comment #2
mikejoconnor commentedsubscribe
Comment #3
makara commentedAdding patch for DRUPAL-6--2. Please review.
Comment #4
thill_ commentedThis patch works as expected except it doesn't set the value in the new column for existing orders.
The value is set correctly for new orders after the patch however.
This might not up a requirement of the update function, just noting the results of testing.
Comment #5
Island Usurper commentedI think the update function should populate the column, since all of the necessary data is right there in the database.
Can we call it "product_count"? Unless there's a specific reason to, saying "order product count" sounds redundant to me, and "product_count" is long enough as it is.
Comment #6
makara commentedHi, here is the new patch.
The pre-populate queries should be quick enough, but I'm not sure. Please review.
Comment #7
Island Usurper commentedThanks, makara. I figured out a way to move the summing query outside of the loop, so there are fewer queries running during the update now.
It updated my database correctly, so it's committed.
Comment #8
thill_ commentedSomething went wrong on the update here,
user warning: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE order_id = 1234' at line 1 query: UPDATE uc_orders SET WHERE order_id = 1234
I got this for every single order on the update.php results page.
Comment #9
Island Usurper commentedBlarg! I think something like this happens every time we get to the 4th of the version level.
It turns out that drupal_write_record() is a very bad thing to use right after you change the schema. The schema is cached until the end of the updates, so you either have to clear the cache before you use drupal_write_record(), or just use db_query().
While I'm pretty sure I could rewrite this update to use just one query, I still think it would run for too long on sites with thousands and thousands of orders. So, I've left the queries the way they are and added batch functionality to the update. I also split the updates up since any failed updates due to timeout issues will still add the product_count column in their database.
Comment #10
Island Usurper commentedComment #11
Island Usurper commentedAn actual patch would be good, no?
Comment #12
Island Usurper commentedGot test results from thill_, and I got it to work on a couple of different sites. Committed.