I have created a Magento attribute called sales_index. I have created the attribute to be an integer from the install script in the module I have created. This is what I have put into my install script:
$installer = $this;
$setup = new Mage_Eav_Model_Entity_Setup('core_setup');
$installer->startSetup();
$setup->addAttribute('catalog_product', 'sales_index', array(
'input' => 'int',
'type' => 'int',
'backend' => '',
'vi开发者_运维问答sible' => 0,
'required' => 0,
'user_defined' => 1,
));
$installer->endSetup();
The attribute seems to create correctly as no errors were given from the installer. However, when I move the sales_index attribute to the Default product attribute group and load one of the products in the admin panel I get the following error:
Fatal error: Class 'Varien_Data_Form_Element_Int' not found in /var/www/vhosts/workingperson.com/magento/lib/Varien/Data/Form/Abstract.php on line 129
So I figured I can just take this attribute out of the default attribute group and be fine. I am planning on setting this value in the background anyways. However, when I load a product, this value does not come along with it. The value is being set in the database, it just is not being loaded.
I am assuming that I did something wrong with creating the attribute that is not readily noticeable to me.
Does anyone know what I have to do to get this to work correctly?
Try removing the 'input' => 'int'
line from your installer. I do not believe there is a separate form element type for integers, and the error lends onto the same.
Try to change 'input' => 'int',
to 'input' => 'text',
. If this register is already on table, go to eav_attribute
search for your row and change the field frontend_input
to text
.
This may to work.
精彩评论