Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
The javascript function "getAdditionalQueryParameters" doesn't correctly detect facets passed in url if there is a number between brackets:
http://domain.tld/search-page?f[0]=products%253Atype%3A10&order=asc&sort=
After enabling a new facet, this generates a strange URL:
http://domain.tld/search-page?f[]=products%253Aauthor%3A250&order=asc&so...
Here is my fix:
File: misc/ajax_facets.js
// Remove brackets from multiple parameter.
- pair[0] = pair[0].replace('[]', '');
+ pair[0] = pair[0].replace(/\[\d*\]/, '');
// We interested only in additional parameters but not in facet parameters.
Hope it helps someone.
Comment | File | Size | Author |
---|---|---|---|
#2 | ajax_facets-extra_facets_not_supported-2707785-2.patch | 482 bytes | Sebastien M. |
Comments
Comment #2
Sebastien M. CreditAttribution: Sebastien M. as a volunteer commentedHere is my patch.
Comment #3
eugene.ilyin CreditAttribution: eugene.ilyin as a volunteer and at DrupalJedi commentedHi
Thank you for your report, but I should reproduce this problem.
How can I reproduce situation when I'll have number between brackets? I have tried to activate some facets but my brackets are always without numbers.
Comment #4
Sebastien M. CreditAttribution: Sebastien M. as a volunteer commentedHi Eugene,
It is not directly generated by this module.
Indeed, when you forge a search url with facets like that :
This will result in this url :
Once a page is called with a such url, javascript is not able to handle correctly facets from the url.
I hope I could explain this issue to allow you to reproduce it.
Many thanks
Comment #6
eugene.ilyin CreditAttribution: eugene.ilyin as a volunteer and at DrupalJedi commentedYes, you are right.
Thank you Sebastien!
Committed.
Comment #7
eugene.ilyin CreditAttribution: eugene.ilyin as a volunteer and at DrupalJedi commented