| Project: | Ubercart Contributions |
| Component: | Code |
| Category: | |
| Priority: | normal |
| Assigned: | oliver coleman |
| Status: | patch (needs review) |
Jump to:
When a product kit is created with some products selected, the price of the kit is always set to 0 when it's first submitted. If the kit is then edited the discount values are set to 0, so unless they're edited the kit price will remain at 0. If they're deleted (empty string), then the kit price will become the sum of the contained products.
I'm guessing what should happen when the product is first submitted (without the discount values being set because the product option forms don't show until the kit is submitted, see this issue) is that it should default to the price of the product and not 0.
Rather than setting it to the product price in the database (which then wouldn't be updated if the product price is updated later on), may I suggest leaving it at 0 and slightly modifying the behaviour of the discount option such that entering 0 will cause it to use the item price with no discount.
This requires changing in uc_product_kit on line 130:
if ($node->items[$i]['discount'] < 0){
to
if ($node->items[$i]['discount'] <= 0){
on line 307:
'#description' => t('Enter a negative value to lower the item price by that amount. Enter a postive value to set the item price to that amount. This discount is applied to each %product in the kit.', array('%product' => $product->title)),
to
'#description' => t('Enter a negative value to lower (discount) the item price by that amount. Enter 0 to use the item price with no discount. Enter a positive value to set the item price to that amount in this kit. This is applied to each %product in the kit.', array('%product' => $product->title)),
and on line 504:
if ($kit_discount < 0){
to
if ($kit_discount <= 0){
This changes the behaviour so that a discount value of 0 will simply be subtracted from the item price for the kit (so the item price will be used as is) rather than setting the item price to 0 in the kit.


