When filtering with "Order product: attribute" with an exposed dropdown filter, the LIKE statement is built using the attribute "name" field whereas the
attributes in orders are serialized and stored in the table "uc_order_products" in the column "data" using the attribute "label" field.
Example:
- LIKE clause in views resulting query: '%s:6:\"period\";a:1:{i:0;s:41:\"12 Juillet - 16 Juillet 2010 - APRES MIDI\";%'
- How the attribute is stored in column "data" of table "uc_order_products": 'a:3:{s:10:"attributes";a:1:{s:8:"Période";a:1:{i:0;s:30:"21 Juin - 25 Juin 2010 - MATIN";}}s:9:"shippable";s:1:"0";s:6:"module";s:10:"uc_product";}'
Quick fix:
Replace
$key = db_result(db_query('SELECT name FROM {uc_attributes} WHERE aid = %d', $aid));
With
$key = db_result(db_query('SELECT label FROM {uc_attributes} WHERE aid = %d', $aid));
in file uc_views_attribute_handler_filter_attr.inc
Comments
Comment #1
elchulo commentedSorry, the example should read:
- LIKE clause in views resulting query: '%s:6:\"period\";a:1:{i:0;s:30:"21 Juin - 25 Juin 2010 - MATIN";%'
- How the attribute is stored in column "data" of table "uc_order_products": 'a:3:{s:10:"attributes";a:1:{s:8:"Période";a:1:{i:0;s:30:"21 Juin - 25 Juin 2010 - MATIN";}}s:9:"shippable";s:1:"0";s:6:"module";s:10:"uc_product";}'
Comment #2
mattkaneart commentedJust wanted to thank you for this-- I was having the most difficult time figuring out why this feature wasn't working for me. I made this change and it worked. Linking this over to http://drupal.org/node/651036 -