function uc_discounts_add_to_existing_map_number_value in Ubercart Discounts (Alternative) 7.2
Same name and namespace in other branches
- 6.2 uc_discounts/uc_discounts.module \uc_discounts_add_to_existing_map_number_value()
Add discount key and value to array.
This will add the key and value if the key does not exists. If the key exists then the value of the discount will be combine with the existing value.
Parameters
array $a: Array of discount values.
string $key: The discount key.
float $value: The discount value.
1 call to uc_discounts_add_to_existing_map_number_value()
- uc_discounts_get_discounts_for_order in uc_discounts/
uc_discounts.module - Returns discounts for order.
File
- uc_discounts/
uc_discounts.module, line 2495
Code
function uc_discounts_add_to_existing_map_number_value(&$a, $key, $value) {
$a[$key] = array_key_exists($key, $a) ? $a[$key] + $value : $value;
}