function get_existing_discount_line_items in Ubercart Discounts (Alternative) 6.2
Returns existing discounts line items for order.
1 call to get_existing_discount_line_items()
- uc_discounts_apply in uc_discounts/
uc_discounts.module - Applies the discounts to an order by creating the necessary line items.
File
- uc_discounts/
uc_discounts.module, line 2074
Code
function get_existing_discount_line_items($order) {
if (is_array($order->line_items)) {
$existing_line_items = $order->line_items;
}
else {
$existing_line_items = uc_order_load_line_items($order, TRUE);
}
$line_items = array();
foreach ($existing_line_items as $line_item) {
//If line item type is LINE_ITEM_KEY_NAME, add it to array
if ($line_item["type"] == LINE_ITEM_KEY_NAME) {
$line_items[] = $line_item;
}
}
return $line_items;
}