Not returning products matching the tid provided

Created on 28 July 2021, over 3 years ago
Updated 16 August 2023, about 1 year ago

When using the contextual filter (argument) "Has taxonomy term ID (with depth)" to filter a view, the query doesn't return results of products matching the tid provided. Results are returned only if the tid matches a parent or a child of the product's category (depending on the depth set).

The bug is found in the query() method of the commerce_product_taxonomy_index_tid_depth plugin, where the code does

$where = (Database::getConnection()->condition('OR'))->condition('tn.tid', $this->value, $operator);

where it should do

$where = (Database::getConnection()->condition('OR'))->condition('tn.tid', $tids, $operator);
🐛 Bug report
Status

Fixed

Version

1.0

Component

Code

Created by

🇬🇷Greece vensires

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇬🇧United Kingdom griz

    This appears to be broken again in the current release. Making this change to the code still fixes the issue, but it needs to be committed to the current version again.

  • 🇬🇷Greece vensires

    The fix is still available in the latest version too. The fix was targeting the contextual filter (argument) "commerce_product_taxonomy_index_tid_depth" though. Since you mentioned a select list, you must refer to something else. I that case, I would suggest that you create a new issue and add this issue as related.

  • 🇬🇧United Kingdom griz

    Ah, yes - you're right. The problem I'm having is with the exposed filter, not the contextual filter. I'll create a new issue.

Production build 0.71.5 2024