Question

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.

Thanks.

Was it helpful?

Solution

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

<?php
/** @var Mage_Eav_Model_Entity_Setup $installer */
$installer = $this;
$installer->startSetup();
$this->addAttribute(
    'catalog_category',
    'my_custom_attribute',
    array(
        '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,
    ));
$installer->endSetup();
Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top