Why are facets not displayed on pages? - drupal

I have two entities: Entity Product and Entity Product Category. Entity Product has an entity reference field on the Entity Product Category.
Goal:
Display categories and their number on the right by facets.
What I did:
I created the Product Category view mode and selected it in Entity Product, where I disabled all the fields because I don’t need to display them, because I will display the facets:
Added the necessary fields to the previously created index and once again indexed the Entity Product:
Created view Categories results facets which will be used as Facet source. And in Show:Rendered entity | Settings in settings selected view mode Product Category:
Added a facet:
I chose Categories results facets view as Facet source:
Configured the facets:
Added the Categories results facets block to the Block layout:
But the facets are not displayed on any page.

All of your steps looks fine the only thing i think you are missing is this module https://www.drupal.org/project/core_views_facets
this will allow facets to render in that view after installing this module
go to the view and select Facet serializer that should do the trick hopefully
Check this
Also when you create/register a facet against any view Drupal automatically
creates its block, so for facet to appear on your page the last step you will need to do will be to place the block on your desired sidebar then hopefully facet will be present on that page on page reload.

Place the facets inside a context (any theme region you want them) and then aim the context to the page you want the facets.

Related

Filter View Reference results in paragraph based on taxonomy term selected in Drupal's backend

I have a paragraph named "Car Slider" and a Content Typ "Cars".
The content type consists of different fields like name, make etc. as well as a "Tags" taxonomy reference.
The car slider paragraph consists of fields like headline, description, and a Views Reference to display cars in a slider.
Right now I have different view displays to display only cars with specific tags in the slider, but it sounds unnecessary to have tons of displays, instead I'd prefer to have a dropdown in the backend editor the praragraph where I select the relevant tags and the view filters results to only that tag.
I want to use this to display sliders consisting cars of different categories/tags.
I am aware of the Expose Filter option, but this exposes the filter to the frontend/end-user, but I want to expose it to the admin who decides which content slider to add to the page.
I couldn't find a way to achieve this so far. Can anyone tell me if this is possible and how to achieve this? Thank you!

Exposed views filter made of titles

I'm making a views slideshow of some images.
These images have a title.
I would like to expose this title as a drop-down list filter.
I'm able to do this with pr-configured filter values, but i want this list to be build by the values that the end users gives as a title to a image. (or made of another field like description etc...)
So, when a user uploads images with a title "vacation", i would like this value to come up in the exposed filter in the views slideshow...
Thank you
This can easily be done using the Views Reference Filter module.
Create a views page with the fields you wish to display.
Add an Entity Reference display to your view.
Set which field should act as your search field in the format settings of the Entity Reference display (in this case Content: Title). Remove or exclude all other fields for this display only (override).
To your page display add a filter Content: Nid (entityreference filter) and expose it to visitors. Remember to select the correct view in the "View used to select the entities" drop down if you have more than one Entity Reference views.
Optional steps:
Enable Ajax for your view.
Set the exposed form style setting to auto submit.
If I were trying to accomplish this I would add a taxonomy vocabulary for these images, then I would add a field to the image content type referencing this vocabulary.
After that, I would use create a Rule that would react to saving a new image and add a new taxonomy term to that image that is the title entered.
You can then easily create a filter in views to filter off that taxonomy term and expose that as a dropdown. By doing this each image should have a taxonomy term attached to it that is the image's title. As images are added the taxonomy terms should appear in the dropdown.
Let me know if you need any additional guidance.

Advanced Drupal View filter for taxonomy

I have a content type called product-templates. In this content I capture the following fields: Title (core), content body, taxonomy term reference, and 6 different file types. A new product-template content is created for each template we have. So let's say our products are widgets, broken down by color.. blue, black, brown, pink, green, etc...
The taxonomy has the primary product template categories, for example: blue widgets, black widgets, etc.. Each will have multiple templates for the different sizes, so the term will reference size/style, widget small, medium, large, square, round, etc.
Using the default taxonomy override that comes with views taxonomy/term/% and limiting the filter to product-templates and using fields, rather than full content I get a list something like this: blue-widget small -> template b1s, template b2s, template b3s… / blue-wiget medium -> template b1m, template b2m, and so on. So what I end up with is a full listing on all the product templates with their associated template files.
What I would like to have happen is that when the visitor is on taxonomy/term/% they are presented with a drop down or jump menu that shows the different options, then when they click on (for example) blue-widget small the associated templates render/populate on the page. So basically I want to remove the listing and turn it into a selectable area. Since there could be a large number of options/sizes I don't want to have a list that goes 20 scrolls, and I don't want to have to use a pager. It seem more logical to present them a drop down list that has all the options/sizes they select the one they want and then just those templates pull up.
Any suggestions on how this would be accomplished?
You should be able to accomplish this by adding filter to the view which is taxonomy term, then set it to exposed and use the following url to access all documents.
taxonomy/term/all (this should display all documents)
This will mean that it is applied for all vocabularies, so not a problem if you only have one.

display only unique terms in a view from product in drupal commerce

I have a bunch of wines imported as products in drupal commerce and i want to make a 'regions' page to give a list of all the regions that is automatically populated by pulling the 'region' out of each product but that only displays unique values.
at the moment i have a list of all the products with the same region listed loads of times and i can't find a way in views to only show the regions once.
Try going to 'Settings' under the 'Format' section of your view and setting your region as the 'Grouping field Nr.1' -- you can then list the products from that region underneath or not....
============== EDIT ==================
If you don't want to display the wines under the terms, just start a new view from scratch, and when you're creating it, choose that you want to make this a taxonomy terms view, vs a content view. That should do it!!

Drupal: How to build a categorized menu tree

I need to build a custom menu structure based on taxonomy terms. The Problem is that only the first level should be a Taxonomy-Term. All nested items must be a node. Each node can have only one Term. And Terms without any nodes associated should not appear in the menu.
How could i do that? Any suggestions for me?
Example Menu:
TERM-1
Node-1
Node-2
Node-3
TERM-2
Node-1
Node-2
...
Thank you.
Edit
I need this for a photgrapher website. Each term is a global categorie like Portraits, or Artists. Categories are only a wrapper for galleries. Based on the example Menu above a possible structure could be something like this:
Series (Term)
Bodies (Node:Type->Gallery associated with Term:Series)
Classic Cars (Node:Type->Gallery associated with Term:Series)
Surroundings (Node:Type->Gallery associated with Term:Series)
I would suggest doing this with a view. You will want to create a view which lists nodes, and set the view to group by taxonomy term.
So, create a new view (admin/build/views/add)
View Type: Node - name the view, and proceed to next page.
Filters
Node: Published - yes
Node: Type - Gallery
[optional] Taxonomy: Vocabulary = Series - this will hide galleries which have not been assigned to a Series.
Fields - delete the labels for fields as you add them
Taxonomy: All Terms - you could also use Taxonomy: Term, but if you have more than one taxonomy, such as free tagging, then those free tags would show up too, so All Terms is better because you can limit the vocab.
check the checkbox - Exclude from Display
limit terms by vocabulary - Series
Node: Title
check the checkbox - Link this field to its node
Basic Settings
Style: Unformatted
click on the cog to change settings and set Grouping Field to Taxonomy: Term
Items to Display : 0 - since you do not want a pager, you probably want to display all the results.
Sort Criteria - you will be adding two sort criteria...
Taxonomy: Weight - this controls the order for the groups - you will have to set your taxonomy term weights in the taxonomy administration area. (You could also just sort it by Taxonomy: Term if you want the terms to appear in alphabetical order.)
Node: Title - this controls the order for the nodes within each group.
Taxonomy menu trails solves this problem.

Resources