You are here

function commerce_avatax_address_suggestion_form in Drupal Commerce Connector for AvaTax 7.4

Same name and namespace in other branches
  1. 7.5 commerce_avatax.module \commerce_avatax_address_suggestion_form()

Returns address suggestion form.

1 string reference to 'commerce_avatax_address_suggestion_form'
commerce_avatax_address_compare in ./commerce_avatax.module
Compare entered address and the address returned by AvaTax.

File

./commerce_avatax.module, line 1121
Calculate Sales Tax using AvaTax service from Avalara, Inc.

Code

function commerce_avatax_address_suggestion_form($form, &$form_state, $original_addr, $suggestions) {
  if (count($suggestions) == 1) {
    $form['info'] = array(
      '#type' => 'markup',
      '#markup' => '<p>' . t('Your shipping address is different from the post office records. We suggest you accept the recommended address to avoid shipping delays.') . '</p>',
    );
  }
  else {
    $form['info'] = array(
      '#type' => 'markup',
      '#markup' => '<p>' . t('Your shipping address is different from the post office records. We suggest you accept one of the recommended addresses to avoid shipping delays.') . '</p>',
    );
  }
  $form['orignal_addr'] = array(
    '#type' => 'markup',
    '#markup' => '<p>' . t('Entered address is:') . '</p>' . theme('commerce_avatax_address', array(
      'address' => $original_addr,
    )),
  );
  $options = array();
  foreach ($suggestions as $addr) {
    $options[] = theme('commerce_avatax_address', array(
      'address' => $addr,
    ));
  }
  $form['addresses'] = array(
    '#title' => t('Recommended address'),
    '#type' => 'radios',
    '#options' => $options,
    '#default_value' => '0',
  );
  return $form;
}