I am using a module to create a new attribute on the customer model. Does anyone know how to set the default store view using my setup script?
My current script:
$setup = new Mage_Customer_Model_Resource_Setup('customer_setup');
if (! $setup->getAttribute('customer', 'dob_month')) {
$setup->addAttribute('customer', 'dob_month', array(
'label' => 'Month',
'type' => 'varchar',
'input' => 'select',
'source' => 'eav/entity_attribute_source_table',
'required' => true,
'position' => 1,
'option' => array (
'values' => array (
'January',
'February',
'March',
'April',
'May',
'June',
'July',
'August',
'September',
'October',
'November',
'December'
)
)
));
}
As far as I know it is impossible to do this directly in the addAttribute()
call. But you can set store labels after saving attribute in the next way:
$attributeId = $this->getAttributeId('customer', 'dob_month');
$attribute = Mage::getModel('eav/entity_attribute')->load($attributeId);
$attribute->setStoreLabels(array(store_id => 'Store label'))
->save();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With