uc_order pane is unable to add any attributes except last one

Project: 
Ubercart
Category: 
bug report
Version: 
Ubercart 1.3
Priority: 
normal
Status: 
patch (needs work)

Our shipping manager realized today that when he creates orders from the admin menu that attributes don't work. Basically it comes down to this code in the uc_order.js:

Line 274:

  $('#uc-order-add-product-form :input').each(
    function() {
      if ($(this).attr('name').substr(0, 10) == 'attributes') {
        post_vars[$(this).attr('name')] = $(this).val();
      }
    }
  );

I ran a debug on this, basically the array is being iterated through, resetting the post_vars attributes value to be the last one to iterate through. A simple addition to make sure the attribute is 'checked' will fix this bug:

  $('#uc-order-add-product-form :input').each(
    function() {
      if ($(this).attr('name').substr(0, 10) == 'attributes' && $(this).attr('checked')) {
        post_vars[$(this).attr('name')] = $(this).val();
      }
    }
  );

Re: uc_order pane is unable to add any attributes except last on

.attr('checked') works on attributes displayed as radio buttons. So while this does fix the problem for them, attributes as a select list don't get added in now. The solution to this problem will also have to handle textfield attributes, too.