1

I want to place custom text in 'adminhtml_customer_edit' before the 'personal Information' section. enter image description here
For this i have wrote
etc/config.xml

<?xml version="1.0"?>
<config>
    <modules>
        <VLC_DynamicsNAV>
            <version>0.0.1</version>
        </VLC_DynamicsNAV>
    </modules>
    <global>
        <blocks>
            <dynamicsnav>
                <class>VLC_DynamicsNAV_Block</class>
            </dynamicsnav>
        </blocks>
    </global>
    <adminhtml>
        <layout>
            <updates>
                <dynamicsnav>
                    <file>dynamicsnav.xml</file>
                </dynamicsnav>
            </updates>
        </layout>
    </adminhtml>
</config>


VLC_DynamicsNAV.xml

<?xml version="1.0" ?>
<config>
    <modules>
        <VLC_DynamicsNAV>
            <active>true</active>
            <codePool>local</codePool>
        </VLC_DynamicsNAV>
    </modules>
</config>

adminhtml\default\default\layout\dynamicsnav.xml

<?xml version="1.0" ?>
<layout>
        <adminhtml_customer_edit>
            <reference name="customer_edit_tabs">
                <block type="dynamicsnav/customerbtn" name="customer.nav.button"
                       template="dynamicsnav/customer.phtml"
                       before="customer_edit_tab_view"/>
            </reference>
        </adminhtml_customer_edit>
</layout>

and VLC\DynamicsNAV\Block\adminhtml\customerbtn.php

<?php
class VLC_DynamicsNAV_Block_adminhtml_customerbtn extends Mage_Adminhtml_Block_Template
{    
}

app\design\adminhtml\default\default\template\dynamicsnav\customer.phtml

<h1>WELCOME TO THE NEW WORLD</H1>

How to place custom text in customer edit card form in the customer view section before the Personal Information group

2
  • You already did it. What more do you need? Aug 11 '15 at 10:07
  • @fschmengler i have placed text using developer tools to show what i need. In magento after placing all the above code its not showing custom text Aug 11 '15 at 10:17
0
  1. The file name VLC\DynamicsNAV\Block\adminhtml\customerbtn.php should be VLC\DynamicsNAV\Block\Adminhtml\Customerbtn.php

  2. customer_edit_tabs is the wrong parent, it's a tab container, not the tab itself. Also it does not render added children automatically. The tab itself is the block customer_edit_tab_view

  3. Unfortunately, customer_edit_tab_view renders all children, but at the bottom (see last line in the template), so you will need to copy the template and modify it so that your new block is rendered before the <h4> element.

layout\dynamicsnav.xml

<?xml version="1.0" ?>
<layout>
        <adminhtml_customer_edit>
            <reference name="customer_edit_tab_view">
                <action method="setTemplate"><template>dynamicsnav/customer_view.phtml</template></action>
            </reference>

            <block type="dynamicsnav/customerbtn" name="customer.nav.button"
                   template="dynamicsnav/customer.phtml" />
        </adminhtml_customer_edit>
</layout>

Note that I added the block outside the parent so that it will not be rendered by getChildHtml() at the bottom.

template/dynamicsnav/customer_view.phtml

<div class="entry-edit">

    <?php echo $this->getLayout()->getBlock('customer.nav.button')->toHtml(); ?>

    <div class="entry-edit-head"><h4 class="icon-head head-customer-view"><?php echo Mage::helper('customer')->__('Personal Information') ?></h4></div>
4
  • in the point 3, we need to copy the template and modify, If we upgrade we might lost upgrade version content here. I dont want to disturb magento core, Just i want to place text before the Account Information Aug 11 '15 at 10:49
  • Unfortunately you cannot simply add content in the middle of a template without modifying the template. However you could use the core_block_abstract_tohtml_after event to "inject" content. Aug 11 '15 at 10:51
  • Please clarify that 'adminhtml/default/default/' our customized layout & template files will be overridden by magento on upgradation?. For eg: layout - 'adminhtml\default\default\layout\dynamicsnav.xml', template - 'template/dynamicsnav/customer_view.phtml' Aug 11 '15 at 10:52
  • No, they won't be overwritten on update because you don't change the core template but copy it and then use this copy. Aug 11 '15 at 10:53

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.