Hi there,

I've got Ubercart 7.x-3.0-alpha3 with Views 7.x-3.x-dev (2.11.2010). I've cloned the default 'uc_products' view and got the following error:

Fatal error: Call to undefined function db_placeholders() in /public_html/sites/all/modules/ubercart/uc_product/views/uc_product_handler_filter_product.inc on line 16

It looks like there is no db_placeholders() in d7

CommentFileSizeAuthor
#4 960228_views_3.patch1.72 KBIsland Usurper

Comments

blazey’s picture

/**
 * @file
 * Views handler: Node filter on "product-ness".
 */

/**
 * Filter nodes based on whether they have an entry in the uc_products table.
 */
class uc_product_handler_filter_product extends views_handler_filter_boolean_operator {
  function query() {
    $types = uc_product_types();   
    $this->query->add_field('node', 'type');
    $this->query->add_where($this->options['group'], "node.type " . (empty($this->value) ? "NOT " : "") . "IN (" . db_placeholders($types, 'varchar') . ")", $types);
  }
}

"where" isn't wroking as it should. I've tried to replace it with implode, but it looks like this function is also removing whitespace (so in SQL query it looks like "WHERE (...) node.typeINproduct"). I'm quite new to d7 database api and I would very gratefull if you share the solution

Island Usurper’s picture

Yeah, this got left out of the general port to D7 because Views wasn't ready yet. Now that it is, I've got a patch to take care of this, plus some other stuff.

blazey’s picture

Status: Active » Needs review

Changing

$this->query->add_where($this->options['group'], "node.type " . (empty($this->value) ? "NOT " : "") . "IN (" . db_placeholders($types, 'varchar') . ")", $types);

to

$this->query->add_where($this->options['group'], "node.type", $types);

solves the problem.

Island Usurper’s picture

Status: Needs review » Fixed
StatusFileSize
new1.72 KB

Here's the part that deals with the changes in D7 and Views 3. Pretty simple, but I'm also going to put more integration for uc_catalog, uc_order, and eventually most of the modules that display data in lists. But that's all for other issues.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.