You are here

function uc_attribute_order_product_alter in Ubercart 6.2

Implements hook_order_product_alter().

File

uc_attribute/uc_attribute.module, line 522

Code

function uc_attribute_order_product_alter(&$product, $order) {

  // Convert the attribute and option ids to their current names. This
  // preserves the important data in case the attributes or options are
  // changed later.
  if (!empty($product->data['attributes'])) {
    $attributes_keys = array_keys($product->data['attributes']);
    if (is_numeric(array_shift($attributes_keys))) {
      $attributes = array();
      $options = _uc_cart_product_get_options($product);
      foreach ($options as $aid => $option) {
        $attributes[$option['attribute']][$option['oid']] = $option['name'];
      }
      $product->data['attributes'] = $attributes;
    }
  }
}