Support » Plugin: Advanced Search by My Solr Server » [Facet] Multi-level Categories (solution)

  • Hi there, I got a problem when I tried to facet the multi-level categories.
    On the sidebar, there was some (or always) empty category facets (Category_name (0)

    Here is the solution: (edit file advanced-search-by-my-solr-server.php)

    Find this function:

    function mss_print_facet_items($items, $pre = "<ul>", $post = "</ul>", $before = "<li>", $after = "</li>",
    $nestedpre = "<ul>", $nestedpost = "</ul>", $nestedbefore = "<li>", $nestedafter = "</li>")

    And replace that function with:

    function mss_print_facet_items($items, $pre = "<ul>", $post = "</ul>", $before = "<li>", $after = "</li>",
    $nestedpre = "<ul>", $nestedpost = "</ul>", $nestedbefore = "<li>", $nestedafter = "</li>") {
    	if (!$items) {
    	printf(__("%s\n"), $pre);
    	foreach ($items as $item) {
    		if (isset($item['items']) && count($item['items'])) {
    			mss_print_facet_items($item["items"], "<ul>", "</ul>", "<li>", "</li>", "<li><ul>", "</ul></li>", "<li>", "</li>");
    		} else {
    			printf(__("%s<a href=\"%s\">%s (%s)</a>%s\n"), $before, $item["link"], $item["name"], $item["count"], $after);
    	printf(__("%s\n"), $post);

    Hope this can help. If any problems, please let me know. Thanks!

  • The topic ‘[Facet] Multi-level Categories (solution)’ is closed to new replies.