Comments

damienmckenna’s picture

Status: Active » Needs review
StatusFileSize
new1.19 KB

This is the theory, I need to test it.

damienmckenna’s picture

StatusFileSize
new1.22 KB

Verify that $item['#count'] exists, just to be sure.

damienmckenna’s picture

It'd be really nice to be able to hide all facets if there's only one search result, but I suspect it's wishful thinking for now.

damienmckenna’s picture

StatusFileSize
new1.22 KB

Doh! Forgot to actually check for $count > 1.

damienmckenna’s picture

StatusFileSize
new1.8 KB

This version adds two filters - one to remove the facet if there's only one total count, one to remove the filter if there's only one matching item for this facet.

criscom’s picture

Patch in #5 works for me. Thanks, Damien!

Scott Robertson’s picture

#5 is working for me as well.

sebastien m.’s picture

#5 is working for me too.
thanks

sebastien m.’s picture

seems to be not working with 'parent_all' taxonomy facets in case of one parent is selected and contains multiple children.
I think that an element shouldn't be hidden if selected.

brockfanning’s picture

StatusFileSize
new2.34 KB
new905 bytes

I can't test this at the moment but it should fix #9.

brockfanning’s picture

To follow up, I did get a chance to test #10, and it seems to work fine.

brockfanning’s picture

StatusFileSize
new2.57 KB
new1.11 KB

One consequence of filtering out single-item facets is that if a user selects 1 item from a 2-item facet, then that facet will disappear, which prevents the user from de-selecting that facet. (They just have to click the back button.)

That seems undesirable to me, so here is an updated version of the patch to deal with that.

brockfanning’s picture

Status: Needs review » Closed (won't fix)

I recently noticed that the dev version of facetapi_bonus has this functionality. I'll close this issue since there's an existing solution for the problem.