Hi!

I have a trouble with integer facets.

How to reproduce it:

1. Select taxonomy facet (in my case, facet URL will be: manufacturer/team-1104)
2. Select integer facet: manufacturer/team-1104/warranty/56
3. Try to select taxonomy facet: manufacturer/team-1104/warranty/160-gb-56/ram-size/4-gb-52

As you can see warranty/56 were switched to warranty/160-gb-56

When i explored, what does it mean "160-gb-56", i found that taxonomy term with tid=56 has alias "160-gb-56"

So, it like that value of integer field interpeted as taxonomy term id, and replaced with it's alias.

CommentFileSizeAuthor
#7 facetapi_pretty_paths-1890122-1.patch548 bytessun-fire

Comments

dasjo’s picture

hi, that's weird.

i don't have time to verify right now, but if you want to try to debug this, take a look at how facetapi_pretty_paths_coder_callback is called and which facetapi pretty paths coder gets selected in the process.

you might want to use live debugging (xdebug) or output variables using dpm() of devel module + ddebug_backtrace() to see how the function gets called.

sun-fire’s picture

Thank for your advice where to start digging. I've dsm $args array in function facetapi_pretty_paths_coder_callback just after

if ($class = ctools_plugin_load_class('facetapi_pretty_paths', 'coders', $id, 'handler')) {
    $args = func_get_args();

and have found that the $args[1]['segment']['facet'] and $args[1]['facet'] is the current first active facet (not the related to current segment). Maybe, it is the reason for the issue (when the first active facet is not taxonomy - all work fine and if it is taxonomy - we have the issue). Where to look further? Thanks!

dasjo’s picture

ok, now we need to go up the chain: as stated ddebug_backtrace() will give you of the calling functions, i recommend using it to figure which functions to inspect. you should end up going to encodePathSegment() and further constructPath() to examine the structure of $segments in order to check how the whole segments structure with the facets looks like.

then have a look at getPathSegment() as here the segments are generated. it is used primarily in fetchParams() where all the initial magic happens. there is actually a code comment that indicates that i experienced some weird behavior with using references:

"Copy" to prevent $segment['facet'] from being overridden.

i think this is the place where trouble could be caused

dasjo’s picture

you could try doing $my_facet = clone $facet; instead of $my_facet = $facet; in fetchParams() but that would be a hack because we don't really want to copy the object but just the reference...

sun-fire’s picture

I found that when change 'facet' => &$facet to 'facet' => $facet in function getPathSegment (url_processor_pretty_paths.inc), all work fine.

dasjo’s picture

glad to hear, could you provide a patch so we can get this fix in?

sun-fire’s picture

StatusFileSize
new548 bytes

This is a patch for #5
dasjo, thanks for your advices

dasjo’s picture

Status: Active » Needs review

thx, looking forward to get this in

dasjo’s picture

i was able to reproduce the problem. it actually applied for any combination of mixed facet types.
committed, thanks!

dasjo’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

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