Skip to main content
proper tag added for reference and proper format
Link

Custom field in Customer group custom field doesn't save

Source Link

Customer group custom field doesn't save

I tried everything, but nothing seems to work. This is my code:

Block/Adminhtml/Customer/Group/Edit/Form.php

<?php

class Devra_Membership_Block_Adminhtml_Customer_Group_Edit_Form extends Mage_Adminhtml_Block_Customer_Group_Edit_Form
{


    protected function _prepareLayout()
    {
        parent::_prepareLayout();
        $form = $this->getForm();

        $fs = $form->getElement('base_fieldset');

        $fs->addField('customer_group_plan_price', 'text',
            array(
                'name'  => 'plan_price',
                'label' => 'Precio del plan',
                'title' => 'Precio del plan',
                'class' => '',
                'required' => false
            )
        );

        $customerGroup = Mage::registry('current_group');
        if( Mage::getSingleton('adminhtml/session')->getCustomerGroupData() ) {
            $form->addValues(Mage::getSingleton('adminhtml/session')->getCustomerGroupData());
            Mage::getSingleton('adminhtml/session')->setCustomerGroupData(null);
        } else {
            $form->addValues($customerGroup->getData());
        }
    }

}

etc/config.xml

<?xml version="1.0" encoding="UTF-8"?>
<config>
    <modules>
        <Devra_Membership>
            <version>1.0.0</version>
        </Devra_Membership>
    </modules>
    <global>
        <blocks>
            <adminhtml>
                <rewrite>
                    <customer_group_edit_form>Devra_Membership_Block_Adminhtml_Customer_Group_Edit_Form</customer_group_edit_form>
                </rewrite>
            </adminhtml>
        </blocks>
        <resources>
            <devra_membership_setup>
                <setup>
                    <module>Devra_Membership</module>
                </setup>
            </devra_membership_setup>
        </resources>
    </global>

</config>

sql/devra_membership_setup/install-1.0.0.php

<?php

$installer = $this;

$installer->startSetup();

$conn->addColumn($installer->getTable('customer/customer_group'), 'customer_group_plan_price', array(
    'type'      => Varien_Db_Ddl_Table::TYPE_INTEGER,
    'unsigned'  => true,
    'nullable'  => false,
    'default'   => '0',
    'comment'   => 'Price of the plan',
));

$installer->endSetup();

I tried to add a controller with a save action, but it doesn't work too.