0

Currently I am trying to configure view to display a grid of commerce products that matches a specific taxonomy term. This term is a term reference field in the product display. I also have a view reference field in the product display. Right now I am trying to pass that taxonomy term into the referenced view as an argument.

I am having the issue of grabbing the 2nd argument path in views. I'm using the PHP option of the context filter.

As you can see from the sql statement it selects only the 1st argument, its suppose to select the 2nd one as seen in the contextual filter options. I'm not sure if its a bug in itself or i have something wrong with my code.

screenshot of view: http://prntscr.com/18qy2f

screenshot of contextual: http://prntscr.com/18rn4v


when it is working it should look like this: http://prntscr.com/18rs0i

In this scenario, i made the first argument as 3ds, which gives me the output i want. But on the top scenario where I want the 2nd argument, it still grabs only the 1st argument.

This is what it should look when it works. It takes the 1st argument. http://img844.imageshack.us/img844/4830/lgt7424d.png


it also seems that the TITLE doesnt recognize %2 or %3. see here: http://prntscr.com/18rx3i

1 Answer 1

0

On the first run, I was taking the approach of fetching the URL path that contained the related taxonomy data using the contextual filter's path argument selector.

After a good number of hours, I took a completely different approach to solve this problem. I actually figured out how to load the taxonomy field data into the contextual filter via php using the following code:

It will now grab any taxonomy data on the page if it exists. You will need to change it to your field settings.

return menu_get_object()->field_EXAMPLE_vocabulary[und][0][tid];

You can view my views configuration setup here: http://prntscr.com/18snhm

enter image description here

Looks like this once implemented:

http://img703.imageshack.us/img703/3733/lgt1356.png

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.