Question

I write a code to create a sql file to add a column to customer eav table. I want to check whether that field exist in customer table or not.

here is my code for creating that field >>

$setup = Mage::getModel('customer/entity_setup', 'core_setup');
$setup->addAttribute('customer', 'nationalcode', array(
    'type' => 'varchar',
    'input' => 'text',
    'label' => 'national code',
    'global' => 1,
    'visible' => 1,
    'required' => 0,
    'default' => '',
    'user_defined' => 1,
    'visible_on_front' => 1,
));

what should I add to this code to check the existence of the "nationalcode" field before creating it?

No correct solution

Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top