function uc_order_product_save in Ubercart 5
Same name and namespace in other branches
- 8.4 uc_order/uc_order.module \uc_order_product_save()
- 6.2 uc_order/uc_order.module \uc_order_product_save()
- 7.3 uc_order/uc_order.module \uc_order_product_save()
Function to save a product to an order.
3 calls to uc_order_product_save()
- uc_importer_orders in uc_importer/
uc_importer.module - Specific order importer for a certain osCommerce site.
- uc_order_edit_products in uc_order/
uc_order.module - Populate the product add/edit div on the order edit screen.
- uc_order_save in uc_order/
uc_order.module - Save an order to the database.
File
- uc_order/
uc_order.module, line 2536
Code
function uc_order_product_save($order_id, $product) {
if (!$product->order_product_id) {
$product->order_product_id = db_next_id('{uc_order_products}_order_product_id');
}
db_query("UPDATE {uc_order_products} SET order_id = %d, nid = %d, qty = %d, cost = %f, price = %f, title = '%s', manufacturer = '%s', model = '%s', weight = %f, data = '%s' WHERE order_product_id = %d", $order_id, $product->nid, $product->qty, $product->cost, $product->price, $product->title, $product->manufacturer, $product->model, $product->weight, serialize($product->data), $product->order_product_id);
if (!db_affected_rows()) {
db_query("INSERT INTO {uc_order_products} (order_product_id, order_id, nid, qty, cost, price, title, manufacturer, model, weight, data) " . "VALUES (%d, %d, %d, %d, %f, %f, '%s', '%s', '%s', %f, '%s')", $product->order_product_id, $order_id, $product->nid, $product->qty, $product->cost, $product->price, $product->title, $product->manufacturer, $product->model, $product->weight, serialize($product->data));
}
}