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.
Currently this module doesn't play nice with Facet API Pretty Paths
It would be great if it did. Not sure if this requires changes in this module, FAPP or both.
It currently receives no 'pretty paths' and when one range facet is applied it causes all the facet links to act as if no facet is applied (remove links link to the base search, add links link to the base search + just that one facet).
Comment | File | Size | Author |
---|---|---|---|
#36 | 1511144-text-widget.patch | 2.1 KB | stockliasteroid |
#22 | 1511144-22.patch | 3.12 KB | Anonymous (not verified) |
#9 | 1511144-9.patch | 879 bytes | Anonymous (not verified) |
#6 | 1511144-6.patch | 3.88 KB | Anonymous (not verified) |
Comments
Comment #0.0
Shadlington CreditAttribution: Shadlington commentedExtra info
Comment #1
Shadlington CreditAttribution: Shadlington commentedCross-posted at facet api pretty paths: #1511148: Please make compatible with Search API Ranges
Comment #2
giorgio79 CreditAttribution: giorgio79 commentedFacet API Pretty Paths just implemented pluggability so this module can integrate with it..#1431682: Plan & implement pluggability
Comment #3
Anonymous (not verified) CreditAttribution: Anonymous commentedI support this feature, will have a look at that pluggability. If anyone is working on a patch, let us know.
Comment #4
Anonymous (not verified) CreditAttribution: Anonymous commentedComment #5
Anonymous (not verified) CreditAttribution: Anonymous commentedPlease help out over here:
http://drupal.org/node/1511148#comment-6166790
Closing this one.
Comment #6
Anonymous (not verified) CreditAttribution: Anonymous commentedAttaching a patch! Apply the patch and refresh the Drupal cache.
Comment #7
dasjohi morningtime,
glad to see you are using the coders plugin system for pretty paths!
one questions: how does SearchApiRangesCoderRanges differ from the base FacetApiPrettyPathsCoderDefault?
i can't see any differences in the current implementation and would suggest that you only override the methods that actually differ.
FacetApiPrettyPathsCoderTaxonomy is built in a similar way.
Comment #8
Anonymous (not verified) CreditAttribution: Anonymous commentedAlright, that's a good idea. I don't really need a separate Class. Will remove it
Comment #9
Anonymous (not verified) CreditAttribution: Anonymous commentedThis simpler patch should do the trick. No need for a separate coder file.
Comment #10
Anonymous (not verified) CreditAttribution: Anonymous commentedSimplest solution commited to devx.
http://drupalcode.org/project/search_api_ranges.git/commit/e6a4419
Comment #11
dasjohi,
again, i'm curious: why do you need to alter the facet info anyways? i suppose, the facetapi pretty paths module's default behavior would suffice to have it work if you don't implement a custom coder.
Comment #12
HazaThis commit/patch add 2 times
and results in
This commit should be reverted. (and fixed ;) )
Comment #13
Anonymous (not verified) CreditAttribution: Anonymous commented@dasjo, (I think) because Search Api Ranges uses its own FacetAPi widget_links.inc with a different Controller Class.
@haza OK, I fixed the duplicate,
http://drupalcode.org/project/search_api_ranges.git/commit/5f847a9
Comment #15
khiminrm CreditAttribution: khiminrm commentedPlease, help. Doesn't work for me. I've tried both dev and stable versions of the module, but "Pretty path alias" doesn't replace default field alias in the url. Have tried for different types of fields: taxonomy, decimal. Maybe I missed something. What should I check to find a solution? With dsm function I see that the code
$facet['facetapi pretty paths coder'] = 'default';
applied to my facet block with slider widget.Comment #16
khiminrm CreditAttribution: khiminrm commentedI've did some research and found that the form in slider has action url without Pretty path alias for current facet. Is this correct? Because facets based on link widget already have url with pretty path aliases.
Comment #17
khiminrm CreditAttribution: khiminrm commentedMaybe the solution would be to add Pretty path alias to $variables array in widget_links.inc file and use it in the search_api_ranges_block_view_form_submit function to build the path for drupal_goto function?
I have made some modifications in my local copy of the Search API ranges module and have some success.
I am not very strong in php and facet api. So dont judge me strongly.
I've added to widget_links.inc:
To get Pretty path alias for current facet
And in search_api_ranges.module:
It works for me. But when I change ranges in slider for the second time, the path contains facet alias twice but the widget is still working.
First time after applying slider: http://mysite/catalog/videocard/price/[249 TO 1550]
Second time: http://mysite/catalog/videocard/price/price/[249 TO 979]
Comment #18
khiminrm CreditAttribution: khiminrm commentedComment #19
Anonymous (not verified) CreditAttribution: Anonymous commentedYou're right, we need to read the 'pretty path alias'. I couldn't figure out how to do that yet.
I'll have a look at this soon as possible.
Comment #20
khiminrm CreditAttribution: khiminrm commented@morningtime Hello. Thanks for your response! I've written in #17 how I get it in widget_links.inc:
But I think that this code may be shorter and simpler.
Comment #21
dasjoi think the best solution would be if you could rely on generic facetapi functions in order to determine the paths. so no custom hacking would be required
Comment #22
Anonymous (not verified) CreditAttribution: Anonymous commentedA patch attached, try it out?
I found the path alias like this
Comment #23
khiminrm CreditAttribution: khiminrm commentedI've just tested. Works! Thanks! Strange '?' in the end of the url, but it works with other facets. Great work!
Comment #24
khiminrm CreditAttribution: khiminrm commentedI've noticed some strange behavior. It worked until copying tpl.php file or theme function for slider to my theme and flushing all caches. After applyng a patch I had urls like
price/[245 TO 5000]?
,price[245 TO 5000]/price[245 TO 2000]&?
and all worked. Now I have one segment for multiple using of price slider and after using other facet the url becameprice/manufacture/asus/price/[245 TO 5000]
. I've restored changes in my theme and clear cache, but no succes. I am testing further... Maybe I am doing something wrong.Comment #25
khiminrm CreditAttribution: khiminrm commentedHave found my problem: I had dsm function in my tpl file for views page. Slider works good when I removed this function.
Comment #26
khiminrm CreditAttribution: khiminrm commentedOne more issue when I applied the patch http://drupal.org/node/1539472#comment-6157996. When I use slider and other facet have wrong url:
price/manufacture/asus/price/[245 TO 5000]
. How to solve this? I need that patch for my site too.Comment #27
khiminrm CreditAttribution: khiminrm commentedFound temporary solution: replaced
$_GET['q'] = $item['href'].'/'.$search;
within url_processor_pretty_paths.inc after applying that patch
Comment #28
Anonymous (not verified) CreditAttribution: Anonymous commentedOk thanks for testing. Will apply this patch, so we can go from there.
Comment #29
Anonymous (not verified) CreditAttribution: Anonymous commentedOk committed to dev-x
http://drupalcode.org/project/search_api_ranges.git/commit/b03ac76
Comment #31
giorgio79 CreditAttribution: giorgio79 commentedThis does not seem to work for me with i18n and locale installed, and getting htmlencoded paths like this
mysite.com/en/en/price/%5B6959%20TO%2026499%5D?
There is still a question mark added at the end.
The module worked fine with 1.3.
Comment #32
Anonymous (not verified) CreditAttribution: Anonymous commentedHi, I think the html encoded path is correct, spaces will be %20 and brackets will be like %5B, %5D. The brackets aren't arrays like ?f[0] so that's why I think they are encoded correctly.
Let's see about the i18n paths indeed.
Comment #33
doliveros CreditAttribution: doliveros commentedHello morningtime,
Although the range slider widget is compatible with pretty paths, I believe the link widget is not, as I'm still getting the previous query format: shop?f[0]=search_api_aggregation_1%3A[20 TO 30].
Do you think that applying #29 patch's code to widget_links.inc would solve the problem?
Thanks a lot.
Comment #34
doliveros CreditAttribution: doliveros commentedHello again, morningtime.
I've managed to get the link / range price facets working, and while I was at it, I discovered a strange behaviour / bug that should be noted:
I had 3 ranges: 0-50, 50-100 and 100-200, but only the 0-50 range was showing up. After some debugging, I found out the number of elements used to populate the ranges ($element = &$this->build[$this->facet['field alias']];) where getting hard-limited by the facet's configuration "Hard Limit: Display no more than this number of facet items."
I had it at 15, thinking the maximum number of range facets would be topped at 15. After setting the facet's hard limit to unlimited, the three filters appeared normally.
By the way, I got it working with the following code (Not sure how to create a patch file. You'll recognise these parts on "widget_links.inc" anyway):
and
It's probably not the best way to handle it, quite dirty, but did the job. Now I'm not sure why the selected price range always have the class "facetapi-inactive".
Comment #35
khiminrm CreditAttribution: khiminrm commented#34 works for me
Comment #36
stockliasteroid CreditAttribution: stockliasteroid commentedHere's #34 as a patch...
Comment #37
Anonymous (not verified) CreditAttribution: Anonymous commentedThanks. #34 is now commited in the patch of #36. Committed to the dev-x branch.
http://drupalcode.org/project/search_api_ranges.git/commit/e56ae3d
Comment #39
khiminrm CreditAttribution: khiminrm commentedHello! I found the bug in the code. See there https://drupal.org/node/2049977
I think the problem is in redefining
$range_field
before sending variables to the functionssearch_api_ranges_generate_ranges_simple
andsearch_api_ranges_generate_ranges_advanced
.I think we must first execute these function to get $element and then do replace paths. I'm trying to do that now. I will write if I'll have any luck.
Comment #40
dasjoi'd recommend opening a follow up issue and maybe add a link here, as this one has already been committed
Comment #41
khiminrm CreditAttribution: khiminrm commented@dasjo, ok. I'm closing this issue. All further comments will be there https://drupal.org/node/2049977.
I've noticed that DavidOliveros wrote about this bug in #34:
Comment #41.0
khiminrm CreditAttribution: khiminrm commentedMore
Comment #42
Exploratus CreditAttribution: Exploratus commentedstill a problem
Comment #43
errev CreditAttribution: errev commentedStill is working no good.
Problems with the links that should be invisible but instead are displaying!