Hi
I've created a Taxonomy Vocabulary with the name "Remarque prix". I imported it as a Term reference field to Commerce Product with the aim to be able to give a unique Vocabulary term to each product (SKU).
I want to present the Vocabulary term description in the the node by using Views so I created a View showing the Term description and took it into the node as a dynamic field, but I can't figure out how to set Contextual filters and maybe Relationships within views so each SKU/Product will have the correct Vocabulary term.
I have spent over a full day on this but can't figure out how to do. Could maybe anyone help me, please?
All the Best
Hans
Comments
Comment #2
saurabh.dhariwal CreditAttribution: saurabh.dhariwal at AddWeb Solution Pvt. Ltd. commentedPlease follow below steps for the purpose:
1 - Create a view of type content, create block
2 - Add relationship "Taxonomy terms on node" and select your vocabulary
3 - Add contextual filter for nid
4 - Add term description field
Place this block on node page. This will allow you to show term description of selected terms on node page.
Let me know incase of any query/concern for the same.
Thanks!
Comment #3
hassebasse CreditAttribution: hassebasse commentedHello,
Very many thanks for your assistance. Anyhow, by doing it the way you suggesed I couldn't find the right field. I have based a test on what you told me but the way I have done it now I can't figure out how to apply the filter, so all terms from the vucabulary , for all produts are visible in all nodes from the Content type. I'll take it from the beginning and maybe you can tell me how to apply a filter.
I started with creating a content type for presenting products. Later on I relized I wanted to present prices as well so I installed Commerce. Commerce has a few standard fields and to them I added the Vocabulary "Remarque prix" with a couple of Terms where I can add a comment to the price; delivery conditions etc.
Then I brought in the Commerce Product to the Content type as a Product reference field and in "Manage display" I bring in all fields from Commerce Product and presents them in the node; among them the Vocabulary "Remarque prix"
When I created a View as type Content I couldn't find the right fields so I tried by creating a View as type Taxonomy Term. Then I made a block out of it and added the relationship Taxonomy term: "Commerce Product using Remarque prix". As a field I use "Taxonomy term: Term description (Term description)" As a standard filter ( not Contextual ) i have "Taxonomy vocabulary: Machine name (= Remarque prix)"
And there we are now, I don't understand how to apply the Contextual filter to this. Do you have any suggestions?
All the best
Hans
Comment #4
saurabh.dhariwal CreditAttribution: saurabh.dhariwal at AddWeb Solution Pvt. Ltd. commentedHello,
Reviewed your latest comment and here's the steps you can follow for your purpose:
1 - Create a view of type content, create block.
2 - Add relationship "content:your product reference field" and Add another relation ship for term reference "Commerce Product:your term reference field".
3 - Add contextual filter for nid.
4 - Add term description field.
Place this block on node page. This will allow you to show term description of selected terms from product.
Let me know if you have any query after incorporating the provided above steps.
Thanks!
Comment #5
hassebasse CreditAttribution: hassebasse commented:)
Thank you. You made my day my friend. Or my week even ! I have put my question in 3 in different forums. Stackexchange, no response, in Drupal Support I had a lot of help from a person but he couldn't point out exactly how to do (but I had a lot of other valuble input from him) and then there was you !
It worked on Content ID from URL in the Nid filter, but I don't understand why. Now I'm just gonna try to figure out what I have done so I can learn something from this. I will shae your answer with the other guy who tried to help me.
Have a very great, night I suppose, as you seem to be in India.
Greetings from Hans (in France)
Comment #6
hassebasse CreditAttribution: hassebasse commentedHi again,
Here comes something more ! ; The field, or block, is only visible when logged in. Anonymus user can not see it. I did not pay attention to this fact first, I must be logged in to see this field, or if it is the full block that is invisible,
What could this be?
Hans
Comment #7
saurabh.dhariwal CreditAttribution: saurabh.dhariwal at AddWeb Solution Pvt. Ltd. commentedPlease check the permissions for your block and view.
Thanks!
Comment #8
hassebasse CreditAttribution: hassebasse commentedI'm stuck again.
I can notice it is not a matter of the block. I have created a new view as Content-Page. Then I imported the View as a Dynamic field but the same problem occured; the filed is only visible if logged in as Admin..
In views I've tried the below settings both on the Content Page view and on the Content Bloc view, with the same result
Access:Permission | View published content
Access:Role | Multiple roles
Do you have any suggestion to why it does not show up in anno ? Are there any permission settings I haev forgotten?
All the best
Hans
Comment #9
saurabh.dhariwal CreditAttribution: saurabh.dhariwal at AddWeb Solution Pvt. Ltd. commentedPlease check specific field permission which you displayed on your view: such as file. Provide more details related to view and permission.
Thanks!
Comment #10
hassebasse CreditAttribution: hassebasse commentedI've made some print screens of all settings in view. You'll find them in the link below. If you need something more just let me know. For other settings I don't know where to look.
http://bjarstal.com/content/view-settings
All the best
Hans
Comment #11
hassebasse CreditAttribution: hassebasse commentedSOLVED
The solution for me was in #4 https://www.drupal.org/node/1276450 originating from #1 in http://drupal.org/node/1276900#comment-4980066
edit your View > "Advanced" > "Query settings" : check "Disable Query Rewritting"
All the best
Hans
Comment #12
renatogHi guys.
I checked and really makes sense. Disabling SQL rewriting will disable node_access checks as well as others projects that implement hook_query_alter().
Really works good.
Comment #13
renatogThanks for the contributions @hassebasse and @saurabh.dhariwal