--- D:/Taf/Kalys/Sites/drupal/sites/all/modules/ubercart/uc_taxes/uc_taxes_original.module Thu Sep 20 10:45:32 2007 +++ D:/Taf/Kalys/Sites/drupal/sites/all/modules/ubercart/uc_taxes/uc_taxes.module Thu Sep 20 14:31:14 2007 @@ -425,15 +425,31 @@ if ((uc_taxes_match_area($rule, $order)) && eval($conditions)){ $rate = $rule->rate; $amount = 0; + $total = 0; $debug = ' ('; if (is_array($order->products)) { foreach($order->products as $item){ $node = node_load($item->nid); if (in_array($node->type, $rule->taxed_product_types)){ - $amount += $item->price * $item->qty * $rate; + $total += $item->price * $item->qty; $debug .= ' + '. $item->price; } } + // Start of uc_discounts implementation + if (module_exists('uc_discounts')) { + $apply_discounts = uc_discounts_apply_discounts(); + + if (empty($apply_discounts)) { + return; + } + $discount_total = 0; + foreach ($apply_discounts as $discount) { + $discount_total -= $discount['amount']; + } + $total += $discount_total; + // End of uc_discounts implementations + } + $amount += $total * $rate; } $debug = substr($debug, 3); $taxed_line_items = $rule->taxed_line_items; @@ -461,6 +477,7 @@ $taxes[$rule->id] = array('id' => $rule->id, 'name' => $rule->name /* . $debug */, 'amount' => $amount, 'weight' => $rule->weight); } } + return $taxes; }