简体   繁体   English

Drupal 8使用产品类型和分类术语查看上下文过滤器

[英]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. 我希望products/type/kind仅显示具有产品类型的type并且在特定词汇表中具有kind作为术语的产品。

type and kind contain values which include spaces. typekind包含包含空格的值。 I think at least part of my problem is converting spaces in type to a dashes. 我认为至少部分问题是将type中的空格转换为破折号。

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'. 设置上下文过滤器,用于当过滤器值不可用于“提供默认值”时,类型为“来自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). 对于该术语,我/认为/您需要分类术语名称(可能是分类术语名称作为术语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. 这就是我被抓到的地方。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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