My catalog product use 3 Columns Layout. The layered navigation in the right The product in the center The cart in the left. my problem when i don't have a product in the category the right column is empty. I wish when my category is empty ma catalog product transform from 3 columns to 2 columns. Can i do that by code ?


I think this is the idea.

    $id = Mage::getModel('catalog/layer')->getCurrentCategory()->getId(); 

    $count_prods = Mage::getModel('catalog/category')->load($id)->getProductCount();

    if ($count_prods < 1)


You can create a new module with an observer to catch the controller_action_layout_load_before event. So you can put this code in the Observer.php of your module.

Take a look here. https://stackoverflow.com/questions/15616489/magento-event-on-any-page-load.

Here is a tutorial on how to create a module with an observer. http://coding.smashingmagazine.com/2012/03/01/basics-creating-magento-module/

  • Thanks where i can try to add that ? – Amirov Nov 30 '13 at 7:55
  • i updated my post. – Nikitas Nov 30 '13 at 16:00

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.