1

We have a shop and want to remove a item from our left site in our category page and only if someone uses an filter in the category. So not in de default category, only when someone chooses for instance a color.

this is what I tried:

<catalog_category_layered>
<reference name="left">
 <remove name="catalog.leftnav2" />
</reference>
</catalog_category_layered> 

we want to remove the block catalog.leftnav2, and in the situation above it is deleted in also the default category.

Hope someone can help.

1

This is too dynamic to be solved only with XML. What you can do is create an own layout handle

<catalog_category_layered_with_filter>

    <reference name="left">
     <remove name="catalog.leftnav2" />
    </reference>

</catalog_category_layered_with_filter>

And apply it in an observer for the controller_action_layout_load_before event:

public function addHandle(Varien_Event_Observer $observer)
{
    if ($observer->getAction()->getFullActionName() === 'catalog/category/view'
      && count(Mage::getSingleton('catalog/layer')->getState()->getFilters())
    ) {
        $layout = $observer->getLayout();
        $layout->getUpdate()->addHandle('catalog_category_layered_with_filter');
    }
}

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.