3

I added a new field for Customer Group. It called customer group email. I added the field and it displays in the backend but it doesn't save the data and I don't know How can I add Save action. I tried to add this code in the file that called

app/code/core/Mage/Adminhtml/controllers/Customer/GroupController.php

$groupEmail = $this->getRequest()->getParam('groupemail');
$customerGroup->setData($groupEmail)->setId($this->getRequest()->getParam('id'));

The added code in Form.php is:

$groupEmail = $fieldset->addField('customer_group_email', 'text',
    array(
        'name'  => 'groupemail',
        'label' => Mage::helper('customer')->__('Group email'),
        'title' => Mage::helper('customer')->__('Group email'),
        'note'  => Mage::helper('customer')->__('Maximum length must be less then %s symbols', Mage_Customer_Model_Group::GROUP_CODE_MAX_LENGTH),
        'class' => $validateClass,
        'required' => true,
    )
);

1 Answer 1

2

At first, you need create database column to store email addresses:

ALTER TABLE `customer_group` ADD `groupemail` VARCHAR(128) DEFAULT NULL;

I do not advice to change core files, so the best way - creation of a new extension and listening the customer_group_save_before event to set email from a request, but you can modify this file:

Magento_root/app/code/core/Mage/Adminhtml/controllers/Customer/GroupController.php

and add the following code to the saveAction function:

$groupEmail = $this->getRequest()->getParam('groupemail');
$customerGroup->setGroupemail($groupEmail);

after the following code:

if (!empty($customerGroupCode)) {
    $customerGroup->setCode($customerGroupCode);
}
1
  • I need to send a copy of the invoice email to customer group email when a customer form customer group placed an order. Feb 13, 2018 at 9:55

Your Answer

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

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