You are here

function uc_varprice_cart_item in UC Variable Price 6

Implementation of hook_cart_item().

File

./uc_varprice.module, line 278
Defines a product feature to turn any product into a variable priced product.

Code

function uc_varprice_cart_item($op, &$item) {

  // When the cart product is being loaded...
  if ($op == 'load') {

    // If the product has a variable price set...
    if (!empty($item->data['varprice'])) {

      // Update the cart item's price to the entered price value.
      list($price, $uniqueness) = explode(':', $item->data['varprice']);
      $price = trim($price);
      $item->price = trim($price);

      // If a uniqueness string has been attached to the price, append it to the item's title.
      if ($uniqueness) {
        $item->title .= ": " . trim($uniqueness);
      }
    }
  }
}