I just installed and configured this module with a node & product. using drupal 7.9 and 7.2x dev.

I got this error

Recoverable fatal error: Argument 2 passed to db_query() must be an array, null given, called in /var/www/vhosts/blah/blah/blah/sites/all/modules/uc_node_checkout/uc_node_checkout.module on line 1139

I posted this a bit ago and am still receiving this error. Any help would be greatly appreciated.

EDIT: This seems to be an issue with 'Product Attributes' and 'UC Node Checkout'. Node checkout does not like trying to add products with attributes

Comments

Anonymous’s picture

Using some variation of the Rules/Entity/Ubercart development versions has created this error. A blank site with supported modules works fine. I'm going to keep testing....

EDIT: I was wrong apparently...

I now get the error when trying to create a node, attached to a product with attributes.

Versions of modules I'm using:
Rules = 7.x-2.0
Entity = 7.x-1.0-rc1
Ubercart = 7.x-3.0-rc2
UC Node Checkout = 7.x-2.x-dev

Anonymous’s picture

This line seems to be using Drupal 6's database structure

$result = db_query("SELECT * FROM {uc_cart_products} WHERE data LIKE '%%\"node_checkout_nid\";i:%d;%%'", $nid);

Like 1139 of uc_node_checkout.module

This is the line giving me troubles, as well. Wondering if it needs to be updated for D7

christelle41’s picture

I have a problem when I try to update from the the first unofficial D7 version (http://drupal.org/node/1172060). The update fails and the module fails to work when I create a node.

christelle41’s picture

I have the same error with the last dev version (december 5th)... I have nodes with attributes.

christelle41’s picture

Si I can confirm that it works with a product without attributes and not with ones.

christelle41’s picture

I've replaced the function uc_node_checkout_load_cart_item Line 1139 of uc_node_checkout.module with :

 function uc_node_checkout_load_cart_item($nid) {
  static $items = array();

  // If the item hasn't been searched before...
  if (!isset($items[$nid])) {
    // Load the data from the database.
    $query = db_query("SELECT * FROM {uc_cart_products} WHERE data LIKE :like", array(':like' => '%' . db_like('"node_checkout_nid";i:' . $nid . ';') . '%'));

    // If a matching product was found in the DB for this node...
    if ($item = $query->fetchObject()) {
      $item->data = unserialize($item->data);
      $items[$nid] = $item;
    }
    else {
      $items[$nid] = FALSE;
    }
  }

  return $items[$nid];
}

It was the version of this function in the first unofficial D7 version (http://drupal.org/node/1172060).
I don't know if it's really correct (from a syntax point of view) but it works even with products with attributes. If it can help...

kreutzer’s picture

The above modification certainly allows me to fill up the node form and select the corresponding attribute, but when the node is submitted and the product added to cart, the attribute pricing is not captured. Only the base product price is reflected in the cart.

snap4417’s picture

I had the same problem made the same code change in #6. re: #7 the attribute pricing is not captured. I have this issue as well. kreutzer, did you reach a resolution?

I'm a Java programmer and trying to wrestle my way through Php and the Drupal design to see if I can correct it.

kreutzer’s picture

snap4417, nope I did not resolve this. And since I'm not a programmer and on a tight schedule, I just shifted back to D6 as there were too many issues like this cropping up for me in D7.

thomas1977’s picture

Not trying to sound impatient, but is this issue being looked into by the maintainers? Need this module for a D7 project.

TR’s picture

I just went through the code and fixed all the places that were still using Drupal 6 style DB calls.

Please test the current -dev version and let me know if this is still a problem.

vgulla’s picture

No, it is still not working. getting the error when using products with attributes:
"Fatal error: Call to a member function fetch() on a non-object in /modules/uc_node_checkout/uc_node_checkout.module on line 1142"

stadulis66’s picture

Has anybody gotten node checkout and attributes to work together? No matter what patch I apply, I continue to get the same errors. Help Please!

stadulis66’s picture

Issue summary: View changes

Error status update