Attribute names are correct but selected options do not show up in report. Found a comment in a different ubercart module (uc_who_bought_what) that there was a change in attributes storage in ubercart 6.x-2.0-rc6.

Comments

cayenne’s picture

Here is the pertinent code fix from the WHo Bought What module.

  $mydata=unserialize($customer['OrderData']);
  if (!is_null($attrlist)){
    foreach ($attrlist as $myattrib) { 
      $thisdatum = $mydata['attributes'][$myattrib['data']];
      if (is_array($thisdatum) == 1) {   //Since UC 6.x-2.0-rc6, attributes are stored as arrays just in case there is more than one selected.
      $temparray[] = implode(' | ', $thisdatum);
    } else {$temparray[] = $thisdatum;}
  }

The issue is that old orders' attributes are not an array, but the new ones are. Yep, life is interesting.

cayenne’s picture

After a mildly embarrassing foray into not reading the instructions, I have made a simple change that appears to address the problem. I'd make a patch, but my patches never seem to work.

Replace line 386 ( $option_rows[] = t('@attribute: @option', array('@attribute' => $attribute, '@option' => $option));)with the following code:

if(is_array($option)){
   $option_rows[] = t('@attribute: @option', array('@attribute' => $attribute, '@option' => implode($option, ' | ')));
 }
 else {
   $option_rows[] = t('@attribute: @option', array('@attribute' => $attribute, '@option' => $option));
}

Thus, if it's old code, it works as before, and if the order was placed under the new code, it's unparsed as an array with vertical bars between.

Rene Hostettler’s picture

Thanks for the fix Cayenne worked for me. Was getting lots of not htmlentiy errors as well now all attribute names displaying correctly