You are here

function uc_product_token_values in Ubercart 5

Same name and namespace in other branches
  1. 6.2 uc_product/uc_product.module \uc_product_token_values()

Provide product token values.

File

uc_product/uc_product.module, line 986
The product module for Ubercart.

Code

function uc_product_token_values($type, $object = NULL, $options = array()) {
  if ($type == 'node' && uc_product_is_product($object)) {
    $tokens = array();
    $tokens['model'] = $object->model;
    $tokens['list_price'] = $object->list_price;
    $tokens['cost'] = $object->cost;
    $tokens['sell_price'] = $object->sell_price;
    $tokens['weight_units'] = $object->weight_units;
    $tokens['weight-raw'] = $object->weight;
    $tokens['weight'] = uc_weight_format($object->weight, $object->weight_units);
    $tokens['length_units'] = $object->length_units;
    $tokens['length-raw'] = $object->length;
    $tokens['length'] = uc_length_format($object->length, $object->length_units);
    $tokens['width-raw'] = $object->width;
    $tokens['width'] = uc_length_format($object->width, $object->length_units);
    $tokens['height-raw'] = $object->height;
    $tokens['height'] = uc_length_format($object->height, $object->length_units);
    return $tokens;
  }
}