Monday 8 September 2014

Add Custom links under Account Information tab in Magento Admin

Core File path:
app\code\core\Mage\Adminhtml\Block\Customer\Edit\Tab\Account.php

Copy the core files to local path
app\code\local\Mage\Adminhtml\Block\Customer\Edit\Tab\Account.php

/////

$suffixElement = $form->getElement('suffix');
        if ($suffixElement) {
            $suffixOptions = $this->helper('customer')->getNameSuffixOptions($customerStoreId);
            if (!empty($suffixOptions)) {
                $fieldset->removeField($suffixElement->getId());
                $suffixField = $fieldset->addField($suffixElement->getId(),
                    'select',
                    $suffixElement->getData(),
                    $form->getElement('lastname')->getId()
                );
                $suffixField->setValues($suffixOptions);
                if ($customer->getId()) {
                    $suffixField->addElementValues($customer->getSuffix());
                }
            }
        }
      
//////

and replace with
//////////////////////////////

$suffixElement = $form->getElement('suffix');
        if ($suffixElement) {
            $suffixOptions = $this->helper('customer')->getNameSuffixOptions($customerStoreId);
            if (!empty($suffixOptions)) {
                $fieldset->removeField($suffixElement->getId());
                $suffixField = $fieldset->addField($suffixElement->getId(),
                    'select',
                    $suffixElement->getData(),
                    $form->getElement('lastname')->getId()
                );
                $suffixField->setValues($suffixOptions);
                if ($customer->getId()) {
                    $suffixField->addElementValues($customer->getSuffix());
                }
            }
        }

        ///new code start here
         $fieldset->addField('attribute_code', 'link', array(
            'name'      => 'link name',
             'label'=>'link label',
             'href' => $customer->getattribute_code()
            
            ));
                  ///new field end here

No comments:

Post a Comment