function uc_order_pane_ship_to in Ubercart 7.3
Same name and namespace in other branches
- 5 uc_order/uc_order_order_pane.inc \uc_order_pane_ship_to()
- 6.2 uc_order/uc_order.order_pane.inc \uc_order_pane_ship_to()
Handles the "Ship to" order pane.
1 string reference to 'uc_order_pane_ship_to'
- uc_order_uc_order_pane in uc_order/
uc_order.module - Implements hook_uc_order_pane().
File
- uc_order/
uc_order.order_pane.inc, line 37 - This file contains the callbacks for the default order panes supplied with Ubercart and their corresponding helper functions.
Code
function uc_order_pane_ship_to($op, $order, &$form = NULL, &$form_state = NULL) {
switch ($op) {
case 'customer':
if (!uc_order_is_shippable($order)) {
return;
}
case 'view':
$build = array(
'#markup' => uc_order_address($order, 'delivery') . '<br />' . check_plain($order->delivery_phone),
);
return $build;
case 'edit-form':
$form['ship_to'] = array(
'#type' => 'uc_address',
'#default_value' => $order,
'#required' => FALSE,
'#attributes' => array(
'class' => array(
'uc-store-address-field',
),
),
'#key_prefix' => 'delivery',
);
return $form;
case 'edit-theme':
$output = '<div class="order-pane-icons">';
$output .= ' <img src="' . base_path() . drupal_get_path('module', 'uc_store') . '/images/address_book.gif" alt="' . t('Select from address book.') . '" ' . 'title="' . t('Select from address book.') . '" onclick="load_address_select(' . $form['order_uid']['#value'] . ', \'#delivery_address_select\', \'delivery\');" />';
$output .= ' <img src="' . base_path() . drupal_get_path('module', 'uc_store') . '/images/copy.gif" alt="' . t('Copy billing information.') . '" title="' . t('Copy billing information.') . '" onclick="uc_order_copy_billing_to_shipping();" />';
$output .= '</div>';
$output .= '<div id="delivery_address_select"></div>';
return $output . drupal_render($form['ship_to']);
case 'edit-process':
$changes = array();
foreach ($form_state['values'] as $key => $value) {
if (substr($key, 0, 9) == 'delivery_') {
if (uc_address_field_enabled(substr($key, 9))) {
$changes[$key] = $value;
}
}
}
return $changes;
}
}