diff -up uc_out_of_stock/uc_out_of_stock.info.orig uc_out_of_stock/uc_out_of_stock.info
--- uc_out_of_stock/uc_out_of_stock.info.orig	2011-02-25 02:55:12.000000000 -0500
+++ uc_out_of_stock/uc_out_of_stock.info	2011-06-27 11:47:34.421666501 -0400
@@ -1,12 +1,12 @@
 
 name = Out of stock notificator
 description = It tells the user if an item is out of stock. It supports attributes.
-core = 6.x
+core = 7.x
 dependencies[] =  uc_stock
 package = Ubercart - extra
 ; Information added by drupal.org packaging script on 2011-02-25
-version = "6.x-1.x-dev"
-core = "6.x"
+version = "7.x-1.x-dev"
+core = "7.x"
 project = "uc_out_of_stock"
 datestamp = "1298620512"
 
diff -up uc_out_of_stock/uc_out_of_stock.js.orig uc_out_of_stock/uc_out_of_stock.js
--- uc_out_of_stock/uc_out_of_stock.js.orig	2011-02-24 21:09:08.000000000 -0500
+++ uc_out_of_stock/uc_out_of_stock.js	2011-06-27 11:47:50.741664677 -0400
@@ -1,115 +1,124 @@
+(function ($) {
 
-Drupal.behaviors.ucOutOfStock =  function() {
+Drupal.behaviors.ucOutOfStock = {
   // Your code here
-  attrid = 'edit-attributes';
+  //
 
-  function checkStock(form) {
-    var product = new Object();
-    var attributes = new Object();
-    var formid_data = new Array();
-
-    product.nid = form.attr('id').match(/(?:uc-product-add-to-cart-form-|catalog-buy-it-now-form-)([0-9]+)/)[1];
-    attributes.found = new Object();
-    attributes.value = new Object();
-
-    $(":input[name*=attributes]:not(:text)", form).each(function(index){
-      id = $(this).attr('name').substring(11,$(this).attr('name').length-1);
-      if ($(this).is(':radio')) {
+  attach: function() {
+
+    attrid = 'edit-attributes';
+
+    function checkStock(form) {
+      var product = new Object();
+      var attributes = new Object();
+      var formid_data = new Array();
+
+      product.nid = form.attr('id').match(/(?:uc-product-add-to-cart-form-|catalog-buy-it-now-form-)([0-9]+)/)[1];
+      attributes.found = new Object();
+      attributes.value = new Object();
+
+      $(":input[name*=attributes]:not(:text)", form).each(function(index){
+        id = $(this).attr('name').substring(11,$(this).attr('name').length-1);
+        if ($(this).is(':radio')) {
+          attributes.found['attr'+id] = 1;
+          if ($(this).is(':checked')) {
+            if ($(this).val()) {
+              attributes.value['attr'+id] = 1;
+              product['attr'+id] = $(this).val();
+            }
+          }
+        } else {
         attributes.found['attr'+id] = 1;
-        if ($(this).is(':checked')) {
           if ($(this).val()) {
             attributes.value['attr'+id] = 1;
             product['attr'+id] = $(this).val();
           }
         }
-      } else {
-      attributes.found['attr'+id] = 1;
-        if ($(this).val()) {
-          attributes.value['attr'+id] = 1;
-          product['attr'+id] = $(this).val();
-        }
-      }
-    });
+      });
 
-    // find qty
-    product['qty'] = 1;
-    qty = $(":input[name=qty]", form).val()
-    if (qty) {
-      product['qty'] = qty;
-    }
+      // find qty
+      product['qty'] = 1;
+      qty = $(":input[name=qty]", form).val()
+      if (qty) {
+        product['qty'] = qty;
+      }
 
-    // finding if attributes are found with no value
-    attributes.found.length = attributes.value.length = 0;
-    for (var i in attributes.found) {
-      if (i!='length') {
-        attributes.found.length++;
+      // finding if attributes are found with no value
+      attributes.found.length = attributes.value.length = 0;
+      for (var i in attributes.found) {
+        if (i!='length') {
+          attributes.found.length++;
+        }
       }
-    }
-    for (var i in attributes.value) {
-      if (i!='length') {
-        attributes.value.length++;
+      for (var i in attributes.value) {
+        if (i!='length') {
+          attributes.value.length++;
+        }
       }
-    }
-    if (attributes.found.length != attributes.value.length) {
-      // Put back the normal HTML of the add to cart form
-      $(".uc_out_of_stock_html", form).html('');
-      $("input:submit.node-add-to-cart,input:submit.list-add-to-cart", form).show();
-      return;
-    }
-
-    $(".uc_out_of_stock_throbbing", form).addClass('uc_oos_throbbing');
-    $.post(Drupal.settings.basePath+'uc_out_of_stock/query', product, function (data, textStatus) {
-      // textStatus can be one of:
-      //   "timeout"
-      //   "error"
-      //   "notmodified"
-      //   "success"
-      //   "parsererror"
-      data = data.split('|');
-      stock = data[0];
-      if (stock == parseInt(stock) && stock <= 0 && data.length == 2) {
-        html = data[1];
-        $("input:submit.node-add-to-cart,input:submit.list-add-to-cart", form).hide();
-        $(".uc_out_of_stock_html", form).html(html);
-      } else {
+      if (attributes.found.length != attributes.value.length) {
         // Put back the normal HTML of the add to cart form
         $(".uc_out_of_stock_html", form).html('');
         $("input:submit.node-add-to-cart,input:submit.list-add-to-cart", form).show();
+        return;
       }
 
-      $(".uc_out_of_stock_throbbing", form).removeClass('uc_oos_throbbing');
-    });
-  }
+      $(".uc_out_of_stock_throbbing", form).addClass('uc_oos_throbbing');
+      $.post(Drupal.settings.basePath+'uc_out_of_stock/query', product, function (data, textStatus) {
+        // textStatus can be one of:
+        //   "timeout"
+        //   "error"
+        //   "notmodified"
+        //   "success"
+        //   "parsererror"
+        data = data.split('|');
+        stock = data[0];
+        if (stock == parseInt(stock) && stock <= 0 && data.length == 2) {
+          html = data[1];
+          $("input:submit.node-add-to-cart,input:submit.list-add-to-cart", form).hide();
+          $(".uc_out_of_stock_html", form).html(html);
+        } else {
+          // Put back the normal HTML of the add to cart form
+          $(".uc_out_of_stock_html", form).html('');
+          $("input:submit.node-add-to-cart,input:submit.list-add-to-cart", form).show();
+        }
 
-  $("form[id*=uc-product-add-to-cart-form]").each(function(index) {
-    var eachForm;
-    $("input:submit.node-add-to-cart,input:submit.list-add-to-cart", $(this)).before('<div class="uc_out_of_stock_throbbing">&nbsp;&nbsp;&nbsp;&nbsp;</div> ');
-    $("input:submit.node-add-to-cart,input:submit.list-add-to-cart", $(this)).after('<div class="uc_out_of_stock_html"></div');
+        $(".uc_out_of_stock_throbbing", form).removeClass('uc_oos_throbbing');
+      });
+    }
 
-    eachForm = $(this);
-    checkStock(eachForm);
+    $("form[id*=uc-product-add-to-cart-form]").each(function(index) {
+      var eachForm;
+      $("input:submit.node-add-to-cart,input:submit.list-add-to-cart", $(this)).before('<div class="uc_out_of_stock_throbbing">&nbsp;&nbsp;&nbsp;&nbsp;</div> ');
+      $("input:submit.node-add-to-cart,input:submit.list-add-to-cart", $(this)).after('<div class="uc_out_of_stock_html"></div');
 
-    $(":input[name*=attributes]:not(:text)", $(this)).change(function(){
+      eachForm = $(this);
       checkStock(eachForm);
+
+      $(":input[name*=attributes]:not(:text)", $(this)).change(function(){
+        checkStock(eachForm);
+      });
+      /* TODO: Feature request - support qty field, would make sense if cart
+       * contents are checked in the server as well as just stock
+       */
+      /*
+      $(":input[name=qty]", $(this)).keyup(function(){
+        checkStock(eachForm);
+      });
+      */
     });
-    /* TODO: Feature request - support qty field, would make sense if cart
-     * contents are checked in the server as well as just stock
-     */
-    /*
-    $(":input[name=qty]", $(this)).keyup(function(){
+
+    $("form[id*=uc-catalog-buy-it-now-form]").each(function(index) {
+      var eachForm;
+      $("input:submit.node-add-to-cart,input:submit.list-add-to-cart", $(this)).before('<div class="uc_out_of_stock_throbbing">&nbsp;&nbsp;&nbsp;&nbsp;</div> ');
+      $("input:submit.node-add-to-cart,input:submit.list-add-to-cart", $(this)).after('<div class="uc_out_of_stock_html"></div');
+
+      eachForm = $(this);
       checkStock(eachForm);
+
+      // This form has no possible attributes
     });
-    */
-  });
 
-  $("form[id*=uc-catalog-buy-it-now-form]").each(function(index) {
-    var eachForm;
-    $("input:submit.node-add-to-cart,input:submit.list-add-to-cart", $(this)).before('<div class="uc_out_of_stock_throbbing">&nbsp;&nbsp;&nbsp;&nbsp;</div> ');
-    $("input:submit.node-add-to-cart,input:submit.list-add-to-cart", $(this)).after('<div class="uc_out_of_stock_html"></div');
-
-    eachForm = $(this);
-    checkStock(eachForm);
-
-    // This form has no possible attributes
-  });
-};
\ No newline at end of file
+  }
+}
+
+})(jQuery);
diff -up uc_out_of_stock/uc_out_of_stock.module.orig uc_out_of_stock/uc_out_of_stock.module
--- uc_out_of_stock/uc_out_of_stock.module.orig	2011-02-24 21:09:08.000000000 -0500
+++ uc_out_of_stock/uc_out_of_stock.module	2011-06-27 11:47:56.327664428 -0400
@@ -92,19 +92,21 @@ function uc_out_of_stock_getstockinfo($n
   // combination shares an SKU with the actual product, thus, the product have to be queried as well.
   $query_main_sku = TRUE;
   if (module_exists('uc_attribute')) {
+
     // if attributes module exists, and product has attributes first search for attributes
     $post_attrs = count($attrs);
-    $sql = "SELECT %s FROM {uc_product_adjustments} upa LEFT JOIN {uc_product_stock} ups ON ups.sku = upa.model WHERE upa.nid = %d";
-    $db_attrs = db_result(db_query($sql, 'COUNT(*)', $nid));
-    if ($post_attrs && $db_attrs > 0) {
-      $result = db_query($sql, '*', $nid);
-      while ($row = db_fetch_object($result)) {
+    $sql = "SELECT * FROM {uc_product_adjustments} upa LEFT JOIN {uc_product_stock} ups ON ups.sku = upa.model WHERE upa.nid = :node_id";
+    $result = db_query($sql, array(':node_id' => $nid));
+    $attr_count = $result->rowCount();
+    if ($post_attrs && $attr_count > 0) {
+      foreach ($result->fetchAll() as $row) {
         $combination = unserialize($row->combination);
         // Apparently, on D6, one entry of the stock table has always the main SKU regardless the adjustments settings
         // Therefor, if the join gives a null record for the stock table, the main sku will be queried as well
-        if ( isset($row->sku) && $combination == $attrs ) {
+        if ( isset($row->sku) && $combination[1] == strval($attrs[1]) ) {
           // Because a combination is found, don't look for the main SKU
           $query_main_sku = FALSE;
+
           // Only check if active
           if ($row->active) {
             $stockinfo['stock'] = $row->stock;
@@ -117,7 +119,7 @@ function uc_out_of_stock_getstockinfo($n
       // If there are attributes for the product, but no attributes were sent, do nothing
       // as it's probably coming from the catalog table list view and we can't
       // disable the add to cart button for products with attributes
-      if ($post_attrs == 0 && $db_attrs > 0) {
+      if ($post_attrs == 0 && $attr_count > 0) {
         $query_main_sku = FALSE;
       }
     }
@@ -125,8 +127,8 @@ function uc_out_of_stock_getstockinfo($n
 
   if ($query_main_sku) {
     // seach for main product
-    $result = db_query("SELECT * FROM {uc_products} up LEFT JOIN {uc_product_stock} ups ON ups.sku = up.model WHERE up.nid = %d AND ups.active = 1", $nid);
-    while ($row = db_fetch_object($result)) {
+    $result = db_query("SELECT * FROM {uc_products} up LEFT JOIN {uc_product_stock} ups ON ups.sku = up.model WHERE up.nid = :node_id AND ups.active = 1", array(':node_id' => $nid));
+    foreach ($result->fetchAll() as $row) {
       $stockinfo['stock'] = $row->stock;
       $stockinfo['model'] = $row->model;
     }
