3

I have a customer attribute which I setup using this script (I've only pasted part of it, the part related to the attribute)

$setup->addAttribute('customer', 'age', array(
    'label'             => 'Age',
    'type'              => 'int',
    'input'             => 'select',
    'user_defined'      => true,
    'source'            => 'eav/entity_attribute_source_table',
    'visible'           => true,
    'required'          => false,
    'visible_on_front'  => true
));

I would like to set the front end label of the attribute to "How old are you?" but keep the Admin label to "Age". How could I do this?

Thanks in advance,

4

1 回答 1

3

好的,我在研究了 magento 后成功了

$labels = array();
$labels[0] = 'Age';//default store label
$labels[1] = 'Label for store with id 1';
$oAttribute = Mage::getSingleton('eav/config')->getAttribute('customer', 'age');
$oAttribute->setData('store_labels', $labels);
$oAttribute->save();

这成功了。

希望它可以帮助别人。

于 2013-03-08T12:34:56.753 回答