I wrote a simple sql upgrade script to add a custom attribute to the customer table. My script :

$installer = $this;


$installer->addAttribute('customer', 'whatsapp_active', array(
    'type'       => 'static',
    'input'      => 'boolean',
    'label'      => 'Is Customer Active',
    'default' => '1',
    'visible' => true,
    'required' => false,
    'user_defined' => true,

    ->getAttribute('customer', 'whatsapp_active')
    ->setData('used_in_forms', array('adminhtml_customer'))


I get the error :

a:5:{i:0;s:57:"Source model "" not found for attribute "whatsapp_status"";i:1;s:2983:"#0 /var/www/html/fresh/app/code/core/Mage/Eav/Model/Entity/Attribute/Abstract.php(387): Mage::exception('Mage_Eav', 'Source model ""...')
#1 /var/www/html/fresh/app/code/core/Mage/Adminhtml/Block/Widget/Form.php(201): Mage_Eav_Model_Entity_Attribute_Abstract->getSource()

Now, even when I have removed the file, then also I get the same error.

PS : I have changed, my core_resource table code customer_setup versions accordingly.

So, what is the thing which I am missing?


You can try Following way..

$installer = $this;

$installer->addAttribute("customer", "whatsapp_active",  array(
    "type"     => "int",
    "backend"  => "",
    "label"    => "Is Customer Active",
    "input"    => "select",
    "source"   => "eav/entity_attribute_source_boolean",
    "visible"  => true,
    "required" => false,
    "default" => "",
    "frontend" => "",
    "unique"     => false,
    "note"       => ""


        $attribute   = Mage::getSingleton("eav/config")->getAttribute("customer", "whatsapp_active");


        $attribute->setData("used_in_forms", $used_in_forms)
        ->setData("is_used_for_customer_segment", true)
        ->setData("is_system", 0)
        ->setData("is_user_defined", 1)
        ->setData("is_visible", 1)
        ->setData("sort_order", 100)

|improve this answer|||||
  • But how to remove the error, as I mentioned in the answer that the error is still happening even when I removed the file. Is there anything that I need to do? PS : I am able to remove the error by deleting the attribute. Thanks – arqam Jan 6 at 20:01
  • you need to var folder rename and may be this code is working because i have checked my side and created attribute – Rakesh Donga Jan 7 at 3:35

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.