Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Magento module setup - change product attribute to not required

Tags:

magento

How do you change an eav attribute properties during the installation of a module.

Specifically, i want to change a product attribute from being to required to not required.

I am currently merging the updated product attributes in the getDefaultEntities call in my modules setup but its giving wierd results.

For example:

public function getDefaultEntities()
    {        
        return array(
            'catalog_product' => array(
                'entity_attribute_collection' => 'catalog/product_attribute_collection',        
                'attribute_model' => 'catalog/resource_eav_attribute',
                'table' => 'catalog/product',
                'entity_model' => 'catalog/product',
                'additional_attribute_table' => 'catalog/eav_attribute',
                'attributes' => array(
                    'short_description' => array('required'=> false)
                )
            )
        );

    }

Results in the short_description field loosing its Frontend Label

like image 393
Marty Wallace Avatar asked May 02 '12 19:05

Marty Wallace


People also ask

How do I change product attributes in Magento 2?

To change the product attribute set in Magento, log in to the admin panel and go to Catalog > Manage Products. Select the needed Magento products and choose Change Attribute Set from the Action dropdown right on the grid.

How do I edit attributes in Magento?

Edit an attribute. On the Admin sidebar, go to Marketing > Channels > Amazon. Click Attributes in the left-side menu, locate an Amazon attribute, and click Edit in the Action column. To enable or disable the syncing of the Amazon values to the linked Magento attribute, set Is Active to Yes or No .


1 Answers

/* @var $installer Mage_Catalog_Model_Resource_Setup */
$installer->updateAttribute('catalog_product','short_description','is_required',0);
like image 140
benmarks Avatar answered Oct 20 '22 19:10

benmarks