You are here

function uc_quote_cache_quotes in Ubercart 5

Same name and namespace in other branches
  1. 6.2 shipping/uc_quote/uc_quote.module \uc_quote_cache_quotes()
1 string reference to 'uc_quote_cache_quotes'
uc_quote_form_alter in shipping/uc_quote/uc_quote.module
Implementation of hook_form_alter().

File

shipping/uc_quote/uc_quote.module, line 1336
The controller module for fulfillment modules that process physical goods.

Code

function uc_quote_cache_quotes($form_id, &$form) {
  if ($form_id == 'uc_cart_checkout_form') {
    if (isset($_SESSION['quote']) && $_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']];
      uc_add_js('$(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,
      );
    }
  }
}