Help with uc_attribute Views integration

Posts: 12
Joined: 03/02/2008

I've decided to take on the task of integrating uc_attribute with Views. My eventual goal is to have a dynamic stock chart that allows the customer to limit their view to products with certain attributes, and to show only those products that are in stock (using the Hierarchical Select module).

I'm pretty new to Drupal, so I've put this together largely by looking at the Taxonomy Views integration and adopting some of its methods. The integration has been going well, but somehow in the process I made a revision that has caused my table joins to stop working. If I expose an Attribute Combination filter, the form and options show up as expected, but when I submit the filter, my query fails because the table join is not part of the query.

The attached include is far from feature complete. However, I'm at my wits end trying to figure out why my table joins don't work, and I'd really appreciate it if someone with Views experience could take a look at this and tell me what I'm doing wrong on that front.

Additionally, if anyone has ideas or suggestions for how to implement some of the more advanced integration features, I'd be more than happy to hear them! This seems like something that a lot of people other than myself could find handy.

AttachmentSize
views_uc_attribute.inc_.txt7.65 KB
Posts: 12
Joined: 03/02/2008

With a little help from the folks over at the Views project, I got that issue worked out. It turns out I was missing a needed call of $query->ensure_table().

I will keep working on this integration and I will post updated code when I am further along. In the meantime, does anyone have any feature or implementation requests? I will see if I can get them working along with the rest of the integration.

Posts: 1139
Joined: 08/14/2007
Bug FinderEarly adopter... addicted to alphas.Getting busy with the Ubercode.

Cool! I'd love to learn more about how to integrate Views with other modules - I've tried before and failed. Glad you got it worked out, I'd be interested in seeing it when it's finished Smiling

--

"Pain don't hurt." - Dalton

Mike Nelson's RiffTrax! www.rifftrax.com

Posts: 15
Joined: 09/20/2007
Bug Finder

I'd love to test this if you could post the most current import. I couldn't see where $query->ensure_table() is to be installed to make the current code work. Thanks!

Posts: 12
Joined: 03/02/2008

Here's the current version.

Not much has changed, but the filters work basically as expected. The fields still need some work related to sorting and efficiency, and multiple select doesn't really work for the filters yet. I'd also like to create some argument handlers that would allow a custom view to basically take over some of the catalog's functionality if needed (ex. a dynamic size chart that only shows products in stock for the requested size).

AttachmentSize
views_uc_attribute.inc_.txt8.21 KB
Posts: 12
Joined: 03/02/2008

I've made quite a bit of progress on this and I've submitted it as a contribution for people to test:

http://www.ubercart.org/contrib/3960

Posts: 11
Joined: 11/08/2007

It appears to exist a loop on line 576: this line seems to be critical - so I did not try to use it while commenting.

$options = _views_uc_attribute_build_form($options, $remaining_attributes, $this_option, $depth);

It is quite frustrating: this module seems to be very useful to me!

Alexandre

Posts: 11
Joined: 11/08/2007

I believe the looping issue is linked to using far too many options and attributes. I will modify that and give you feedback.

Alexandre