I need two layered navigation blocks on the same page (one at the top with select dropdowns) and one in sidebar with more similar to default styling. Additionally, there could be restriction on attributes, so top and sidebar can have different attributes to filter.
My first thought was just make another instance of layered nav block and pass there different template file. But then it turned out that templates assignment is buried inside block logic.
So, I decided to override block and create there methods like excludeAttribute or setStyling, and then call them within layout file for each block. Unfortunately, this doesn't work either, I guess because the logic for getting attributes and setting up child blocks in located under _prepareLayout method, which is being called before my methods. Then I tried to defer this evaluation, by creating wrapper block file, which has my methods for passing attributes and styling and save that data. Then, in _toHtml method of my wrapper block I create my overridden layer_view block, and pass there these settings. Constructor of layer_view block handles that data and calls _prepareLayout method using them, assigning different templates for child blocks and getting customized attributes collection to filter.
Visually, that seems to work. I can set filters and both blocks are getting updated properly (though both shows global active filters). But for some reason filtering itself doesn't work (products in category stays the same). So in short: if I create my layer_view block within layout file the filtering works, but I can't pass anything there. If I create wrapper block which then creates layer_view block programmatically via
$this->getLayout()->createBlock method, I can pass my settings but I lose filtering. What can possibly be wrong with creating this block programmatically?
Maybe I'm going in wrong direction and it should be done in different way?