having the following configuration:
views content pane:
a contextual filter: has taxonomy term id
override title: Related News for %1
Allow multiple values
validation with filter type: Term IDs separated by , or +
the views pane preview works for single and concatenated term id's as contextual filter argument.
what doesn't work is embedding the views pane sucessfully into a panel:
panel for node template
context: relationship "Multiple terms from node" for a specific vocabulary with option OR + as concatenator
content: passing the context to a views content pane as "Term ID of all term, separated by + or ,"
the argument seems not to get passed. it will when using "Term ID of first term" instead of "Term ID of all term, separated by + or ,"
this is related to the support request #1111384: How to create a panel with related content based on multiple terms.
Comment | File | Size | Author |
---|---|---|---|
#25 | multiple-term-ids-working-example.png | 225.55 KB | yogeshchaugule8 |
#12 | multiple_term_id_panel_and_view_cars.zip | 4.88 KB | StuartDH |
#7 | panels_1285012.txt | 2.44 KB | Letharion |
#7 | 1285012_view.txt | 4.81 KB | Letharion |
Comments
Comment #1
bryancasler CreditAttribution: bryancasler commentedsubscribe
Comment #2
merlinofchaos CreditAttribution: merlinofchaos commentedThere was a problem here a while back that had to do with the fact that there are actually two entity term contexts -- original one and the entity based one -- and the multiple terms one is kind of off in lala land. I could swear I fixed that but maybe I missed something. :/
Comment #3
jmones CreditAttribution: jmones commentedsubscribe
Comment #4
Joe Vallender CreditAttribution: Joe Vallender commentedsubscribe.
I've just been doing a bit of messing around with this trying different combinations of +d together term Ids directly into the views preview function and getting the behaviour there too, when panels hasn't come into play at all. Not sure if that helps narrow it down a bit (...or if that is old news, fixed and my views module is a little out of date)
Edit: having re-read an actually retained the original post. it seems my info is at odds with the initial info. disregard as appropriate :)
Comment #5
Hanpersand CreditAttribution: Hanpersand commentedSubscribing, just in case that new follow button is just for show.
Comment #6
suldan CreditAttribution: suldan commentedCouldn't this be a ctools related problem? Maybe the relationship-plugin in ctools/plugins/relationships/terms_from_node.inc ? When I'm not misstaken the (+ OR)-concatenator did work for me but not (, AND).
By the way: I still dont have any problems creating related content based on multiple tid's by using content:has taxonomy term ID. Without any arguments from panels, without any specification of validation and without any additional relationships. Just allow multiple values.
Using last devs of all
Comment #7
Letharion CreditAttribution: Letharion commentedI can't reproduce the original problem, as I get a SQL error when I try.
PDOException: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''1', '2'' at line 1: SELECT tid, name FROM {taxonomy_term_data} WHERE tid IN :tids_0, :tids_1; Array ( [:tids_0] => 1 [:tids_1] => 2 ) in ctools_context_terms_convert() (line 84 of [path]/sites/all/modules/ctools/plugins/contexts/terms.inc).
Looks like missing () after IN?
Comment #8
Letharion CreditAttribution: Letharion commentedFor future reference, please, please upload exports of views/pages. It makes it a great deal easier to debug for me.
Comment #9
wmostrey CreditAttribution: wmostrey commentedI have the same issue without Panels, I'm only using Views 7.x-3.0-rc3.
To reproduce:
When I add 1 tid as an argument, the results are as to be expected.
When I add "tid1,tid2" or "tid1+tid2" as an argument, no results are returned.
I also tried this with the option "Filter value type" > "Term name converted to Term ID" but this didn't change the results.
Comment #10
wmostrey CreditAttribution: wmostrey commentedThis would seem to require a new "Filter value type" that combines "Term name converted to Term ID" and "Term IDs seperated by , or +".
Update: This ticket seems to do just that: #1248300: Contextual filters: Taxonomy filter validation using multiple term names. I'm not sure if this feature/bug falls in the scope of this issue though.
Comment #11
StuartDH CreditAttribution: StuartDH commentedThe views patch in the above post doesn't seem to work properly.
Comment #12
StuartDH CreditAttribution: StuartDH commentedI've attached a Feature with a content type, view and panel that works if there's only one term reference field on the node.
But when there's two or more term reference fields, and the fields have content in them on the node...
Comment #13
StuartDH CreditAttribution: StuartDH commentedI think I've managed to identify the problem.
Everything works OK until you have more than one Term reference field in the content type, with terms in it
With only one term reference field on the content type, if the panel content view Taxonomy term: Term ID is set to "Term ID of all term, separated by + or ," everything seems to work OK. The panel sends multiple term IDs to the view and the panel's view pane shows the multiple terms.
If you add a second term reference field to the content type, the panel still displays the above view properly...
until you add/select terms in the second term reference field on the node...then the panel stops sending "Multiple terms from node" to the view for the first term reference field.
The above issue exists regardless of whether the panel's Context > Relationships > Multiple terms from node > Vocabulary boxes are checked for both, either, or none of the above vocabularies.
Comment #14
StuartDH CreditAttribution: StuartDH commentedTo recreate the issue with ctools, views and panels modules installed
1. Create a simple 'Colours' vocabulary and add terms 'Red, Green and Blue' - (admin/structure/taxonomy/add)
2. Add a 'Colours' taxonomy field to the Articles content type...widget 'select list' or 'auto complete' and number of fields 'Unlimited' - (admin/structure/types/manage/article/fields)
3. Create a 'Colours View' with machine name 'colours_view' - admin/structure/views/add
In admin/structure/views/view/colours_view add 'Taxonomy term: Term ID' context filter
Set 'WHEN THE FILTER VALUE IS IN THE URL OR A DEFAULT IS PROVIDED' to:
4. Create a node template panel for Articles - admin/structure/pages/nojs/operation/node_view/actions/add with:
5. Create an article and select two or more options from the colours field - save the page and it should show the colours listed in the view
6. Edit the node, add anything to the 'Tags' field and save the page - the above 'Colours View' will disappear
Comment #15
StuartDH CreditAttribution: StuartDH commentedI don't know if it helps, but configuring the view pane's settings to Taxonomy term: Term ID > Term ID of first term doesn't result in the above issue.
Unlike Taxonomy Term IDs separated by + or , the Term ID of first term option produces the required view even when there are multiple term reference fields on the node
Comment #16
StuartDH CreditAttribution: StuartDH commentedIt looks like a fix for this issue could also fix several similar Panels issues - http://drupal.org/node/1111762 and possibly this one - http://drupal.org/node/1424020
as well as many Panels-related issues in the Views module like http://drupal.org/node/1369772
Comment #17
matglas86 CreditAttribution: matglas86 commented@StuartDH you are right. The other issues are duplicates of this and a fix here should fix the others too. I'm having the same issue here. I have not taken the time to digg deeper in the filter and see what happens. But I have the same setup as people before described and get no result with more then one term but I have good results with only one term.
Comment #18
node9 CreditAttribution: node9 commented+1
Comment #19
StuartDH CreditAttribution: StuartDH commentedLooks as though this is now fixed.
All looks OK when creating something similar to #14 with Drupal 7.12, Ctools 7.x-1.0, Panels 7.x-3.2 and Views 7.x.3.3
Comment #20
merlinofchaos CreditAttribution: merlinofchaos commented'needs review' means there's a patch.
Comment #21
PieterDCThanks StuartDH for your hints. I managed to configure my panel/view.
Comment #23
hixster CreditAttribution: hixster commentedSorry, reopening. I am experiencing exactly the same issue as described in http://drupal.org/node/1285012#comment-5724598 using
Drupal 7.17, Ctools 7.x-1.2, Panels 7.x-3.3 and Views 7.x.3.5.
When selecting a single term on my node the view is displayed by panels. As soon as I select multiple terms the view disappears.
I have tried using both a View with master display in my panels as well as a Content pane (I setup the arguments to accept multiple tid's).
Comment #24
Zero4ffect CreditAttribution: Zero4ffect commentedI am also experiencing this issue:
Drupal 7.26
Ctools 7.x-1.4
Panels 7.x-3.4
Views 7.x-3.7
Selecting a single term allows the term id to pass to the panel but using multiple terms causes the contextual filter to invalidate.
Comment #25
yogeshchaugule8 CreditAttribution: yogeshchaugule8 commentedFor any one who will be visiting this issue, here is a screenshot of the working configuration of contextual filter in view for multiple terms. I've got this working.
Marking the thread as closed.
Yogesh
Comment #26
daggar CreditAttribution: daggar commented#25 worked for me. Thank you yogeshchaugule8
JD
Comment #27
dasjo#25 works fine within views, though i haven't found a way to configure passing on the multiple terms context via panels properly.
Renaming as this reflect more what was in my initial issue summary
Comment #28
_nolocation CreditAttribution: _nolocation at Amazee Labs commentedI tried the above and 100 other things but I couldn't get this to work correctly.
I finally used php to return the arguments I needed and even though this might not be the optimal solution, it works. The disadvantage is that it's not flexible and has to be adapted to the context where the view is displayed.
The following goes into "Provide default value" -> "PHP Code".
Comment #29
calebtr CreditAttribution: calebtr commentedI also can't get #25 to work - I'm using the same configuration, but for a Content pane instead of a block.
I've got 'Argument input' setting set to 'Input on pane config'.
The view works perfectly in preview mode - I can pass 1+2 and get the expected results. When I configure the pane to use "1+2", I only get results for term 1.
When I dpm() the display in hook_panels_pre_render(), the setting has already been stripped down from "1+2" to "1" - possibly, it is being validated as a single taxonomy term, but I'm not sure where.
My use case requires always ORing in a specific term, so I did solve this by editing the argument in hook_panels_pane_prerender():
In another use case, this technique might not work.
Comment #30
katrien_w CreditAttribution: katrien_w commentedTry putting argument input to 'no argument', according to instruction of Suldan in https://www.drupal.org/node/1111384#comment-4742022. It works for me on a content pane.
Comment #31
mudasirweb CreditAttribution: mudasirweb as a volunteer commentedHi
#25 worked for me, Thanks yogeshchaugule8