Filtering by any field in "Transaction product" group in a view returns duplicates

Roger Saner - August 4, 2009 - 16:43
Project:e-Commerce
Version:6.x-4.0-rc11
Component:ec_store
Category:bug report
Priority:normal
Assigned:Unassigned
Status:active
Description

To re-create: create a new view, filter it by, say "Node: published" and a node type (in my case, "Downloadable product"). Change the row style to "Fields" and give the view one field ("Node: Title"). Preview it - so far so good (in my case the view returned 2 nodes).

Now add a new field - any field from the "Transaction product" group - and preview again. In my case the view returned 5 nodes, 4 of which were the same.

The query which returned no duplicates is:

SELECT node.nid AS nid
FROM node node
WHERE (node.status <> 0) AND (node.type in ('downloadable_song'))

The query which returned duplicates is:

SELECT node.nid AS nid,
   ec_transaction_product.shippable AS ec_transaction_product_shippable
FROM node node
LEFT JOIN ec_transaction_product ec_transaction_product ON node.vid = ec_transaction_product.vid
WHERE (node.status <> 0) AND (node.type in ('downloadable_song'))

Those queries look fine to me - I'm not sure what's going wrong. I've been working off the ecommerce 4.x-dev series for a while, but went over the release candidates a few months back and have been faithfully updating every time a new version has come out. I wondered if one of the updates introduced an error into the db, so I recreated this on a fresh D6 install with 4.x-rc11. Guess it wasn't an update gone wrong!

The fields are defined in ec_store/ec_store.views.inc - here's one:

$data['ec_transaction_product']['qty'] = array(
    'title' => t('Quantity'),
    'help' => t('provides items purchased'),
    'field' => array(
      'handler' => 'views_handler_field_numeric',
    ),
  );

I've not worked with code-defined views fields before, so I don't know if this will directly create sql code, or if it will interact with the views api to tell it what to do...?

 
 

Drupal is a registered trademark of Dries Buytaert.