You are here

function uc_weight_conversion in Ubercart 5

Same name and namespace in other branches
  1. 8.4 uc_store/uc_store.module \uc_weight_conversion()
  2. 6.2 uc_store/uc_store.module \uc_weight_conversion()
  3. 7.3 uc_store/uc_store.module \uc_weight_conversion()
9 calls to uc_weight_conversion()
uc_order_condition_products_weight in uc_order/uc_order_workflow.inc
uc_product_kit_insert in uc_product_kit/uc_product_kit.module
Implementation of hook_insert().
uc_product_kit_update in uc_product_kit/uc_product_kit.module
Implementation of 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 1914
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;
  }
}