function uc_quote_action_get_quote in Ubercart 6.2
Same name and namespace in other branches
- 5 shipping/uc_quote/uc_quote.module \uc_quote_action_get_quote()
- 7.3 shipping/uc_quote/uc_quote.pages.inc \uc_quote_action_get_quote()
Retrieves a shipping quote.
Parameters
$order: The order the quote is for.
$method: The shipping method to generate the quote.
Return value
Array of shipping quotes.
3 calls to uc_quote_action_get_quote()
- uc_checkout_pane_quotes in shipping/
uc_quote/ uc_quote.module - Shipping quote checkout pane callback.
- uc_order_pane_quotes in shipping/
uc_quote/ uc_quote.module - Shipping quote order pane callback.
- _uc_quote_assemble_quotes in shipping/
uc_quote/ uc_quote.pages.inc - Pulls the get_quote_from_* triggers and assembles their returned data.
4 string references to 'uc_quote_action_get_quote'
- uc_flatrate_ca_predicate in shipping/
uc_flatrate/ uc_flatrate.module - Implements hook_ca_predicate().
- uc_ups_ca_predicate in shipping/
uc_ups/ uc_ups.module - Implements hook_ca_predicate().
- uc_usps_ca_predicate in shipping/
uc_usps/ uc_usps.module - Implements hook_ca_predicate().
- uc_weightquote_ca_predicate in shipping/
uc_weightquote/ uc_weightquote.module - Implements hook_ca_predicate().
File
- shipping/
uc_quote/ uc_quote.module, line 413 - The controller module for fulfillment modules that process physical goods.
Code
function uc_quote_action_get_quote($order, $method) {
$details = array();
foreach ($order as $key => $value) {
if (substr($key, 0, 9) == 'delivery_') {
$field = substr($key, 9);
$details[$field] = $value;
}
}
ob_start();
// Load include file containing quote callback, if there is one
if (isset($method['quote']['file'])) {
$inc_file = drupal_get_path('module', $method['module']) . '/' . $method['quote']['file'];
if (is_file($inc_file)) {
require_once $inc_file;
}
}
if (function_exists($method['quote']['callback'])) {
// This feels wrong, but it's the only way I can ensure that shipping
// methods won't mess up the products in their methods.
$products = array();
foreach ($order->products as $key => $item) {
if (uc_cart_product_is_shippable($item)) {
$products[$key] = drupal_clone($item);
}
}
$quote_data = call_user_func($method['quote']['callback'], $products, $details, $method);
}
$messages = ob_get_contents();
ob_end_clean();
//drupal_set_message('<pre>'. print_r($quote_data, TRUE) .'</pre>');
if ($messages && variable_get('uc_quote_log_errors', FALSE)) {
watchdog('quote', '!messages', array(
'!messages' => $messages,
), WATCHDOG_WARNING);
watchdog('quote', '<pre>@data</pre>', array(
'@data' => print_r($quote_data, TRUE),
), WATCHDOG_WARNING);
}
return $quote_data;
}