Closed (won't fix)
Project:
Ubercart
Version:
6.x-2.4
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
24 Feb 2011 at 13:46 UTC
Updated:
13 Dec 2013 at 04:37 UTC
Jump to comment: Most recent
E.g
I have 2 products. Both have no price on them. They both also have attributes/options, also with no price.
I create a product kit to group them into one item on the shopping cart and I give this kit a price.
When I save I get the following message (twice because I have 2 products in the kit).
warning: Division by zero in /uc_product_kit/uc_product_kit.module on line 256.
It seems like it doesn't like the product price of 0.00
If I change this to 1.00 (in the 2 products) it will then work.
Comments
Comment #1
longwaveBetter title.
Comment #2
tr commentedSo you normally sell the two products for $0 each but when they are bundled together you charge a price for the kit?
Comment #3
tr commentedI need to hear more from you to determine whether this is a use case that we intend to support. Products in kits have to be published, which means they can be sold individually. You're clearly not intending that if you set your product prices to zero. The notion behind product kits is that you can bundle products and offer the kit at a discount when compared to the unbundled products. What you're trying to do instead is to sell the kit for *more* than the unbundled products, which breaks the fundamental assumption this module is built on. It will require a lot of changes if we can't make that assumption. So, if you expect a change here please make a case for what you're trying to do and why you can't do it another way.
I'm leaning towards just handling the divide by zero with message saying the products can't have zero price, rather than trying to properly deal with zero price products.
Comment #4
griz commentedOn editing a product kit I get the error:
warning: Division by zero in /var/aegir/drupal-6/sites/example.co.uk/modules/ubercart/uc_product_kit/uc_product_kit.module on line 544.The SKU is lost, the price is zeroed and the customer is blown a kiss:
That's a lovely sentiment, but I'm not planning on being quite that nice to my customers.
In my case both the products have a price, and I had assigned an overall price to the kit.
Comment #5
griz commentedOn correcting this with another edit I got:
user warning: Duplicate entry '304' for key 'PRIMARY' query: INSERT INTO uc_products (vid, nid, model, list_price, cost, sell_price, weight, weight_units, default_qty, unique_hash, ordering, shippable) VALUES (304, 304, 'MA454 / MA454A', 0, 0, 45, 0, 'kg', 0, '9f1d5505a88447e15ba8307acc4ec410', 0, 1) in /var/aegir/drupal-6/sites/lathes.co.uk/modules/ubercart/uc_product_kit/uc_product_kit.module on line 315.Is there a reason INSERT is used so often in Drupal as opposed to REPLACE?
Comment #6
longwaveREPLACE is not part of the SQL standard and does not work in (for example) PostgreSQL.
Comment #7
griz commentedAh, that would explain that then. Thanks.
Comment #8
tr commented@griz: Your issue is not that same as the original poster's. The 'Duplicate entry' bug you're reporting is the subject of a different issue: #641430: user warning: Duplicate entry in uc_product_kit.module on line 351. Perhaps you can contribute to that thread to help it get resolved.
Comment #9
longwaveNo response from the original poster, assuming this is no longer a problem and does not need to be fixed.
Comment #10
tr commentedRestoring status "Closed (won't fix)" which was reset by the automated site upgrade.