Magento - Remove tab from product view using local.xml
Solution 1
Based on my reading of Mage_Catalog_Block_Product_View_Tabs::addTabs()
, you should be able to remove the block from being rendered with one of the following:
<!-- language: xml -->
<catalog_product_view>
<reference name="product.info.tabs">
<action method="unsetChild">
<child>additional</child>
</action>
</reference>
</catalog_product_view>
Or:
<catalog_product_view>
<remove name="additional" />
</catalog_product_view>
The reason that I believe these will work is that addTab() simply takes the arguments and uses them to create a block instance as a child of the tab parent block.
Zyava's comment is incorrect, as I assume you know. There is a difference between app/etc/local.xml (a config file) and the explicitly last-loaded local.xml from your design settings.
Solution 2
I am using my module adminhtml layout xml to add or remove tabs (you could use your theme's local.xml, based on these steps with a bit of tweakking.)
Firstly you will need to declare your layout updates (in your module config.xml) like the following:
<adminhtml>
<layout>
<updates>
<mymodule>
<file>mymodule.xml</file>
</mymodule>
</updates>
</layout>
</adminhtml>
Then in mymodule.xml, add the following (here, I am using the admin order view page handle)
<adminhtml_sales_order_view>
<reference name="sales_order_tabs">
<action method="removeTab">
<name>order_shipments</name>
</action>
<action method="addTabAfter">
<name>order_shipments_mymodule</name>
<block>mymodule/adminhtml_order_shipments</block>
<after>order_creditmemos</after>
</action>
<action method="addTab">
<name>order_receipts</name>
<block>mymoduled/adminhtml_order_recp</block>
</action>
</reference>
</adminhtml_sales_order_view>
Hope this helps!! (Don't forget to upvote this solution)
Adam Moss
I am a 3x Magento Certified Developer working at Space48 in the UK. I am the owner of the Magento Fox Blog where I write articles and tutorials.
Updated on June 21, 2022Comments
-
Adam Moss almost 2 years
A really simple question with (I bet) a very simple answer... I want to remove one of the product info tabs from my product view page. I want to remove the tab which shows the attributes, but rather than commenting it out in catalog.xml I want to remove it properly through local.xml.
<action method="addTab" translate="title" module="catalog"> <alias>additional</alias><title>Additional Information</title> <block>catalog/product_view_attributes</block> <template>catalog/product/view/attributes.phtml</template> </action>
I thought there may be a removeTab method, but that didn't work. There's also method="unsetChild", but I cannot see how I would target that specific element as there's no defined name in the XML.
Any ideas would be much appreciated.