what file to change for this to remove compare block?
-
12-12-2019 - |
Question
when going to www.domain.com/customer/address/edit/id/1/
where one can edit their address
for some reason there is a block compare in left sidebar
what file do i need to edit to remove this?
Thanks
Carlo
In my layout.xml (app/design/frontend/mythemepackage/default/layout/local.xml)
i have this:
<!-- CUSTOMER ACCOUNT %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -->
<customer_account>
<reference name="left">
<!-- Remove cart from the left column -->
<action method="unsetChild"><name>cart_sidebar</name></action>
<!-- Remove Compare block, it is already inserted in DEFAULT section -->
<action method="unsetChild"><name>catalog.compare.sidebar</name></action>
</reference>
</customer_account>
the default section it refers to is this i guess in same file:
<?xml version="1.0" encoding="UTF-8"?>
<!-- Left ====================================================================== -->
<reference name="left">
<remove name="left.newsletter"/> <!-- Moved newsletter to the footer -->
<action method="unsetChild"><name>left.permanent.callout</name></action>
<action method="unsetChild"><name>left.reports.product.viewed</name></action>
<block type="catalog/product_compare_sidebar" name="catalog.compare.sidebar" template="catalog/product/compare/sidebar.phtml"/>
<!-- <block type="reports/product_compared" name="right.reports.product.compared" template="reports/product_compared.phtml" />
<block type="reports/product_viewed" name="left.reports.product.viewed" template="reports/product_viewed.phtml" />
<block type="wishlist/customer_sidebar" name="wishlist_sidebar" as="wishlist" template="wishlist/sidebar.phtml"/>
<block type="poll/activePoll" name="right.poll">
<action method="setPollTemplate"><template>poll/active.phtml</template><type>poll</type></action>
<action method="setPollTemplate"><template>poll/result.phtml</template><type>results</type></action>
</block>
<block type="tag/popular" name="tags_popular" template="tag/popular.phtml"/>
<block type="paypal/logo" name="paypal.partner.right.logo" template="paypal/partner/logo.phtml"/> -->
<action method="unsetChild"><name>tags_popular</name></action>
<action method="unsetChild"><name>cart_sidebar</name></action>
<action method="unsetChild"><name>right.reports.product.compared</name></action>
<action method="unsetChild"><name>right.reports.product.viewed</name></action>
<action method="unsetChild"><name>wishlist</name></action>
<action method="unsetChild"><name>sale.reorder.sidebar</name></action>
<action method="unsetChild"><name>right.poll</name></action>
<action method="unsetChild"><name>paypal.partner.right.logo</name></action>
</reference>
Solution
Assuming you are not using your own module, you should create a local layout file at location app/design/frontend/[package]/[theme]/layout/local.xml
and assuming you are seeing the compare block which is added by default you should add the following into the file:
<?xml version="1.0"?>
<layout version="0.1.0">
<customer_account>
<remove name="catalog.compare.sidebar" />
</customer_account>
</layout>
However this does mean that you will not be able to re-use the block name (catalog.compare.sidebar
) if you use <remove>
. If you want to re-use the same block name within the layout then use the following instead:
<?xml version="1.0"?>
<layout version="0.1.0">
<customer_account>
<reference name="left">
<action method="unsetChild">
<name>catalog.compare.sidebar</name>
</action>
</reference>
</customer_account>
</layout>
OTHER TIPS
try this
<customer_address_edit>
<reference name="left">
<remove name="catalog.compare.sidebar" />
</reference>
<customer_address_edit>
In magento 2 add below lines in themes's default.xml file
\app\design\frontend\default\Magento_Theme\layout\default.xml
<referenceBlock name="catalog.compare.sidebar" remove="true"/>
<referenceBlock name="catalog.compare.link" remove="true"/>