Hi Guys

I have an issue when creating an "Order Products" view and adding a filter for "Taxonomy: Term ID (with depth)".

Some how Views tries to filter using 'uc_order_products.vid'

SELECT uc_order_products.order_product_id AS order_product_id,
   uc_orders.order_id AS uc_orders_order_id,
   uc_orders.delivery_first_name AS uc_orders_delivery_first_name,
   uc_orders.delivery_last_name AS uc_orders_delivery_last_name,
   uc_order_products.qty AS uc_order_products_qty,
   uc_order_products.title AS uc_order_products_title,
   uc_order_products.price AS uc_order_products_price
 FROM uc_order_products uc_order_products 
 LEFT JOIN uc_orders uc_orders ON uc_order_products.order_id = uc_orders.order_id
 LEFT JOIN node node ON uc_order_products.nid = node.nid
 WHERE ((uc_order_products.vid IN (
  SELECT tn.vid FROM term_node tn
  WHERE tn.tid  = 9
  )) AND (node.vid IN (
  SELECT tn.vid FROM term_node tn
  WHERE tn.tid = 11
  )))

So, even when views knows that "uc_order_products.nid = node.nid" it then tries to filter with uc_order_products.vid instead of node.vid

I added taxonomy as an argument too just to check what would happen, and it works correctly.

  (uc_order_products.vid IN (
  SELECT tn.vid FROM term_node tn
  WHERE tn.tid  = 9

comes from the filter

  (node.vid IN (
  SELECT tn.vid FROM term_node tn
  WHERE tn.tid = 9
  ))

comes from the argument

Any clues where views is getting confused?

Comments

jm.federico’s picture

Ah, right I was getting an:

unknown column uc_order_products.vid

Error

jm.federico’s picture

Category: support » bug

I guess it is a bug. Changing to "Bug Report"

longwave’s picture

Couldn't reproduce this, I managed to successfully make an ordered products view filtered on taxonomy. Can you paste an exported view that causes this error?

longwave’s picture

Status: Active » Closed (cannot reproduce)

Please reopen with an exported view if this is still an issue.

millenniumtree’s picture

I had this error when using an exposed filter with 6.x-3.1
I got around the problem by creating a relationship to the node terms and filtering through that relationship.