简体   繁体   中英

Drupal 8 views contextual filter using product type and a taxonomy term

I'm having troubles getting the contextual filter to work on a view.

I want products/type/kind to show only the products which have a Product Type of type and have kind as a term in a particular vocabulary.

type and kind contain values which include spaces. I think at least part of my problem is converting spaces in type to a dashes.

I think I have it working. Set the contextual filter for when a filter value is not available to 'provide a default value', type of 'Raw Value from URL'.

Set the 'When the filter value is available or a default is provided' to validate the type you want. For the term, I /think/ you need taxonomy term name (possibly taxonomy term name as term id).

Be careful to use machine names for product type (ie spaces in machine names are _'s) and to replace spaces with -'s in taxonomony terms. This is where I was getting caught.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM