function uc_order_pane_ship_to in Ubercart 6.2
Same name and namespace in other branches
- 5 uc_order/uc_order_order_pane.inc \uc_order_pane_ship_to()
- 7.3 uc_order/uc_order.order_pane.inc \uc_order_pane_ship_to()
Handles the "Ship to" order pane.
1 call to uc_order_pane_ship_to()
- uc_shipping_address_form in shipping/
uc_shipping/ uc_shipping.module - Helper function for addresses in forms.
1 string reference to 'uc_order_pane_ship_to'
- uc_order_order_pane in uc_order/
uc_order.module - Implements hook_order_pane().
File
- uc_order/
uc_order.order_pane.inc, line 16 - 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, $arg1) {
switch ($op) {
case 'customer':
if (!uc_order_is_shippable($arg1)) {
return;
}
case 'view':
$output = uc_order_address($arg1, 'delivery') . '<br />' . check_plain($arg1->delivery_phone);
return $output;
case 'edit-form':
$form['ship_to'] = array(
'#type' => 'fieldset',
'#title' => t("Modify 'Ship to' information"),
'#collapsible' => TRUE,
'#collapsed' => FALSE,
);
if (uc_address_field_enabled('first_name')) {
$form['ship_to']['delivery_first_name'] = uc_textfield(uc_get_field_name('first_name'), $arg1->delivery_first_name, FALSE);
}
if (uc_address_field_enabled('last_name')) {
$form['ship_to']['delivery_last_name'] = uc_textfield(uc_get_field_name('last_name'), $arg1->delivery_last_name, FALSE);
}
if (uc_address_field_enabled('phone')) {
$form['ship_to']['delivery_phone'] = uc_textfield(uc_get_field_name('phone'), $arg1->delivery_phone, FALSE, NULL, 32, 16);
}
if (uc_address_field_enabled('company')) {
$form['ship_to']['delivery_company'] = uc_textfield(uc_get_field_name('company'), $arg1->delivery_company, FALSE, NULL, 64);
}
if (uc_address_field_enabled('street1')) {
$form['ship_to']['delivery_street1'] = uc_textfield(uc_get_field_name('street1'), $arg1->delivery_street1, FALSE, NULL, 64);
}
if (uc_address_field_enabled('street2')) {
$form['ship_to']['delivery_street2'] = uc_textfield(uc_get_field_name('street2'), $arg1->delivery_street2, FALSE, NULL, 64);
}
if (uc_address_field_enabled('city')) {
$form['ship_to']['delivery_city'] = uc_textfield(uc_get_field_name('city'), $arg1->delivery_city, FALSE);
}
if (uc_address_field_enabled('country')) {
$form['ship_to']['delivery_country'] = uc_country_select(uc_get_field_name('country'), $arg1->delivery_country);
}
if (uc_address_field_enabled('zone')) {
if (isset($_POST['delivery_country'])) {
$country_id = intval($_POST['delivery_country']);
}
else {
$country_id = $arg1->delivery_country;
}
$form['ship_to']['delivery_zone'] = uc_zone_select(uc_get_field_name('zone'), $arg1->delivery_zone, NULL, $country_id);
}
if (uc_address_field_enabled('postal_code')) {
$form['ship_to']['delivery_postal_code'] = uc_textfield(uc_get_field_name('postal_code'), $arg1->delivery_postal_code, FALSE, NULL, 10, 10);
}
return $form;
case 'edit-title':
$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(' . $arg1['order_uid']['#value'] . ', \'#delivery_address_select\', \'delivery\');" ' . 'style="position: relative; top: 2px; cursor: pointer;" />';
$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();" ' . 'style="position: relative; top: 2px; cursor: pointer;" />';
return $output;
case 'edit-theme':
$output = '<div id="delivery_address_select"></div><table class="order-edit-table">';
foreach (element_children($arg1['ship_to']) as $field) {
$title = $arg1['ship_to'][$field]['#title'];
$arg1['ship_to'][$field]['#title'] = NULL;
$output .= '<tr><td class="oet-label">' . $title . ':</td><td>' . drupal_render($arg1['ship_to'][$field]) . '</td></tr>';
}
$output .= '</table>';
return $output;
case 'edit-process':
$changes = array();
foreach ($arg1 as $key => $value) {
if (substr($key, 0, 9) == 'delivery_') {
if (uc_address_field_enabled(substr($key, 9))) {
$changes[$key] = $value;
}
}
}
return $changes;
}
}