How to display all data from a paragraph field in views (Drupal 7) - drupal-7

I am currently a caretaker for a Drupal 7 website and I can't figure out how to group paragraph items in views. I have created a content type Products and one of the fields is called product variation which is field type paragraphs. I have created a paragraph bundle for that field.
Then I created a view to show the products on the front page. To display the paragraph fields I created a content relationship. When I open the relationship option and select delta to display one it only shows one and I can't get data from the others. If I select delta to display all it shows like in the image below (Current view displays like). The goal is shown on the same image. Could someone help me solve this:
My setup on the fields I want to display in the view are setup like this
`content-type: Products
product name - field type: Node module element
proudct image - field type: Image
product variation - field type: paragraph
paragraph bundle: product variations
color (Term reference)
view:
Display: product name, product image,product variation
Relationship: Content: product variation (field_product_variation)
Hopefully, someone can help me solve this problem.

Related

Drupal 7 unable to get referenced node in view

I have a node called "Student" I have another node called "Personal details".
I have made relations between them using entity reference module.
Now I am creating a view to get details of all students. I created a view of students and selected Content "Personal details" on fileds of the view. But I am only getting the id of the "Personal details".
I am struging to get the name and other fields of personal details node.
I used Relationships-> Entity Reference: Personal details and added content entityreference in fields but it is not displaying aything when i printing the view using get_view API.
Please help me on this.
I think this should work. Try to create a view for all types.
Select the fields that you want to display (the fields from students and personal info ). Chose to display both Id's from Student node and from the Personal info node, but make 1 of them invisible, to not be shown. ( you will understand why in step 4 ).
Add a filter, the Global: Fields comparison.
Select the two fields that have to be equal (the ID's).

How to display results tagged with just one term ID when there are multiple filters

I have a blog in Drupal 7 and used Views to display the fields. I have 2 sets of tags displayed on the sidebar:
1) SHAPES
Triangle
Square
Rectangle
2) COLOR
Red
Blue
Green
I created the 2 groups of tags via Structure > Taxonomy > Vocabulary > Add Term
For the View, I created one View with two exposed filters (similar to what was done in this tutorial)
VIEW:
Path: '/blog/tag'
Filter Criteria:
1) 'Content: Shape (exposed)'
Exposed form in Block: 'Yes'
Filter identifier: 'shape_id'
2) 'Content: Color (exposed)'
Exposed form in Block: 'Yes'
Filter identifier: 'color_id'
Exposed form style: BEF
The exposed filters are set to the appropriate block region in Structure > Blocks.
If I click 'triangle', only blog posts tagged with 'triangle' should be displayed. Then if I click 'red', only posts tagged with 'red' should be displayed.
It looks like the correct blog posts are being displayed when I click on the terms. The URL gets appended with IDs from both vocabularies, but I can't seem to get the right combos to display.
Desired URL when 'triangle' is clicked: '/blog/tag/?shape_id=1&color_id=All'
Desired URL when 'red' is clicked: '/blog/tag/?shape_id=All&color_id=1'
So, essentially the results should display items tagged with just one term ID.
However, how it is currently working is that if I click 'triangle', and then 'red', both 'triangle' and 'red' have the 'selected' class (are both bolded) and the url is: '/blog/tag/?shape_id=1&color_id=1'
The only way I was able to get the desired URLs is if I have the '-Any-' option displayed. However, the use case I have is to NOT have '-Any-' listed in the list of tags.
Is this even possible without '-Any-' listed in the list of terms? I have never used multiple exposed filters before, so any guidance would be great as I've researched this for almost a week now. I read in another post that contextual filters would allow me to create separate path aliases that are clean urls, but I have not been successfully able to do this.
Any help would be greatly appreciated. Thank you for your time.
I tried using the taxonomy term pages approach, but could not figure out how to get the fields displaying properly. The fields displayed were based on the teaser in my Blog content type. And using exposed filter option was not a solution since my use case was to only display results based on one tag. What worked for me:
1) Add new view to existing Blog View
2) FORMAT: 'Unformatted list'
SHOW: 'Fields'
3) FIELDS: [add fields that you need displayed]
4) FILTER CRITERIA: 'Content: Published (Yes)'; 'Content: Type (= Blog)'
5) PATH: '/blog/[YOUR VOCABULARY NAME]/%'
6) CONTEXTUAL FILTERS: 'Content: Has Taxonomy Term ID'
WHEN THE FILTER VALUE IS NOT IN THE URL: 'Display all results for the specified field'
WHEN THE FILTER VALUE IS IN THE URL OR A DEFAULT IS PROVIDED: select 'Override title' and in the input field, enter: '[YOUR VOCABULARY NAME]/%1'
select 'Specify validation criteria'
Validator drop-down, select 'Taxonomy Term'
Vocabularies: select appropriate Vocabulary name
Filter value type drop-down: 'Term name converted to term ID'
select 'Transform dashes in URL to spaces in term name filter values'
Action to take if filter value does not validate: select appropriate one that works for your needs (in my case: 'Display contents of "No Results found"')
If you need to display the term name in the heading on the results page, in the same view > HEADER > Add 'Global: Unfiltered Text' > then in text area, add something like "VIEWING RESULTS FOR [YOUR VOCABULARY NAME] / %1"
Save the View. Since I had multiple filters, I cloned the above view and renamed everything. So, I ended up adding 3 additional views to my existing Blog View.
I had previously set URL aliases for Taxonomy Term Paths, so I removed these
Also, I had to go back to my Taxonomy Terms individually and delete the URL alias that was generated from the pattern
To have the list of tags displaying on the right with the desired URL structure of /blog/[YOUR VOCABULARY NAME]/[YOUR TERM NAME], I created a separate new view:
SHOW: 'Taxonomy Terms' of type '[YOUR VOCABULARY NAME]'
Create a Block
'Unformatted list' of 'Fields'
FIELDS: 'Taxonomy: Term Name' > click this and unselect 'Link this field to its taxonomy term page'. Then expand "Rewrite Results" section and select 'Output this field as a link' > in the Link path: 'blog/[YOUR VOCABULARY NAME]/[name]' (the [name] at the end of the url structure should appear as you see it with the square brackets) > select 'Replace spaces with dashes' > Transform the case to 'lower case' > click Apply
FILTER CRITERIA: 'Taxonomy vocabulary: Machine Name (= [YOUR VOCABULARY NAME])'
Save the View
Then in Structure > Blocks, place the block in the appropriate region
Hope this helps someone!

Drupal 7 - assign several products (items) under each category

In D7, I have created a taxonomy (say categories) and set some terms (say category 1, category 2 etc) within it. I have also created a 'View' based on the 'categories' taxonomy and show the categories (category 1, category 2 etc) within the sidebar (block) of the website. Just let me know how can I assign several products (items) under each category so that site visitors can see the product lists on clicking a category from the sidebar. Basically I want to develop a catalogue based website to show products/items under each category.
Kindly help me in this regard.
Good morning,
If you have not done yet, you have to create a custom content type (Structure > Content Types > Add content type) and add as many fields as you need. When you are done, you have to add an extra field named Category, of type "Taxonomy Term Reference" (or something similar, I don't know exactly). You can configure this field so that you can assign several categories to a single product.
Once your contents are created, if you access the taxonomy term's URL, all contents assigned to that category should be displayed. However, you could also define a custom view that receives the name of the category as a parameter in the URL, and displays all contents in this category in a grid, table, list, ... whatever.
Hope it helps.

Drupal 7 Views: Term filter with relationship

I have 2 content types:
One content type is named: "Offer". This content type includes a reference field to choose one hotel, form the other content type: "Hotel". The content type "Hotel" has a term reference field called "sports".
Now I want to build a view filter, which uses the content type "Offer", and uses the sport terms which i get over the hotel relationship.
I already tried to create a relationship on my own:
Reference to the hotel
Added taxonomy field sport with the relationship to the hotel, which i created before
Then i added the taxonomy field to my filter, and selected the Relationship in the drop down menu.
But this doesn't work at all.
Anyone can help me?
Regards M.
The view should initially return the hotel content type.
Add a optional relationship to the offer reference field, this will give you access to the fields in the offer content type. Once you've done that you should be able to add whatever field you want as an exposed filter.
To get the sports working you may have to add the relationship Has taxonomy term in order to get what you want and then add the term as an exposed filter.
Use the patch over at https://www.drupal.org/node/1492260 for autocomplete.
A select list should work the same way as with this patch, but it's built-in. In either case, you have to enable it by checking the checkbox in the content type field config.

How display article from category and show it in block

I have created a content type which has some fields, and I want these fields to be displayed as a block.
I need to display some article like 5 articles from category called sport news only.
How can I do that in drupal 7?
You need to install Views
https://drupal.org/node/1960048
Then create a new view as a block.

Resources