Need help to create Magento attributes using Magento Extension. Here are the instructions:

I have to create a new Yes/No attribute for products. The code should be display_product.

The code should be able to install in Magento extension because I will use git and host the code in github.


1 Answer 1


Create a new module using silk software and check need Installing sql or php code and download the zip. After download open the sql file and paste the below code according with your modifications

/** @var Mage_Eav_Model_Entity_Setup $installer */
$installer = $this;
        'group' => 'General Information',
        'input' => 'select',
        'type' => 'int',
        'source' => 'eav/entity_attribute_source_boolean',
        'label' => 'My Custom Attribute',
        'required' => 0,
        'unique' => 0,
        'sort_order' => 3,
        'user_defined' => 1,
        'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL,
  • Hello. is there other way to use this code like pasting the code in .phtml. If i am going to paste this code in sql file. Do I have to manually import this file in the phpadmin/mysql?
    – Marvin
    Jul 26, 2017 at 8:13
  • no you have to use this code in .sql files then it will magento will run this script
    – Raghu
    Jul 26, 2017 at 8:20
  • I use the silk software and use the Need to Add Category Attribute: Yes
    – Marvin
    Jul 26, 2017 at 8:22
  • ok copy the above code and paste in that field
    – Raghu
    Jul 26, 2017 at 8:23
  • Ok I will be back after 12 hours. I have more question like what if the module is already installed or created?
    – Marvin
    Jul 26, 2017 at 8:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.