In my case, as specially with the prospect of inclusion of #1393928: Add a per-facet setting that allows only one item to be active at a time, I didn't want the parent items of a hierarchical facet to be set automatically when a children was selected, but rather treat them as individual items.

I could have patched the module for my needs but thought better to try to push a setting for it to be included.

Comments

hanoii’s picture

Status: Active » Needs review
StatusFileSize
new3.91 KB
hanoii’s picture

Status: Needs review » Needs work
hanoii’s picture

Status: Needs work » Needs review
StatusFileSize
new3.7 KB

Properly formatted patch.

justanothermark’s picture

I had a similar issue but didn't see this issue until after writing a patch. I haven't had chance to test the patch in #4 since I spent so long getting a working solution but I've included my patch as the approach is quite different.

My patch modifies FacetapiUrlProcessorStandard::getQueryString() to modify the created links so that clicking a child will remove the parent from the URL (for OR facets) and so that deactivating a child facet will enable the parent (i.e. only deselect the lowest level). However, this does involve changing the parameter passed through & therefore counts as an API change that could break other modules.

Status: Needs review » Needs work

The last submitted patch, 5: 2244933-5-facetapi-release-parent-bond.patch, failed testing.

hanoii’s picture

@justanothermark I know it's an extra mile, but your patch failed testing and you mentioned of an API change, mine does not change the API and passed tests, could you try it for your case and see if it works for you the same as yours? If it does at least we'll have another tester.

i will hide yours in the meantime to keep the issue with one patch to review for now.

khiminrm’s picture

@hanoii, thanks for the patch! It works for me. I also need such behavior for hierarchical facets.

hanoii’s picture

Status: Needs work » Needs review
StatusFileSize
new3.7 KB

bumping this one as the related issue was included, re-rolling for latest dev although patch still applies.

hanoii’s picture

cpliakas’s picture

Status: Needs review » Reviewed & tested by the community

Thanks for the contribution. Cool feature!

The patch works as advertised so marking as RTBC, however I do want to revisit the setting's name prior to releasing 7.x-1.5 just to make sure it is clear to people what it does. The description looks great, but as we know from UX studies people open don't reed the small gray text :-)

Thanks again, and great work.
Chris

cpliakas’s picture

Title: Setting to treat parent items as individual facet items » Allow parent terms in a hierarchy to be enabled / disabled independent of their children
Version: 7.x-1.3 » 7.x-1.x-dev

  • cpliakas committed 62aa313 on 7.x-1.x authored by hanoii
    Issue #2244933 by hanoii: Allow parent terms in a hierarchy to be...

  • cpliakas committed ddf5c94 on authored by hanoii
    Issue #2244933 by hanoii: Allow parent terms in a hierarchy to be...
cpliakas’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

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