Commit http://drupalcode.org/project/ubercart.git/commitdiff/1fa876f changed the Product kit total price field from a textarea to a uc_price form element. Unfortunately, this breaks the total price behavior.

The "Total price" field is supposed to accept either:
1) a number, in which case the individual product discounts are automatically calculated in order to have the sum of the product prices and discounts equal to the entered total price, or
2) a blank, in which case the total price is automatically calculated from the sum of the product prices and entered discounts.

The uc_price form element breaks behavior #2 because it prevents the user from entering a blank - uc_price interprets the blank as a zero, which forces behavior #1.

Comments

millenniumtree’s picture

Status: Fixed » Active

I've moved my comment to it's own issue http://drupal.org/node/1387638 (unrelated)

millenniumtree’s picture

Version: 6.x-2.x-dev » 7.x-3.x-dev
StatusFileSize
new797 bytes

Please ignore this patch (unrelated to the issue described)

Status: Active » Needs work

The last submitted patch, discount_qty_data_lost-1385950-2.patch, failed testing.

millenniumtree’s picture

Version: 7.x-3.x-dev » 6.x-2.x-dev
millenniumtree’s picture

Version: 7.x-3.x-dev » 6.x-2.x-dev
Status: Active » Needs review
StatusFileSize
new797 bytes

Please ignore this patch (unrelated to the issue described)

Version: 7.x-3.x-dev » 6.x-2.x-dev

The last submitted patch, discount_qty_data_lost-1385950-2.patch, failed testing.

millenniumtree’s picture

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, discount_qty_data_lost-1385950-2.patch, failed testing.

millenniumtree’s picture

Status: Needs review » Needs work

Removed unrelated comment

tr’s picture

Version: 6.x-2.x-dev » 7.x-3.x-dev
Status: Needs work » Active

Please open a NEW issue if you have a different problem than the one described in the original post. We can't possibly properly manage and track threads that try to deal with many different issues at the same time. The original post is a very clear-cut and narrow problem that can be simply addressed if it does not become cluttered with additional irrelevant information. This issue is a 7.x-3.x issue only, and it does not affect 6.x-2.x.

Please open a new 6.x-2.x issue for your patch. The testbot seems to be having problems right now, which is why the test is failing. But you can run the tests on your own machine to see if your patch breaks anything.

wodenx’s picture

Status: Active » Needs review
StatusFileSize
new648 bytes

Does this fix it?

tr’s picture

#empty_zero ? What's that?

Edit: Oh, I see - it's a custom property we defined on the uc_price element. Let me test to see if that works.

tr’s picture

Status: Needs review » Fixed

Yup, that did the trick. Committed to 7.x-3.x.

wodenx’s picture

Status: Fixed » Needs review

uc_store.module, lines 274ff


  $types['uc_price'] = array(
    '#input' => TRUE,
    '#size' => 15,
    '#maxlength' => 15,
    '#autocomplete_path' => FALSE,
    '#process' => array('ajax_process_form'),
    '#element_validate' => array('uc_store_validate_number'),
    '#theme' => 'textfield',
    '#theme_wrappers' => array('form_element'),
    '#field_prefix' => $sign_flag ? '' : $currency_sign,
    '#field_suffix' => $sign_flag ? $currency_sign : '',
    '#allow_negative' => FALSE,
    '#empty_zero' => TRUE,
  );

and 464ff

function form_type_uc_price_value($element, $input = FALSE) {
  if ($input === FALSE && !empty($element['#default_value'])) {
    return uc_store_format_price_field_value($element['#default_value']);
  }
  elseif (empty($input) && empty($element['#required']) && !empty($element['#empty_zero'])) {
    // Empty non-required prices should be treated as zero.
    return 0;
  }
}

looks like that last bit was added pretty recently.

tr’s picture

Status: Needs review » Fixed

Crosspost.

millenniumtree’s picture

Version: 6.x-2.x-dev » 7.x-3.x-dev
Status: Needs work » Fixed

I apologize for cluttering up this issue with an unrelated patch. At first I thought my issue was linked/related to this one - after creating and posting a patch, it became obvious the two were not related, so I've edited all the unrelated comments and moved my issue here http://drupal.org/node/1387638
Trying to help, but I'm fairly new at posting patches. :P

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Anonymous’s picture

Issue summary: View changes

Made commit # into a link.