0

I have two customer attribute that I would like to display on the "Customer view" Tab in Magento admin. I have been able to display the values from the attribute but adding:

   <tr>
        <td><strong><?php echo $this->__('Customer attribute:') ?></strong></td>
        <td><?php echo $this->htmlEscape($this->getCustomer()->getCutomerAttribute()) ?></td>
    </tr>

To adminhtml/default/default/template/customer/tab/view.phtml file. The problem is I'd prefer not to directly edit this template file and have been looking for a way to add my template without touching the default.

I have tried to add a local.xml file to override the default template but it's not working correctly...

<layout>
    <adminhtml_customer_edit>
        <reference name="content">
            <block type="adminhtml/customer_edit" name="customer_edit"></block>
        </reference>
        <reference name="head">
            <block type="adminhtml/template" name="optional_zip_countries" as="optional_zip_countries" template="directory/js/optional_zip_countries.phtml" />
            <action method="addJs"><file>mage/adminhtml/product/composite/configure.js</file></action>
            <action method="addJs"><file>varien/configurable.js</file></action>
        </reference>
        <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="path/to/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>

</adminhtml_customer_edit>
</layout>

I've also tried to use a layout update inside of my module but I kept getting errors

"Mage registry key "subscriber" already exists";i:1;s:2926:"#0

And then..

  Wrong tab configuration 

when I tried to rewrite the block class

I'm now running out of ideas and could do with some help here please...

Many thanks!

1 Answer 1

1

What you should be able to do is using the following xml set the template of the view tab:

<adminhtml_customer_edit>
    <reference name="customer_edit_tab_view">
        <action method="setTemplate">
            <template>your/template/file.phtml</template>
        </action>
    </reference>
</adminhtml_customer_edit>
2
  • Excellent, thankyou for your assistance! Commented Aug 1, 2014 at 8:31
  • can you show the file please Commented Dec 6, 2019 at 10:54

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.