2012-01-03 113 views
1

我正在嘗試向客戶模型添加屬性。它是允許客戶在註冊時選擇工作類別的選擇列表:Magento - 將自定義屬性添加到客戶模型

$this->addAttribute('customer', 'customer_sector', array(
    'label' => 'Settore', 
    'type' => 'int', 
    'input' => 'select', 
    'default' => '0', 
    'backend' => '', 
    'frontend' => '', 
    'default_value' => '', 
    'visible' => 1, 
    'user_defined' => 1, 
    'searchable' => 1, 
    'filterable' => 1, 
    'visible_on_front' => 0, 
    'visible' => true, 
    'visible_on_front' => true, 
    'required' => false, 
    // what i have to add on 'global'? 
    //'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE, 
    'option' => array ('value' => array(1 => array('opzione 1'),2 => array('opzione  2'), 3 => array('opzione 3'))) 
)); 

是我的代碼是否正確?我在magentocommerce.com上發現了一個指南(這裏也有很多類似的問題),但它解釋瞭如何在產品上添加自定義屬性,所以我更願意在這裏提問。

THX

盧克

+0

和你的Magento的版本是什麼? – 2012-01-03 15:50:40

+0

@AntonS:Magento 1.4.1.1 – Luke 2012-01-03 16:04:08

回答

相關問題