Right after we updated the Ubercart module to 2.10, our product kit module did strange things. First, if you add one item to the kit and save, the total price stays the same. If you change the total price manually, you get an appropriate number added or subtracted to/from the price of the one item showing on the "edit" page.
If you add another item to the kit, not only does the product kit "total price" change on its own but the +/- amount starts changing drastically with every save of the item.
Example:
Product A price = $5.00
Product B price = $1.00
When product B is added to the kit, the total price changes on it's own to $15.00. The product A price gets an offset (discount) of $+7.50. The product B price gets an offset of $+$1.50.
If you click SAVE again, the total price changes to $45.00. The product A offset changes to $+32.50 and product B changes to $+6.50.
I think this is a script problem vs a database problem.
Please advise.
Comments
Comment #1
stg11 CreditAttribution: stg11 commentedI'm having the same problem. My discounted $16.00 product comes out $18.67. I had to change the input price to $13.71 to get it to come out to $16.00.
Comment #2
stg11 CreditAttribution: stg11 commentedThis looks like a bug to me so I'm changing support request to a bug report.
In the above comment I had to change the price to $19.00 and no matter what I put in I couldn't get it to that round number. Please help resolve this issue. Everything worked fine on the prior release.
Comment #3
omih85 CreditAttribution: omih85 commentedsubscribing
Comment #4
Rainman CreditAttribution: Rainman commentedAlso experiencing this issue, specifically setting total price lower than individual item totals does not take and results in unexpected price increase over original price.
Comment #5
rjlang CreditAttribution: rjlang commentedThis is a bug in uc_product_kit.module. The value of $base_price (undiscounted price total) is being improperly computed, which then throws off the discount calculation.
You can patch it with the following. Beginning at line 240 of uc_product_kit.module, replace the lines
with
That's not the most efficient fix (because each product object may now be loaded twice), but it's simple and works.
Robert
Comment #6
longwaveThis code was changed in #1387638: Product discount & qty blanked when product in kit is updated but was faulty. Thanks for posting the fix, I've committed it to solve this issue. The code in uc_product_kit_update() is pretty ugly and really needs a rewrite, but that can be done some other time; preferably with tests to prove that kits with total prices, discounts, etc. are all proven to work correctly.
Comment #7
dpatte CreditAttribution: dpatte commentedThe fix in #5 did not work for me, unfortunately.
Comment #8
longwaveCan you give an example of how you have a product kit set up, with details of all prices and discounts involved, what you see, and what you expect to see?
Comment #9
longwaveIf I revert the fix in #5 and run the new tests added in #1840260: Add product kit tests they fail, showing that the fix in #5 was correct. I also can't reproduce any discount problems manually.
@dpatte: If this is still an issue for you, please ensure you are running 6.x-2.x-dev, and give full details of the product kit that has incorrect pricing.
Comment #10
dpatte CreditAttribution: dpatte commentedSorry for the delay. I applied the fix manually to ubercart 2.10, not dev.
Comment #11
DanZ CreditAttribution: DanZ commentedIn #6, he says that he committed the fix. That means that it is already in the -dev release. To get this fix, install 6.x-2.x-dev. Do not apply a patch.
Comment #12
dpatte CreditAttribution: dpatte commentedI just installed the latest dev, and this seems to resolve my issue. Thanks guys!