You are here

function uc_length_conversion in Ubercart 6.2

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

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

4 calls to uc_length_conversion()
uc_ups_quote in shipping/uc_ups/uc_ups.module
Callback for retrieving a UPS shipping quote.
uc_ups_shipment_request in shipping/uc_ups/uc_ups.ship.inc
Constructs an XML shipment request.
uc_ups_shipping_quote in shipping/uc_ups/uc_ups.module
Construct an XML quote request.
_uc_usps_package_products in shipping/uc_usps/uc_usps.module
Organizes products into packages for shipment.

File

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

Code

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