uc_store.module in Ubercart 8.4
Same filename and directory in other branches
Contains global Ubercart functions and store administration functionality.
The store module is a container of sorts for various helper functions used in different parts of the Ubercart core. It also provides screens and settings pages for use in store administration.
File
uc_store/uc_store.moduleView source
<?php
/**
* @file
* Contains global Ubercart functions and store administration functionality.
*
* The store module is a container of sorts for various helper functions used
* in different parts of the Ubercart core. It also provides screens and
* settings pages for use in store administration.
*/
use Drupal\Component\Serialization\Json;
use Drupal\Component\Utility\Unicode;
use Drupal\Core\Routing\RouteMatchInterface;
use Drupal\Core\Link;
use Drupal\Core\Url;
use Drupal\uc_store\Address;
use Drupal\user\UserInterface;
/**
* Weight unit conversion constants, used by uc_weight_conversion().
*/
/**
* Converts kilograms to kilograms.
*/
define('UC_STORE_KG_TO_KG', 1);
/**
* Converts kilograms to grams.
*/
define('UC_STORE_KG_TO_G', 1000);
/**
* Converts kilograms to pounds.
*/
define('UC_STORE_KG_TO_LB', 2.204622621849);
/**
* Converts kilograms to ounces.
*/
define('UC_STORE_KG_TO_OZ', 35.27396194958);
/**
* Converts grams to grams.
*/
define('UC_STORE_G_TO_G', 1);
/**
* Converts grams to kilograms.
*/
define('UC_STORE_G_TO_KG', 0.001);
/**
* Converts grams to pounds.
*/
define('UC_STORE_G_TO_LB', 0.002204622622);
/**
* Converts grams to ounces.
*/
define('UC_STORE_G_TO_OZ', 0.03527396195);
/**
* Converts pounds to pounds.
*/
define('UC_STORE_LB_TO_LB', 1);
/**
* Converts pounds to ounces.
*/
define('UC_STORE_LB_TO_OZ', 16);
/**
* Converts pounds to kilograms.
*/
define('UC_STORE_LB_TO_KG', 0.45359237);
/**
* Converts pounds to grams.
*/
define('UC_STORE_LB_TO_G', 453.59237);
/**
* Converts ounces to ounces.
*/
define('UC_STORE_OZ_TO_OZ', 1);
/**
* Converts ounces to pounds.
*/
define('UC_STORE_OZ_TO_LB', 0.0625);
/**
* Converts ounces to kilograms.
*/
define('UC_STORE_OZ_TO_KG', 0.028349523);
/**
* Converts ounces to grams.
*/
define('UC_STORE_OZ_TO_G', 28.349523125);
/**
* Length unit conversion constants, used by uc_length_conversion().
*/
/**
* Converts inches to inches.
*/
define('UC_STORE_IN_TO_IN', 1);
/**
* Converts inches to feet.
*/
define('UC_STORE_IN_TO_FT', 0.083333333333);
/**
* Converts inches to centimeters.
*/
define('UC_STORE_IN_TO_CM', 2.54);
/**
* Converts inches to millimeters.
*/
define('UC_STORE_IN_TO_MM', 25.4);
/**
* Converts feet to feet.
*/
define('UC_STORE_FT_TO_FT', 1);
/**
* Converts feet to inches.
*/
define('UC_STORE_FT_TO_IN', 12);
/**
* Converts feet to centimeters.
*/
define('UC_STORE_FT_TO_CM', 30.48);
/**
* Converts feet to millimeters.
*/
define('UC_STORE_FT_TO_MM', 304.8);
/**
* Converts centimeters to centimeters.
*/
define('UC_STORE_CM_TO_CM', 1);
/**
* Converts centimeters to inches.
*/
define('UC_STORE_CM_TO_IN', 0.393700787402);
/**
* Converts centimeters to feet.
*/
define('UC_STORE_CM_TO_FT', 0.03280839895);
/**
* Converts centimeters to millimeters.
*/
define('UC_STORE_CM_TO_MM', 10);
/**
* Converts millimeters to millimeters.
*/
define('UC_STORE_MM_TO_MM', 1);
/**
* Converts millimeters to inches.
*/
define('UC_STORE_MM_TO_IN', 0.03937007874);
/**
* Converts millimeters to feet.
*/
define('UC_STORE_MM_TO_FT', 0.003280839895);
/**
* Converts millimeters to centimeters.
*/
define('UC_STORE_MM_TO_CM', 0.1);
/**
* Implements hook_page_attachments().
*/
function uc_store_page_attachments(&$page) {
$page['#attached']['library'][] = 'uc_store/uc_store.styles';
}
/**
* Implements hook_theme().
*/
function uc_store_theme() {
return [
'uc_price' => [
'variables' => [
'price' => 0,
'suffixes' => [],
],
'template' => 'uc-price',
],
'uc_qty' => [
'variables' => [
'qty' => 1,
],
'template' => 'uc-qty',
],
];
}
/**
* Prepares variables for the price template.
*
* Default template: uc-price.html.twig.
*/
function template_preprocess_uc_price(&$variables) {
$variables['price'] = uc_currency_format($variables['price']);
}
/**
* Implements hook_help().
*/
function uc_store_help($route_name, RouteMatchInterface $route_match) {
switch ($route_name) {
case 'help.page.uc_store':
$output = '<h3>' . t('Ubercart') . '</h3>';
$output .= '<p>' . t('Use the following links to find documentation and support:') . '</p>';
$output .= '<ul>';
$output .= '<li>' . Link::fromTextAndUrl(t("Ubercart User's Guide"), Url::fromUri('https://www.drupal.org/docs/8/modules/ubercart'))
->toString() . '</li>';
$output .= '<li>' . Link::fromTextAndUrl(t('Support Forums'), Url::fromUri('http://www.ubercart.org/forum'))
->toString() . '</li>';
$output .= '</ul>';
return $output;
case 'uc_store.reports':
$output = '<p>' . t('Various reports generated by Ubercart modules may be found on this page. Click the links below to view the reports.') . '</p>';
if (!\Drupal::moduleHandler()
->moduleExists('uc_report')) {
$output .= '<p>' . t('To view core Ubercart statistics enable the <strong>Report</strong> module on the <a href=":url">module administration page</a>.', [
':url' => Url::fromRoute('system.modules_list', [], [
'fragment' => 'edit-modules-ubercart-core-optional',
])
->toString(),
]) . '</p>';
}
return $output;
}
}
/**
* Formats an amount for display with the store's currency settings.
*
* @param float $value
* The numeric value of the currency amount.
* @param string $symbol
* The currency symbol. If FALSE is given, no symbol is used. The default,
* NULL, causes the configuration variable 'currency.symbol' to be used, which
* defaults to '$'.
* @param string $thou
* The thousands separator character. If FALSE is given, no separator is used.
* The default, NULL, causes the configuration variable
* 'currency.thousands_marker' to be used, which defaults to ','.
* @param string $dec
* The decimal separator character. If FALSE is given, confusion will abound,
* because it will look 100 times bigger. The default, NULL, causes the
* configuration variable 'currency.decimal_marker' to be used, which
* defaults to '.'.
*
* @return string
* String containing price formatted with currency symbol and separators.
*/
function uc_currency_format($value, $symbol = NULL, $thou = NULL, $dec = NULL) {
if ($value === NULL) {
return NULL;
}
$output = '';
$config = \Drupal::config('uc_store.settings')
->get('currency');
$symbol_after = $config['symbol_after'];
$prec = $config['precision'];
if (is_null($symbol)) {
$symbol = $config['symbol'];
}
if (is_null($thou)) {
$thou = $config['thousands_marker'];
}
if (is_null($dec)) {
$dec = $config['decimal_marker'];
}
// If the value is significantly less than the minimum precision, zero it.
if ($prec > 0 && round(abs($value), $prec + 1) < pow(10, -$prec)) {
$value = 0;
}
// Force the price to a positive value and add a negative sign if necessary.
if ($value < 0) {
$value = abs($value);
$output .= '-';
}
// Add the currency symbol first if specified.
if ($symbol && !$symbol_after) {
$output .= $symbol;
}
// Format the number, like 1234.567 => 1,234.57
$output .= number_format($value, $prec, $dec, $thou);
// Add the currency symbol last if specified.
if ($symbol && $symbol_after) {
$output .= $symbol;
}
return $output;
}
/**
* Formats a weight value for display.
*
* @param float $value
* Numerical weight value.
* @param string $unit
* Weight unit. One of 'lb', 'oz', 'kg', or 'g', or NULL to use store
* default weight units.
* @param string $thou
* The thousands separator character. If FALSE is given, no separator is used.
* The default, NULL, causes the configuration variable
* 'weight.thousands_marker' to be used, which defaults to ','.
* @param string $dec
* The decimal separator character. If FALSE is given, confusion will abound,
* because it will look 100 times bigger. The default, NULL, causes the
* configuration variable 'weight.decimal_marker' to be used, which
* defaults to '.'.
*
* @return string
* String containing formatted weight, including weight units.
*/
function uc_weight_format($value, $unit = NULL, $thou = NULL, $dec = NULL) {
$output = '';
$config = \Drupal::config('uc_store.settings')
->get('weight');
$prec = $config['precision'];
if (is_null($unit)) {
$unit = $config['units'];
}
if (is_null($thou)) {
$thou = $config['thousands_marker'];
}
if (is_null($dec)) {
$dec = $config['decimal_marker'];
}
// If the value is significantly less than the minimum precision, zero it.
if ($prec > 0 && round(abs($value), $prec + 1) < pow(10, -$prec)) {
$value = 0;
}
// Force the weight to a positive value and add a negative sign if necessary.
if ($value < 0) {
$value = abs($value);
$output .= '-';
}
// Format the number, like 1234.567 => 1,234.57
$output .= number_format($value, $prec, $dec, $thou);
// Add the units last.
switch ($unit) {
case 'lb':
return t('@value lb.', [
'@value' => $output,
]);
case 'oz':
return t('@value oz.', [
'@value' => $output,
]);
case 'kg':
return t('@valuekg', [
'@value' => $output,
]);
case 'g':
return t('@valueg', [
'@value' => $output,
]);
default:
return $value;
}
}
/**
* Gets the conversion ratio from one unit of weight to another.
*/
function uc_weight_conversion($from_units, $to_units = NULL) {
if (is_null($to_units)) {
$to_units = \Drupal::config('uc_store.settings')
->get('weight.units');
}
$constant = 'UC_STORE_' . strtoupper($from_units) . '_TO_' . strtoupper($to_units);
if (defined($constant) && ($conversion = constant($constant)) > 0) {
return $conversion;
}
else {
return 1;
}
}
/**
* Formats a length value for display.
*
* @param float $value
* Numerical length value.
* @param string $unit
* Length unit. One of 'ft', 'in', 'cm', or 'mm', or NULL to use store
* default length units.
* @param string $thou
* The thousands separator character. If FALSE is given, no separator is used.
* The default, NULL, causes the configuration variable
* 'length.thousands_marker' to be used, which defaults to ','.
* @param string $dec
* The decimal separator character. If FALSE is given, confusion will abound,
* because it will look 100 times bigger. The default, NULL, causes the
* configuration variable 'length.decimal_marker' to be used, which
* defaults to '.'.
*
* @return string
* String containing formatted length, including length units.
*/
function uc_length_format($value, $unit = NULL, $thou = NULL, $dec = NULL) {
$output = '';
$config = \Drupal::config('uc_store.settings')
->get('length');
$prec = $config['precision'];
if (is_null($unit)) {
$unit = $config['units'];
}
if (is_null($thou)) {
$thou = $config['thousands_marker'];
}
if (is_null($dec)) {
$dec = $config['decimal_marker'];
}
// If the value is significantly less than the minimum precision, zero it.
if ($prec > 0 && round(abs($value), $prec + 1) < pow(10, -$prec)) {
$value = 0;
}
// Force the length to a positive value and add a negative sign if necessary.
if ($value < 0) {
$value = abs($value);
$output .= '-';
}
// Format the number, like 1234.567 => 1,234.57
$output .= number_format($value, $prec, $dec, $thou);
// Add the units last.
switch ($unit) {
case 'in':
return t('@valuein.', [
'@value' => $output,
]);
case 'ft':
return t('@valueft.', [
'@value' => $output,
]);
case 'cm':
return t('@valuecm', [
'@value' => $output,
]);
case 'mm':
return t('@valuemm', [
'@value' => $output,
]);
}
}
/**
* Gets the conversion ratio from one unit of length to another.
*/
function uc_length_conversion($from_units, $to_units = NULL) {
if (is_null($to_units)) {
$to_units = \Drupal::config('uc_store.settings')
->get('length.units');
}
$constant = 'UC_STORE_' . strtoupper($from_units) . '_TO_' . strtoupper($to_units);
if (defined($constant) && ($conversion = constant($constant)) > 0) {
return $conversion;
}
else {
return 1;
}
}
/**
* Returns TRUE if the address field is enabled.
*/
function uc_address_field_enabled($field = NULL) {
return (bool) \Drupal::config('uc_store.settings')
->get("address_fields.{$field}.status");
}
/**
* Creates an address select box based on a user's previous orders.
*
* @param $uid
* The user's ID to search for in the orders table.
* @param string $type
* Choose either 'shipping' or 'billing'.
*/
function uc_select_address($uid, $type = 'billing', $onchange = '', $title = NULL) {
$addresses = uc_get_addresses($uid, $type);
if (!is_array($addresses) || count($addresses) == 0) {
return NULL;
}
$options = [
'0' => t('Select one...'),
];
foreach ($addresses as $key => $address) {
$option = $address['street1'];
// Check if the address is a duplicate (i.e. same address, but sent to
// different person).
if (isset($addresses[$key - 1]) && $option == $addresses[$key - 1]['street1'] || isset($addresses[$key + 1]) && $option == $addresses[$key + 1]['street1']) {
$option .= ' - ' . $address['first_name'] . ' ' . $address['last_name'];
}
$options[Json::encode($address)] = $option;
}
$select = [
'#type' => 'select',
'#title' => is_null($title) ? t('Address book') : $title,
'#options' => $options,
'#attributes' => [
'onchange' => $onchange,
],
];
return $select;
}
/**
* Creates an address select box based on a user's previous orders.
*
* @param int $uid
* The user's ID to search for in the orders table.
* @param string $type
* Choose either 'shipping' or 'billing'.
*
* @return array
* An array of address options.
*/
function uc_select_addresses($uid, $type = 'billing') {
$addresses = uc_get_addresses($uid, $type);
if (empty($addresses)) {
return [];
}
$options = [
-1 => t('Select one...'),
];
foreach ($addresses as $key => $address) {
$option = $address['street1'];
// Check if the address is a duplicate (i.e. same address, but sent to
// different person).
if (isset($addresses[$key - 1]) && $option == $addresses[$key - 1]['street1'] || isset($addresses[$key + 1]) && $option == $addresses[$key + 1]['street1']) {
$option .= ' - ' . $address['first_name'] . ' ' . $address['last_name'];
}
$options[$key] = $option;
}
$addresses['#options'] = $options;
return $addresses;
}
/**
* Loads a customer's previously given addresses.
*/
function uc_get_addresses($uid, $type = 'billing') {
if ($uid == 0) {
return NULL;
}
if ($type == 'delivery') {
$type = 'delivery';
}
else {
$type = 'billing';
}
$connection = \Drupal::database();
$query = $connection
->select('uc_orders', 'o')
->distinct();
$alias = [];
$alias['first_name'] = $query
->addField('o', $type . '_first_name', 'first_name');
$alias['last_name'] = $query
->addField('o', $type . '_last_name', 'last_name');
$alias['phone'] = $query
->addField('o', $type . '_phone', 'phone');
$alias['company'] = $query
->addField('o', $type . '_company', 'company');
$alias['street1'] = $query
->addField('o', $type . '_street1', 'street1');
$alias['street2'] = $query
->addField('o', $type . '_street2', 'street2');
$alias['city'] = $query
->addField('o', $type . '_city', 'city');
$alias['zone'] = $query
->addField('o', $type . '_zone', 'zone');
$alias['postal_code'] = $query
->addField('o', $type . '_postal_code', 'postal_code');
$alias['country'] = $query
->addField('o', $type . '_country', 'country');
$active = \Drupal::entityQuery('uc_order_status')
->condition('weight', 0, '>=')
->execute();
// In pgsql, ORDER BY requires the field being sorted by to be in the SELECT
// list. But if we have the 'created' column in the SELECT list, the DISTINCT
// is rather useless. So we will just sort addresses alphabetically.
$query
->condition('uid', $uid)
->condition('order_status', $active, 'IN')
->orderBy($alias['street1']);
$result = $query
->execute();
$addresses = [];
while ($address = $result
->fetchAssoc()) {
if (!empty($address['street1']) || !empty($address['postal_code'])) {
$addresses[] = $address;
}
}
return $addresses;
}
/**
* Returns the store name.
*/
function uc_store_name() {
return \Drupal::config('uc_store.settings')
->get('name');
}
/**
* Returns the user-defined store address.
*
* @return \Drupal\uc_store\AddressInterface
* An Address object.
*/
function uc_store_address() {
$config = \Drupal::config('uc_store.settings');
$address = Address::create($config
->get('address'));
$address
->setCompany($config
->get('name'));
return $address;
}
/**
* Returns the store e-mail address if set, otherwise the site email address.
*/
function uc_store_email() {
$email_from = \Drupal::config('uc_store.settings')
->get('mail');
if (empty($email_from)) {
$email_from = \Drupal::config('system.site')
->get('mail');
}
if (empty($email_from)) {
$email_from = ini_get('sendmail_from');
}
return $email_from;
}
/**
* Returns store name and e-mail address in an RFC 2822 compliant string.
*
* The return string is intended for use as a "From" address when sending
* e-mail to customers. It will look something like:
* Store Name <store@example.com>
*
* @return string
* An RFC 2822 compliant e-mail address.
*/
function uc_store_email_from() {
$email_from = uc_store_email();
// Add the store name to the e-mail "From" line.
// Must be optional to prevent server conflicts.
if (\Drupal::config('uc_store.settings')
->get('mail_include_name')) {
$email_from = uc_store_rfc2822_display_name(uc_store_name()) . ' <' . $email_from . '>';
}
return $email_from;
}
/**
* Turns a text string into a valid RFC 2822 quoted string.
*
* Any text string not consisting of a limited set of valid characters
* (notable printable non-valid characters include ',' and '.') needs
* to be quoted in order to be used an an e-mail header such as the "From"
* address. Double quotes in the original string are escaped (and nothing else).
*
* @param string $name
* The text string to convert to a RFC 2822 quoted string.
*
* @return string
* A valid RFC 2822 quoted string.
*/
function uc_store_rfc2822_display_name($name) {
// Base64 encode $name string if it contains non-ASCII characters.
$name = Unicode::mimeHeaderEncode($name);
// From RFC2822, section 3.4.2, define valid characters for an atom.
$valid_chars = "[a-zA-Z0-9\\!\\#\$\\%\\&\\'\\*\\+\\-\\/\\=\\?\\^\\_\\`\\{\\|\\}\\~]";
// Display name is composed of 0 or more atoms separated by white space.
if (!preg_match("/^({$valid_chars}*[ \t]*)*\$/", $name)) {
return '"' . addcslashes($name, '"') . '"';
}
return $name;
}
/**
* Derives a valid username from an e-mail address.
*
* @param string $email
* An e-mail address.
*
* @return string
* A username derived from the e-mail address, using the part of the address
* up to the @ with integers appended to the end if needed to avoid a
* duplicate username.
*/
function uc_store_email_to_username($email) {
// Default to the first part of the e-mail address.
$name = mb_substr($email, 0, mb_strpos($email, '@'));
// Remove possible illegal characters.
$name = preg_replace('/[^A-Za-z0-9_.-]/', '', $name);
// Trim that value for spaces and length.
$name = trim(mb_substr($name, 0, UserInterface::USERNAME_MAX_LENGTH - 4));
// Make sure we don't hand out a duplicate username.
while (user_load_by_name($name)) {
// If the username got too long, trim it back down.
if (mb_strlen($name) == UserInterface::USERNAME_MAX_LENGTH) {
$name = mb_substr($name, 0, UserInterface::USERNAME_MAX_LENGTH - 4);
}
// Append a random integer to the name.
$name .= rand(0, 9);
}
return $name;
}
/**
* Logs encryption errors to watchdog.
*
* @param $crypt
* The object used to perform your encryption/decryption.
* @param $module
* The module name to specify in the watchdog notices.
*/
function uc_store_encryption_errors(&$crypt, $module) {
$errors = $crypt
->getErrors();
if (!empty($errors)) {
foreach ($errors as $message) {
$items[] = $message;
}
\Drupal::logger('encryption')
->error('Encryption failed.');
// @todo Fix formatting of logger message.
//\Drupal::logger('encryption')->error('Encryption failed. @messages', ['@messages' => drupal_render(['#theme' => 'item_list', '#items' => $items])]);
}
}
/**
* Returns a default store country value.
*
* @return string
* The two character country code representing the store default.
*/
function uc_store_default_country() {
return \Drupal::config('uc_store.settings')
->get('address.country');
}
/**
* Gets the preferred language code for a user's email address.
*
* @param string $address
* The email address to check.
*
* @return string
* The language code to be used in translation, localization, etc. If a user
* account can not be found for $address, the default language code is
* returned.
*
* @see LanguageManagerInterface::getDefaultLanguage()
*/
function uc_store_mail_recipient_langcode($address) {
$account = user_load_by_mail(trim($address));
return $account ? $account
->getPreferredLangcode() : \Drupal::languageManager()
->getDefaultLanguage()
->getId();
}
/**
* Executes hook_uc_form_alter() implementations.
*
* API function to invoke hook_uc_form_alter() implementations allowing those
* modules to alter the form before the Drupal layer hook_form_alter() is
* invoked.
*
* @see hook_uc_form_alter()
*/
function uc_form_alter(&$form, &$form_state, $form_id) {
\Drupal::moduleHandler()
->alter('uc_form', $form, $form_state, $form_id);
}
/**
* Implements hook_uc_store_status().
*/
function uc_store_uc_store_status() {
$messages = [];
// @todo Does it make sense to check for updated config files (check uuid?)
// How else do we know if Ubercart has corrected country data? Wouldn't want
// to hook_update it I don't think, because then we'd overwrite any site
// customizations. Leaving this as a dead code block for now...
$country_names = \Drupal::service('country_manager')
->getEnabledList();
$updates = [];
if (!$country_names) {
$messages[] = [
'status' => 'error',
'title' => t('Countries'),
'desc' => t('No countries are enabled. You may enable countries on the <a href=":url">country settings</a> page.', [
':url' => Url::fromRoute('entity.uc_country.collection')
->toString(),
]),
];
}
elseif (count($updates)) {
// This will always == FALSE.
$messages[] = [
'status' => 'warning',
'title' => t('Countries'),
'desc' => t('Updates are available for the following installed countries: %countries. You may update these countries on the <a href=":url">country settings</a> page.', [
'%countries' => implode(', ', $updates),
':url' => Url::fromRoute('entity.uc_country.collection')
->toString(),
]),
];
}
else {
$messages[] = [
'status' => 'ok',
'title' => t('Countries'),
'desc' => t('Country definitions are up-to-date.'),
];
}
// Check to see if the store e-mail address has been set.
if (!\Drupal::config('uc_store.settings')
->get('mail')) {
$messages[] = [
'status' => 'error',
'title' => t('Store settings'),
'desc' => t('Store e-mail address has not been set. Please enter it on the <a href=":url">store settings</a> page.', [
':url' => Url::fromRoute('uc_store.config_form')
->toString(),
]),
];
}
else {
$messages[] = [
'status' => 'ok',
'title' => t('Store settings'),
'desc' => t('Store e-mail address is set.'),
];
}
return $messages;
}
Functions
Name | Description |
---|---|
template_preprocess_uc_price | Prepares variables for the price template. |
uc_address_field_enabled | Returns TRUE if the address field is enabled. |
uc_currency_format | Formats an amount for display with the store's currency settings. |
uc_form_alter | Executes hook_uc_form_alter() implementations. |
uc_get_addresses | Loads a customer's previously given addresses. |
uc_length_conversion | Gets the conversion ratio from one unit of length to another. |
uc_length_format | Formats a length value for display. |
uc_select_address | Creates an address select box based on a user's previous orders. |
uc_select_addresses | Creates an address select box based on a user's previous orders. |
uc_store_address | Returns the user-defined store address. |
uc_store_default_country | Returns a default store country value. |
uc_store_email | Returns the store e-mail address if set, otherwise the site email address. |
uc_store_email_from | Returns store name and e-mail address in an RFC 2822 compliant string. |
uc_store_email_to_username | Derives a valid username from an e-mail address. |
uc_store_encryption_errors | Logs encryption errors to watchdog. |
uc_store_help | Implements hook_help(). |
uc_store_mail_recipient_langcode | Gets the preferred language code for a user's email address. |
uc_store_name | Returns the store name. |
uc_store_page_attachments | Implements hook_page_attachments(). |
uc_store_rfc2822_display_name | Turns a text string into a valid RFC 2822 quoted string. |
uc_store_theme | Implements hook_theme(). |
uc_store_uc_store_status | Implements hook_uc_store_status(). |
uc_weight_conversion | Gets the conversion ratio from one unit of weight to another. |
uc_weight_format | Formats a weight value for display. |
Constants
Name | Description |
---|---|
UC_STORE_CM_TO_CM | Converts centimeters to centimeters. |
UC_STORE_CM_TO_FT | Converts centimeters to feet. |
UC_STORE_CM_TO_IN | Converts centimeters to inches. |
UC_STORE_CM_TO_MM | Converts centimeters to millimeters. |
UC_STORE_FT_TO_CM | Converts feet to centimeters. |
UC_STORE_FT_TO_FT | Converts feet to feet. |
UC_STORE_FT_TO_IN | Converts feet to inches. |
UC_STORE_FT_TO_MM | Converts feet to millimeters. |
UC_STORE_G_TO_G | Converts grams to grams. |
UC_STORE_G_TO_KG | Converts grams to kilograms. |
UC_STORE_G_TO_LB | Converts grams to pounds. |
UC_STORE_G_TO_OZ | Converts grams to ounces. |
UC_STORE_IN_TO_CM | Converts inches to centimeters. |
UC_STORE_IN_TO_FT | Converts inches to feet. |
UC_STORE_IN_TO_IN | Converts inches to inches. |
UC_STORE_IN_TO_MM | Converts inches to millimeters. |
UC_STORE_KG_TO_G | Converts kilograms to grams. |
UC_STORE_KG_TO_KG | Converts kilograms to kilograms. |
UC_STORE_KG_TO_LB | Converts kilograms to pounds. |
UC_STORE_KG_TO_OZ | Converts kilograms to ounces. |
UC_STORE_LB_TO_G | Converts pounds to grams. |
UC_STORE_LB_TO_KG | Converts pounds to kilograms. |
UC_STORE_LB_TO_LB | Converts pounds to pounds. |
UC_STORE_LB_TO_OZ | Converts pounds to ounces. |
UC_STORE_MM_TO_CM | Converts millimeters to centimeters. |
UC_STORE_MM_TO_FT | Converts millimeters to feet. |
UC_STORE_MM_TO_IN | Converts millimeters to inches. |
UC_STORE_MM_TO_MM | Converts millimeters to millimeters. |
UC_STORE_OZ_TO_G | Converts ounces to grams. |
UC_STORE_OZ_TO_KG | Converts ounces to kilograms. |
UC_STORE_OZ_TO_LB | Converts ounces to pounds. |
UC_STORE_OZ_TO_OZ | Converts ounces to ounces. |