? uc_minpercentrate.module_1.patch
Index: uc_minpercentrate.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/uc_minpercentrate/uc_minpercentrate.module,v
retrieving revision 1.12
diff -u -p -r1.12 uc_minpercentrate.module
--- uc_minpercentrate.module	8 Feb 2010 02:27:09 -0000	1.12
+++ uc_minpercentrate.module	5 Oct 2010 07:53:10 -0000
@@ -209,24 +209,36 @@ function uc_minpercentrate_quote($produc
   
   if($method = db_fetch_object(db_query("SELECT * FROM {uc_minpercentrate_methods} WHERE mid = %d", $mid))) {
     foreach ($products as $product) {
+      // here we check if an product specific rate exist
       if($product->minpercentrate[$mid]) {
         $percent_rate = $product->minpercentrate[$mid];
       }
+      // if not, we use the global percent rate
       else {
         $percent_rate = $method->percent_rate;
       }
-      $product_total = $product->price * $product->qty; 
-      
-      // keep track of the total cost of the products in this order, so that we can make 
-      // the total shipping cost free if it's higher than $method->free_rate
-      $sub_total += $product_total;
+
+      // give us the product total
+      $product_total = $product->price * $product->qty;
+
+      // calculate the shipping cost for that product
       $product_ship_price = ($percent_rate / 100) * $product_total;
-  		if ($product_ship_price < $method->base_rate ) {
-  		  $product_ship_price = $method->base_rate; 
-  		} 
+
+      // add the calculated product shipping costs to the total shipping cost of the order
       $total_ship_price += $product_ship_price;
+
+      // keep track of the total cost of the products in this order, so that we can make
+      // the total shipping cost free if it's higher than $method->free_rate
+      $sub_total += $product_total;
     }
-    if($method->free_rate <= $sub_total) {  
+
+    // use the base rate, if the calclulated percent rate shipping costs are lower
+    if ($total_ship_price < $method->base_rate ) {
+      $total_ship_price = $method->base_rate;
+  	}
+    
+    // apply free rate, if a free rate is defined
+    if($method->free_rate > 0 && $method->free_rate <= $sub_total) {
 	    $total_ship_price =  0 ;
 	  }
   }
