# This patch file was generated by NetBeans IDE
# This patch can be applied using context Tools: Apply Diff Patch action on respective folder.
# It uses platform neutral UTF-8 encoding.
# Above lines and this line are ignored by the patching process.
--- C:\delo\breznik\wampMSS\www\drupal\sites\all\modules\uc_discounts_alt\uc_discounts.module
+++ C:\delo\breznik\wampMSS\www\drupal\sites\all\modules\uc_discounts_alt\uc_discounts\uc_discounts.module
@@ -289,6 +289,28 @@
 }
 
 /**
+ * Returns the price for a product including Tax, if using uc_vat module
+ *
+ * @param object $item
+ */
+function get_uc_price($item)
+{
+  $price_info = array(
+    'price' => $item->price,
+    'qty' => $item->qty,
+  );
+  $context = array(
+    'type' => 'cart_item',
+    'revision' => 'altered',
+    'subject' => array(
+      'cart_item' => $item,
+      'node' => node_load($item->nid),
+    ),
+  );
+  return uc_price($price_info, $context);
+}
+
+/**
  * Implementation of hook_cart_pane().
  *
  * @see hook_cart_pane()
@@ -314,7 +336,7 @@
   //Calculate subtotal with discounts
   $subtotal = 0;
   if (is_array($items)) {
-    foreach ($items as $item) $subtotal += $item->price * $item->qty;
+    foreach ($items as $item) $subtotal += get_uc_price($item);
   }
   $total_discount_amount = 0;
   if (is_array($discounts)) {
@@ -1000,7 +1022,7 @@
       }
 
       uc_discounts_add_to_existing_map_number_value($order_product_id_subtotal_map,
-        $nid, $product->price * $product->qty
+        $nid, get_uc_price($product)
       );
       uc_discounts_add_to_existing_map_number_value($order_product_id_quantity_map, $nid, $product->qty);
 
@@ -1011,7 +1033,7 @@
       $a[] = $product;
       $order_product_id_product_array_map[$nid] = $a;
 
-      $order_subtotal += $product->price * $product->qty;
+      $order_subtotal += get_uc_price($product);
     }
     if (is_array($kits) &&  !empty($kits)) {
       foreach ($kits as $kit_id => $value) {
@@ -1509,7 +1531,7 @@
         if (count($discount_product_ids) > 0) {
           $discounted_products_amount = 0;
           foreach ($order_and_discount_products as $product) {
-            $discounted_products_amount += $product->price * $product->qty;
+            $discounted_products_amount += get_uc_price($product);
           }
           $discount->amount = $discounted_products_amount * $discount->discount_amount;
           // Discount the subtotal so far
