Reputation: 11
I would like to add a price field into my admin form under my product edit page, but I cannot add a “price” type into my fieldset.
$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()),
));
it is giving the following error.
Fatal error: Class 'Varien_Data_Form_Element_Price' not found in .. /lib/Varien/Data/Form/Abstract.php on line 144
PS. I am digging the code in
Mage_Adminhtml_Block_Widget_Form
where in function
_setFieldset
It can use the price as fieldType.
Edit @ 11/6:
Digging into _setFieldset(), from the first line
$this->_addElementTypes($fieldset);
will invoke an implementable function
function _getAdditionalElementTypes()
to add additional data type (such as price, gallary..) not in the given list.
Upvotes: 1
Views: 1747
Reputation: 8836
I think you just just have to do text
because these are the available options:
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
Upvotes: 4