You are here

function uc_weight_conversion in Ubercart 6.2

Same name and namespace in other branches
  1. 8.4 uc_store/uc_store.module \uc_weight_conversion()
  2. 5 uc_store/uc_store.module \uc_weight_conversion()
  3. 7.3 uc_store/uc_store.module \uc_weight_conversion()

Gets the conversion ratio from one unit of weight to another.

9 calls to uc_weight_conversion()
uc_order_condition_products_weight in uc_order/uc_order.ca.inc
Checkt the weight of the order's products.
uc_product_kit_insert in uc_product_kit/uc_product_kit.module
Implements hook_insert().
uc_product_kit_update in uc_product_kit/uc_product_kit.module
Implements hook_update().
uc_shipping_package_load in shipping/uc_shipping/uc_shipping.module
Load a package and its products.
uc_ups_quote in shipping/uc_ups/uc_ups.module
Callback for retrieving a UPS shipping quote.

... See full list

File

uc_store/uc_store.module, line 988
Contains global Ubercart functions and store administration functionality.

Code

function uc_weight_conversion($from_units, $to_units = NULL) {
  if (is_null($to_units)) {
    $to_units = variable_get('uc_weight_unit', 'lb');
  }
  $constant = strtoupper($from_units) . '_TO_' . strtoupper($to_units);
  if (defined($constant) && ($conversion = constant($constant)) > 0) {
    return $conversion;
  }
  else {
    return 1;
  }
}