function uc_order_product_save in Ubercart 6.2
Same name and namespace in other branches
- 8.4 uc_order/uc_order.module \uc_order_product_save()
- 5 uc_order/uc_order.module \uc_order_product_save()
- 7.3 uc_order/uc_order.module \uc_order_product_save()
Save a product to an order.
3 calls to uc_order_product_save()
- uc_order_edit_products in uc_order/
uc_order.admin.inc - Populates 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.
- uc_product_kit_order_product_alter in uc_product_kit/
uc_product_kit.module - Implements hook_order_product_alter().
File
- uc_order/
uc_order.module, line 1169
Code
function uc_order_product_save($order_id, $product) {
// Product kits, particularly, shouldn't actually be added to an order,
// but instead they cause other products to be added.
if (isset($product->skip_save) && $product->skip_save == TRUE) {
return;
}
// Update if there is an order_product_id, insert if there isn't.
$key = empty($product->order_product_id) ? NULL : 'order_product_id';
// @TODO order_id should be in the object by this point.
$product->order_id = $order_id;
return drupal_write_record('uc_order_products', $product, $key);
}