Moving Category Descriptions Below Products in Magento
If you’re looking to relocate your category descriptions from above your products to below them in Magento Commerce 1.9, you’ve come to the right place. I’ll guide you through this process step by step.
Understanding the Default Behavior
By default, Magento places the category description at the top of the category view page. This is hardcoded into the layout XML files and the template phtml files. To move it down, we need to make some strategic changes in these files.
Step 1: Identify the Relevant Files
Open your Magento installation and navigate to app/design/frontend/{your_package}/{your_theme} directory.
Locate the catalog.xml layout file under layout. This is where the category view layout configuration lives. Open this file for editing in a text editor or IDE.
Step 2: Find the Category Description Element
In the <reference name="content"> block, search for this line:
<reference name="category.products">
<block type="catalog/category_view" name="category.products" as="products" template="catalog/product/list.phtml"/>
</reference>
This is where Magento displays your products in a category.
Step 3: Insert the Description Below Products
To move the description block below the products, we need to create a new block and reference it after the products. Update your catalog.xml file as follows:
<reference name="content">
<block type="catalog/category_view" name="category.description" as="description" template="catalog/category/view.phtml"/>
<block type="catalog/category_view" name="category.products" as="products" template="catalog/product/list.phtml"/>
<!-- Add this reference to move the description below products -->
<reference name="category.products">
<after>
<block type="core/text_list" name="category.description" as="description">
<action method="setArea"><area>frontend</area></action>
</block>
</after>
</reference>
</reference>
In this updated code, I’ve moved the category.products block reference below the category.description block. This ensures that the description is rendered after the products.
Step 4: Save and Verify
Save your changes to the file and then flush Magento’s cache either via SSH (php bin/magento cache:flush) or through the admin panel (System > Cache Management).
After flushing, visit a category page in your frontend. You should now see that the category description has moved below your products.
Conclusion
Moving the category description is a straightforward process when you understand the layout structure of Magento. By editing the layout XML file and strategically placing our blocks, we can customize the Magento store to meet our specific business needs.
Remember, always backup your files before making any changes and test thoroughly in a staging environment before pushing to production.
For more advanced customizations and for professional assistance with your Magento development, feel free to reach out to us at Laravel Company. We provide expert Magento consulting services to help you optimize your e-commerce platforms.