2012-06-11 51 views
1

我想在我的產品編輯頁面的管理表單中添加價格字段,但我無法在我的字段集中添加「價格」類型。Magento:價格字段在Adminhtml產品表格

$fieldset->addField($attribute->getAttributeCode(), 'price', array(
      'label'  => Mage::helper('mymod')->__($attribute->getFrontendLabel()), 
      'class'  => $attribute->getIsRequired()?'required-entry':'', 
      'required' => $attribute->getIsRequired()?true:false, 
      'name'  => $attribute->getAttributeCode(), 
      'note'  => Mage::helper('mymod')->__($attribute->getNote()), 
     )); 

它給出以下錯誤。

Fatal error: Class 'Varien_Data_Form_Element_Price' not found in .. /lib/Varien/Data/Form/Abstract.php on line 144 

PS。 我挖的代碼

Mage_Adminhtml_Block_Widget_Form 

其中功能

_setFieldset 

它可以使用價格作爲字段類型。

編輯@ 11/6:

挖掘到_setFieldset(),從第一行

$this->_addElementTypes($fieldset); 

將調用一個實現的功能

function _getAdditionalElementTypes() 

添加額外的數據類型(如價格,gallary ..)不在給定列表中。

回答

3

我認爲你只需要做text,因爲這些都是可用的選項:

Button 
Checkbox 
Checkboxes 
Collection 
Column 
Date 
Editor 
Fieldset 
File 
Gallery 
Hidden 
Image 
Imagefile 
Label 
Link 
Multiline 
Multiselect 
Note 
Obscure 
Password 
Radio 
Radios 
Reset 
Select 
Submit 
Text 
Textarea 
Time 
相關問題