I have a problem with the magento attribute. I created a custom text input attribute for the product that should contain the Integer Data Type, however magento saves it as varchar. I tried asking about it here on stackoverflow, and they told me that there is no way to change the type of a product attribute to an integer from a string.
So my solution is to create a custom integer product attribute. I have been browsing it on Google for several days, and I found an article that gives a script that creates a custom attribute. http://magentotutorialbeginners.blogspot.com/2014/03/create-product-attribute.html?showComment=1442885130592#c2319234413343201281
The problem is that I do not know how to run or use it.
Question:
How to do this script? Can you give me a step-by-step guide?
$installer = $this;
$installer->startSetup();
$installer->addAttribute('catalog_product', 'custom_mprice', array(
'input' => 'text',
'type' => 'int',
'label' => 'Enter Max Price',
'backend' => '',
'visible' => 1,
'required' => 0,
'user_defined' => 1,
'searchable' => 0,
'filterable' => 0,
'sort_order' => 30,
'comparable' => 0,
'visible_on_front' => 0,
'visible_in_advanced_search' => 0,
'is_html_allowed_on_front' => 0,
'is_configurable' => 1,
'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL, ));
$installer->endSetup();
My goal is to create this attribute so that it can be used in an arithmetic expression that is less than or equal to.
thanks
source
share