You are here

function uc_attribute_cart_item in Ubercart 5

Same name and namespace in other branches
  1. 6.2 uc_attribute/uc_attribute.module \uc_attribute_cart_item()

Implementation of hook_cart_item().

File

uc_attribute/uc_attribute.module, line 353

Code

function uc_attribute_cart_item($op, &$item) {
  switch ($op) {
    case 'load':
      $item->options = _uc_cart_product_get_options($item);
      $op_costs = 0;
      $op_prices = 0;
      $op_weight = 0;
      foreach ($item->options as $option) {
        $op_costs += $option['cost'];
        $op_prices += $option['price'];
        $op_weight += $option['weight'];
      }
      $item->cost += $op_costs;
      $item->price += $op_prices;
      $item->weight += $op_weight;
      if (!empty($item->data['model'])) {
        $item->model = $item->data['model'];
      }
      break;
  }
}