function uc_order_save in Ubercart 5
Same name and namespace in other branches
- 6.2 uc_order/uc_order.module \uc_order_save()
- 7.3 uc_order/uc_order.module \uc_order_save()
Save an order to the database.
6 calls to uc_order_save()
- uc_2checkout_complete in payment/
uc_2checkout/ uc_2checkout.module - uc_cart_checkout_form_validate in uc_cart/
uc_cart.module - uc_order_edit_form_submit in uc_order/
uc_order.module - uc_paypal_ec_form_submit in payment/
uc_paypal/ uc_paypal.module - uc_paypal_ec_review in payment/
uc_paypal/ uc_paypal.module
1 string reference to 'uc_order_save'
- uc_order_entity_info in uc_order/
uc_order_workflow.inc
File
- uc_order/
uc_order.module, line 2485
Code
function uc_order_save($order) {
if (is_null($order->order_id) || intval($order->order_id) == 0) {
return FALSE;
}
db_query("UPDATE {uc_orders} SET host = '%s', uid = %d, order_status = '%s', order_total = %f, primary_email = '%s', " . "delivery_first_name = '%s', delivery_last_name = '%s', delivery_phone = '%s', " . "delivery_company = '%s', delivery_street1 = '%s', delivery_street2 = '%s', " . "delivery_city = '%s', delivery_zone = %d, delivery_postal_code = '%s', delivery_country = %d, " . "billing_first_name = '%s', billing_last_name = '%s', billing_phone = '%s', " . "billing_company = '%s', billing_street1 = '%s', billing_street2 = '%s', " . "billing_city = '%s', billing_zone = %d, billing_postal_code = '%s', billing_country = %d, " . "payment_method = '%s', data = '%s', modified = %d WHERE order_id = %d", $_SERVER['REMOTE_ADDR'], $order->uid, $order->order_status, uc_order_get_total($order), $order->primary_email, $order->delivery_first_name, $order->delivery_last_name, $order->delivery_phone, $order->delivery_company, $order->delivery_street1, $order->delivery_street2, $order->delivery_city, $order->delivery_zone, $order->delivery_postal_code, is_null($order->delivery_country) || $order->delivery_country == 0 ? variable_get('uc_store_country', 840) : $order->delivery_country, $order->billing_first_name, $order->billing_last_name, $order->billing_phone, $order->billing_company, $order->billing_street1, $order->billing_street2, $order->billing_city, $order->billing_zone, $order->billing_postal_code, is_null($order->billing_country) || $order->billing_country == 0 ? variable_get('uc_store_country', 840) : $order->billing_country, $order->payment_method, serialize($order->data), time(), $order->order_id);
// Review this query for removal in the future. -RS
db_query("DELETE FROM {uc_order_products} WHERE order_id = %d", $order->order_id);
if (is_array($order->products)) {
foreach ($order->products as $product) {
if (module_exists('uc_attribute') && empty($order->modified)) {
$attributes = array();
$options = _uc_cart_product_get_options($product);
foreach ($options as $aid => $option) {
$attributes[$option['attribute']] = $option['name'];
}
$product->data['attributes'] = $attributes;
}
uc_order_product_save($order->order_id, $product);
}
}
// Invoke hook_order() in enabled modules.
foreach (module_implements('order') as $module) {
$func = $module . '_order';
$null = NULL;
$func('save', $order, $null);
}
}