function commerce_usps_commerce_shipping_service_rate_options_alter in Commerce USPS 7.2
Implements hook_commerce_shipping_service_rate_options_alter().
File
- ./
commerce_usps.module, line 305 - Defines the USPS shipping method and services for Drupal Commerce.
Code
function commerce_usps_commerce_shipping_service_rate_options_alter(&$options, $order) {
// If the display USPS logo next to USPS services is enabled in settings,
// loop through the shipping options and add the USPS logo to USPS services.
if (variable_get('commerce_usps_show_logo', FALSE)) {
$image = drupal_get_path('module', 'commerce_usps') . '/images/usps-logo.png';
if (file_exists($image)) {
$services = commerce_usps_service_list();
foreach ($options as $key => &$option) {
if (in_array(drupal_strtolower($key), array_keys($services['domestic'])) || in_array(drupal_strtolower($key), array_keys($services['international']))) {
$option = theme('image', array(
'path' => $image,
)) . ' ' . $option;
}
}
}
}
}