Removing the Customer Navigation Sidebar in Magento
If you’re running Magento 1.7.0.2 or later and want to remove the customer navigation sidebar from your my account dashboard, you can achieve this by making some specific changes to your layout XML files. Here’s a step-by-step guide on how to do this without affecting other pages with left sidebars.
Understanding the Layout Structure
In Magento, the layout structure for the customer my account page is defined in two main places:
-
The core
customer.xmlfile located atapp/design/frontend/base/default/layout/customer.xml. This contains the base structure for all customer-related layouts. -
Your custom theme’s
local.xml, which is usually found atapp/design/frontend/default/custom_template/layout/local.xml. This is where you can override or add to the core layout definitions.
The Current Layout Structure
Looking at your provided customer.xml file, we see that the customer navigation sidebar is defined under the <reference name="left"> block. This contains the account navigation links and the cart sidebar:
<reference name="catalog.compare.sidebar" />
<remove name="tags_popular" />
<!-- Customer Account Navigation -->
<block type="customer/account_navigation"
name="customer_account_navigation"
before="-"
template="customer/account/navigation.phtml">
...
</block>
<!-- Cart Sidebar with Item Renderers -->
<block type="checkout/cart_sidebar"
name="cart_sidebar"
template="checkout/cart/sidebar.phtml">
<action method="addItemRender">
<type>simple</type>
<block>checkout/cart_item_renderer</block>
<template>checkout/cart/sidebar/default.phtml</template>
</action>
...
</block>
Removing the Navigation Sidebar
To remove the navigation sidebar from the my account page only, you need to comment out or delete these blocks in your custom theme’s local.xml file:
<reference name="customer_account">
<reference name="left">
<!-- Comment or Delete this block -->
<block type="customer/account_navigation"
name="customer_account_navigation"
before="-"
template="customer/account/navigation.phtml">
...
</block>
<!-- Comment or Delete this block -->
<block type="checkout/cart_sidebar"
name="cart_sidebar"
template="checkout/cart/sidebar.phtml">
...
</block>
</reference>
</reference>
By comment out these blocks, you’re effectively removing them from the layout structure, which will eliminate both the customer navigation links and the cart sidebar on the my account dashboard.
Ensuring Only My Account is Affected
The key to making this change only affect the my account page is ensuring that your customizations are applied to the customer_account handle specifically. In your provided local.xml, you’ve already set up a reference for this:
<reference name="root">
<action method="setTemplate">page/1column.phtml</action>
</reference>
<reference name="content">
...
</reference>
<!-- My Account Page Layout -->
<reference name="customer_account">
...
</reference>
Conclusion
By following these steps and making the necessary changes in your custom theme’s local.xml file, you should be able to successfully remove the customer navigation sidebar from the my account dashboard without affecting other pages with left sidebars.
Remember, always backup your files before making any significant changes. If you’re unsure about any part of this process, feel free to reach out to our team at LaravelCompany for further assistance: https://laravelcompany.com.