Moving Category Layered Navigation to Bottom of Sidebar in Magento
Moving the Category Layered Navigation to the bottom of your sidebar can significantly improve the user experience by organizing your store’s content more intuitively. In this guide, we’ll walk through the process of achieving this layout change without actually removing the layered navigation block.
Understanding the Current Setup
In your current setup with Magento 1.9 RWD theme, you have attempted to remove the child block ‘category_filter’ from the ‘catalog.leftnav’ container using the unsetChild action in your catalog_category_layered.xml file:
<reference name="catalog.leftnav">
<action method="unsetChild"><child>category_filter</child></action>
</reference>
This code snippet successfully removes the layered navigation block, but that’s not what you want. You merely aim to relocate it.
Relocating the Layered Navigation Block
To move the layered navigation block without removing it entirely, we need to utilize the insert method instead of unsetChild. Here’s how you can do this:
-
Open your local.xml file located in the app/design/frontend/{your_package}/{your_theme} folder.
-
Inside the
<catalog_category_layered>Layout Handle, find or create a reference named ‘left’ and add the following code within it:
<reference name="left">
<action method="insert" after="-">
<blockName>catalog.leftnav</blockName>
</action>
</reference>
- Save your changes and refresh your Magento store.
In this updated XML, we’re using the insert action with the after attribute set to ”-”. This instruction tells Magento to place the ‘catalog.leftnav’ block right after the main content area in your left sidebar (or “left” reference). The ”-” value means the end of the container’s child blocks.
Verifying the Changes
After implementing these changes, visit your catalog page. You should now see that the Category Layered Navigation has moved to the bottom of the left sidebar, appearing after the regular category navigation and any other content you may have in that area.
Remember, the key is to use insert instead of unsetChild, which helps preserve the layered navigation block while moving it to your desired position. Always ensure you’re working within the appropriate layout handles for the specific page type you want to modify.
Additional Helpful Resources
For a more comprehensive understanding of Magento’s layout configuration, I recommend checking out these resources:
- Laravel Company’s Guide on Magento Layout XML
- Magento 2 Official Documentation: Layouts and Themes
These articles provide in-depth insights into Magento’s layout system, helping you navigate the complex world of XML Layout Handles with confidence.
Conclusion
Relocating blocks in your Magento store is a powerful way to customize your site’s appearance and enhance user experience. By understanding how actions like insert and unsetChild work within the layout handles, you can achieve sophisticated layouts without needing extensive coding knowledge.
Remember to always backup your files before making changes and double-check your XML syntax for any potential errors.
Happy coding!