function uc_addresses_order in Ubercart Addresses 5
Same name and namespace in other branches
- 5.2 uc_addresses.module \uc_addresses_order()
- 6.2 uc_addresses.module \uc_addresses_order()
Use hook_order to add an address or two to the user's address list. For the moment, we save all addresses. I'd like to add an option to let the user select which addresses get saved.
Parameters
$op The operation being performed.:
$arg1 A reference to the order object.:
$arg2 Not used.:
File
- ./
uc_addresses.module, line 503
Code
function uc_addresses_order($op, &$arg1, $arg2) {
if ($op == 'submit' && $arg1->order_status == 'in_checkout') {
$order = $arg1;
$address = new stdClass();
// Add the billing address first. If the user has no addresses,
// this is the one that will become the default address
if (variable_get('uc_pane_billing_enabled', TRUE)) {
$address->address_name = '';
$address->uid = $order->uid;
$address->first_name = $order->billing_first_name;
$address->last_name = $order->billing_last_name;
$address->company = $order->billing_company;
$address->street1 = $order->billing_street1;
$address->street2 = $order->billing_street2;
$address->city = $order->billing_city;
$address->zone = $order->billing_zone;
$address->postal_code = $order->billing_postal_code;
$address->country = $order->billing_country;
$address->phone = $order->billing_phone;
$address->is_default = 0;
_uc_addresses_db_add_address($address, TRUE);
}
if (variable_get('uc_pane_delivery_enabled', TRUE)) {
$address->address_name = '';
$address->uid = $order->uid;
$address->first_name = $order->delivery_first_name;
$address->last_name = $order->delivery_last_name;
$address->company = $order->delivery_company;
$address->street1 = $order->delivery_street1;
$address->street2 = $order->delivery_street2;
$address->city = $order->delivery_city;
$address->zone = $order->delivery_zone;
$address->postal_code = $order->delivery_postal_code;
$address->country = $order->delivery_country;
$address->phone = $order->delivery_phone;
$address->is_default = 0;
_uc_addresses_db_add_address($address, TRUE);
}
}
}