function uc_quote_cache_quotes in Ubercart 6.2
Same name and namespace in other branches
- 5 shipping/uc_quote/uc_quote.module \uc_quote_cache_quotes()
Pre-render callback added to uc_cart_checkout_form().
Renders the shipping quotes without an asynchronous call to create them if a choice had been cached in the session.
1 string reference to 'uc_quote_cache_quotes'
- uc_quote_form_alter in shipping/
uc_quote/ uc_quote.module - Implements hook_form_alter().
File
- shipping/
uc_quote/ uc_quote.module, line 1134 - The controller module for fulfillment modules that process physical goods.
Code
function uc_quote_cache_quotes($form) {
if ($form['#id'] == 'uc-cart-checkout-form') {
if (isset($_SESSION['quote']) && isset($_SESSION['quote']['rate'])) {
$quote = $_SESSION['quote'];
$form['panes']['quotes']['quote'] = array(
'#type' => 'markup',
'#value' => '<div id="quote" class="solid-border">' . rawurldecode($_SESSION['quote']['quote_form']) . '</div>',
'#weight' => 1,
);
$methods = module_invoke_all('shipping_method');
$method = $methods[$quote['method']];
drupal_add_js('if (Drupal.jsEnabled) { $(document).ready(function() {
$("#quote").find("input:radio[value=' . $quote['method'] . '---' . $quote['accessorials'] . ']").eq(0).change().attr("checked", "checked");
if (window.set_line_item) {
set_line_item("shipping", "' . $method['quote']['accessorials'][$quote['accessorials']] . '", ' . $quote['rate'] . ', 1, 1, false);
}
if (window.getTax) {
getTax();
setTaxCallbacks();
}
else if (window.render_line_items) {
render_line_items();
}
})};', 'inline');
}
else {
$form['panes']['quotes']['quote'] = array(
'#type' => 'markup',
'#value' => '<div id="quote"></div>',
'#weight' => 1,
);
}
}
return $form;
}