0

I have made an indexed view of my products. In that view, i have a page and a block. If I output the block from drupal/admin/structure/block the block view is shown together with the facet blocks.

Due to some conditions, I prefer to output the indexed view block programmatically, via page.tpl.php, and views_embed_view(), the indexed view block is shown correctly but then the facets are not displayed. Here is my code:

//level 2 webshop/categorie/subcategorie
            elseif( count($url_array)==4 && $url_array[1]=="webshop"){
                // if ($url=="/webshop/auto"){
                $tax_arr=taxonomy_get_term_by_name($url_array[3],"product_categorie");
                $tax=reset($tax_arr);
                $tax_chi=taxonomy_get_children($tax->tid);
                $tax_chi_tids = "";
                $counter=0;
                foreach ($tax_chi as &$child) {
                    if ($counter == 0){
                        $chtid =$child->tid;
                    $tax_chi_tids .=$chtid ;
                    }
                    else{$tax_chi_tids = $tax_chi_tids."+".$child->tid;}
                    $counter ++;
                }
                //echo views_embed_view('product_categorieen', 'block_1',$tax->tid);
                echo views_embed_view('view_products_index_product_hh','block_1',$tax_chi_tids);
            }
0

For now, i have fixed it, putting the facet blocks also in the page.tpl.php, for me in the first sidebar. I iterated all active facet blocks in the block table an d then displayed each one with this code:

        $block_facet = block_load($module, $delta);
        print render(_block_get_renderable_array( _block_render_blocks(array($block_facet))));

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.