uc_paypal_ec_review_form

Versions
5
uc_paypal_ec_review_form($order)
6
uc_paypal_ec_review_form($form_state, $order)

Code

contributions/ubercart/payment/uc_paypal/uc_paypal.module, line 972

<?php
function uc_paypal_ec_review_form($order) {
  if (module_exists('uc_quote') && variable_get('uc_paypal_ec_review_shipping', TRUE) && uc_order_is_shippable($order)) {
    $result = uc_checkout_pane_quotes('view', $order, NULL);
    $form['panes']['quotes'] = array(
      '#type' => 'fieldset',
      '#title' => t('Calculate shipping'),
      '#collapsible' => FALSE,
    );
    $form['panes']['quotes'] += $result['contents'];
    $form['panes']['quotes']['quote_button']['#value'] = t('Click to refresh shipping options');

    $form['panes']['quotes']['quote_div'] = array(
      '#value' => '<div id="quote"></div>',
    );

    uc_add_js("\$(document).ready(function() { \$(' #edit-quote-button').click(); });", 'inline');

    // Fake the checkout form delivery information.
    $form['delivery_first_name'] = array('#type' => 'hidden', '#value' => $order->delivery_first_name);
    $form['delivery_last_name'] = array('#type' => 'hidden', '#value' => $order->delivery_last_name);
    $form['delivery_company'] = array('#type' => 'hidden', '#value' => $order->delivery_company);
    $form['delivery_street1'] = array('#type' => 'hidden', '#value' => $order->delivery_street1);
    $form['delivery_street2'] = array('#type' => 'hidden', '#value' => $order->delivery_street2);
    $form['delivery_city'] = array('#type' => 'hidden', '#value' => $order->delivery_city);
    $form['delivery_postal_code'] = array('#type' => 'hidden', '#value' => $order->delivery_postal_code);
    $form['delivery_phone'] = array('#type' => 'hidden', '#value' => $order->delivery_phone);
    $form['delivery_zone'] = array(
      '#type' => 'select',
      '#options' => drupal_map_assoc(array($order->delivery_zone)),
      '#default_value' => $order->delivery_zone,
      '#attributes' => array('style' => 'display: none;'),
    );
    $form['delivery_country'] = array(
      '#type' => 'select',
      '#options' => drupal_map_assoc(array($order->delivery_country)),
      '#default_value' => $order->delivery_country,
      '#attributes' => array('style' => 'display: none;'),
    );

    $form['shippable'] = array('#type' => 'hidden', '#value' => 'true');
  }

  if (variable_get('uc_paypal_ec_review_company', TRUE)) {
    $form['delivery_company'] = array(
      '#type' => 'textfield',
      '#title' => uc_get_field_name('company'),
      '#description' => uc_order_is_shippable($order) ? t('Leave blank if shipping to a residence.') : '',
      '#default_value' => $order->delivery_company,
    );
  }

  if (variable_get('uc_paypal_ec_review_phone', TRUE)) {
    $form['delivery_phone'] = array(
      '#type' => 'textfield',
      '#title' => t('Contact phone number'),
      '#default_value' => $order->delivery_phone,
      '#size' => 24,
    );
  }

  if (variable_get('uc_paypal_ec_review_comment', TRUE)) {
    $form['order_comments'] = array(
      '#type' => 'textarea',
      '#title' => t('Order comments'),
      '#description' => t('Special instructions or notes regarding your order.'),
    );
  }

  if (empty($form)) {
    drupal_goto('cart/echeckout/submit');
  }

  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Continue checkout'),
  );

  return $form;
}
?>

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.
  • You may post code using <code>...</code> (generic) or <?php ... ?> (highlighted PHP) tags.
  • Web page addresses and e-mail addresses turn into links automatically.

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
Image CAPTCHA
Enter the characters shown in the image.