function uc_quote_condition_order_shipping_method in Ubercart 7.3
Same name and namespace in other branches
- 5 shipping/uc_quote/uc_quote.module \uc_quote_condition_order_shipping_method()
- 6.2 shipping/uc_quote/uc_quote.module \uc_quote_condition_order_shipping_method()
Checks an order's shipping method.
1 string reference to 'uc_quote_condition_order_shipping_method'
- uc_quote_rules_condition_info in shipping/
uc_quote/ uc_quote.rules.inc - Implements hook_rules_condition_info().
File
- shipping/
uc_quote/ uc_quote.rules.inc, line 28 - Rules hooks for uc_quote.module.
Code
function uc_quote_condition_order_shipping_method($order, $method) {
// Check the easy way first.
if (!empty($order->quote)) {
return $order->quote['method'] == $method;
}
// Otherwise, look harder.
if (!empty($order->line_items)) {
$methods = module_invoke_all('uc_shipping_method');
$accessorials = $methods[$method]['quote']['accessorials'];
foreach ($order->line_items as $line_item) {
if ($line_item['type'] == 'shipping' && in_array($line_item['title'], $accessorials)) {
return TRUE;
}
}
}
return FALSE;
}