Cannot filter properly when using facet pretty paths

Created on 15 December 2021, almost 3 years ago
Updated 26 May 2024, 6 months ago

Problem/Motivation

Upgraded to Drupal 9, Facets 2.0.0, and facet pretty paths 8.x-1.2

When pretty paths are enabled, the urls have extra/duplicate filters shown.

Also I cannot uncheck a filter when clicking on the (-) next to the selected filter. The link is going to the facet itself instead of the parent facet.

When using multiple filters, the filters appear across both, creating duplicate filters in the url. For example Filtering by toys and then location, my url shows the toys category multiple times. /results/c/toys-1/c/toys-1/l/alberta-123

Changing my facet settings url processor back to query string allows the facet filtering to work correctly

Steps to reproduce

  • upgrade to Drupal 9, Facets 2.0.0 and use Facets Pretty Paths 8.x-1.2
  • Create a facet (I used a taxonomy term facet)
  • Filter on an item
  • Try to un-filter on same item

Proposed resolution

Fix how pretty paths is converting facet params into urls

Remaining tasks

fix url processing

User interface changes

None

API changes

None

Data model changes

None

πŸ› Bug report
Status

Fixed

Version

1.4

Component

Code

Created by

πŸ‡¨πŸ‡¦Canada sagesolutions

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.

  • πŸ‡§πŸ‡¦Bosnia and Herzegovina nno

    #45 works great. Thank you very much!

  • πŸ‡¨πŸ‡¦Canada joseph.olstad

    Patch 45 works great on 1.4.0

    Great work and is desperately needed!

  • Status changed to RTBC over 1 year ago
  • πŸ‡¨πŸ‡³China hongqing

    Patch 45 does not work well with Drupal 10.0.8 with Facets 2.0.6 and Facets Pretty Paths 8.x-1.4. Without this patch, the url/category_a/1/category_b/11 becomes /category_a/1/category_b/11/category_a/1/category_b/12, with this patch, the url becomes category_a/1/category_b/11/category_b/12 but not category_a/1/category_b/11,12 as expected.

  • πŸ‡³πŸ‡±Netherlands ifrik

    Using Facets Pretty Paths 8.1.4 and Facets 2.0.5

    Patch #13 works when used together with patch #3 from [3268360]

    Patch #45 does not work for me, neither with or without the Facets patch

  • πŸ‡ΊπŸ‡ΈUnited States fallenturtle

    I'm using Pretty Paths 8.x-1.4 and Facets 2.0.6. After patch 45 when I click on a facet it adds it to the url, but the facet itself doesn't get checked.

  • πŸ‡·πŸ‡ΈSerbia krug

    Drupal Version 9.5.9
    PHP Version 8.1.15
    facets 2.0.6
    acets_pretty_paths 8.x-1.4

    Before the patch. Category multiple times.
    test.com/products/aaaaa/525/aaaaa/525/bbbbb/523/aaaaa/525/aaaaa/525/bbbbb/523/ccccc/325/aaaaa/525/aaaaa/525/aaaaa/525/aaaaa/525/bbbbb/523/bbbbb/523/ccccc/325/ddddd/332

    Patch #45 works great. Thank you very much!

  • Status changed to Fixed about 1 year ago
  • πŸ‡©πŸ‡ͺGermany marcoka

    Thank you very much.

    Feedback: That also works here with
    drupal 10.1
    facets 2.0.6
    and Facets Short Pretty Paths 1.0.0-alpha4

  • Automatically closed - issue fixed for 2 weeks with no activity.

  • Status changed to Fixed 6 months ago
  • πŸ‡¨πŸ‡³China hongqing

    It seems the patch cannot be applied to Facet Pretty path 2.01. I got the following error:

    Checking patch src/Plugin/facets/url_processor/FacetsPrettyPathsUrlProcessor.php...
    error: while searching for:
          }
          $pretty_paths_presort_data = $this->sortByWeightAndName($pretty_paths_presort_data);
          $pretty_paths_string = implode('', array_column($pretty_paths_presort_data, 'pretty_path_alias'));
          $url = Url::fromUri('internal:' . $facet->getFacetSource()->getPath() . $pretty_paths_string);
          $url->setOption('attributes', ['rel' => 'nofollow']);
    
          // First get the current list of get parameters.
    
    error: patch failed: src/Plugin/facets/url_processor/FacetsPrettyPathsUrlProcessor.php:162
    error: src/Plugin/facets/url_processor/FacetsPrettyPathsUrlProcessor.php: patch does not apply
Production build 0.71.5 2024