2

I'm new to Magento, and I'm having a hard time understanding a layout/rendering issue:

On the Customers -> Manage Customers -> Click on a customer page, it shows a list of tabs on the left side, one of which is called "Customer View". But when I look at Mage_Adminhtml_Block_Customer_Edit_Tabs::_beforeToHtml, I see that the function call to addTab() is commented out for the "Customer View" tab.

So where is the "Customer View" tab being added from? How can I remove "Customer View" tab for particular member group?

1
  • Did my answer help? If so, I'd appreciate if you'd consider marking it as the accepted answer by clicking the checkmark next to it... – tjons Dec 7 '16 at 2:34
1

The customer view tab corresponds to the Mage_Adminhtml_Customer_Edit_Tab_View block. The tab is added in the app/design/adminhtml/default/default/layout/customer.xml file, on lines 41-44:

<reference name="left">
    <block type="adminhtml/customer_edit_tabs" name="customer_edit_tabs">
        <block type="adminhtml/customer_edit_tab_view" name="customer_edit_tab_view" template="customer/tab/view.phtml">
            <block type="adminhtml/customer_edit_tab_view_sales" name="sales" template="customer/tab/view/sales.phtml" before="-" />
            <block type="adminhtml/customer_edit_tab_view_accordion" name="accordion" />
        </block>
        <action method="addTab"><name>customer_edit_tab_view</name><block>customer_edit_tab_view</block></action>
    </block>
</reference>

I'm not sure why the core team decided to comment out the code in the block and add it in this way instead.

To remove it for a specific customer group, there are a couple tactics you can use:

1) Listen to the controller_action_layout_render_before or controller_action_layout_generate_blocks_after event and in your observer file, remove the block from the layout object.

2) (Not recommended, but easier): rewrite the Mage_Adminhtml_Block_Customer_Edit_Tab_View block, and specifically the isHidden() method with logic that specifies whether to show or not show based on the customer group.

Welcome to Magento, and good luck. It's pretty fun stuff.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.