2

I want to remove Carts tab coming in Customer View tab in magento admin panel for Manage Customer with a custom condition. As shown in below figure :

enter image description here

Which block or template file should I override for this?

EDIT - I want to remove this when a certain condition match, I have created a module for User role if the condition meet only then want to remove these tabs.

6
  • You mean Shopping cart tabs just below recent orders? Jul 4, 2018 at 12:37
  • Please check my updated question. Jul 4, 2018 at 12:43
  • Check my answer Jul 4, 2018 at 12:48
  • @SukumarGorai Overrides should always be the last option. Better use observers and layout updates when possible.
    – sv3n
    Jul 4, 2018 at 12:52
  • @sv3n Yes I know. But if you see the question he wants to override the file. Thats why I have just guide him which class he needs to override. How do you put a condition in your layout updates? Jul 4, 2018 at 12:54

3 Answers 3

1

You need to go to the following class:

Mage_Adminhtml_Block_Customer_Edit_Tab_View_Accordion

You will find the whole code here. Override this Block class and put the conditions accordingly

0

you need to edit app\design\adminhtml\default\default\layout\customer.xml.

find <block type="adminhtml/customer_edit_tab_view_accordion" name="accordion" /> and comment it.

May be it will work for you

2
  • I have updated my question, Please check. Jul 4, 2018 at 12:47
  • @tecjam give proper answer Jul 4, 2018 at 13:00
0

Contrary to all other answers, if you remove the entire accordion block, you will also remove the recent orders and wishlist accordion items, not just the cart ones.

You should overwrite the Mage_Adminhtml_Block_Customer_Edit_Tab_View_Accordion and comment out or remove the following code:

    // add shopping cart block of each website
    foreach (Mage::registry('current_customer')->getSharedWebsiteIds() as $websiteId) {
        $website = Mage::app()->getWebsite($websiteId);

        // count cart items
        $cartItemsCount = Mage::getModel('sales/quote')
            ->setWebsite($website)->loadByCustomer($customer)
            ->getItemsCollection(false)
            ->addFieldToFilter('parent_item_id', array('null' => true))
            ->getSize();
        // prepare title for cart
        $title = Mage::helper('customer')->__('Shopping Cart - %d item(s)', $cartItemsCount);
        if (count($customer->getSharedWebsiteIds()) > 1) {
            $title = Mage::helper('customer')->__('Shopping Cart of %1$s - %2$d item(s)', $website->getName(), $cartItemsCount);
        }

        // add cart ajax accordion
        $this->addItem('shopingCart' . $websiteId, array(
            'title'   => $title,
            'ajax'    => true,
            'content_url' => $this->getUrl('*/*/viewCart', array('_current' => true, 'website_id' => $websiteId)),
        ));
    }

Copy app/code/core/Mage/Adminhtml/Block/Customer/Edit/Tab/View/Accordion.php to app/code/local/Mage/Adminhtml/Block/Customer/Edit/Tab/View/Accordion.php and do your edits.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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