Magento News

 

Adding category attributes

I have added an integer attribute to categories by setting up an install script that runs like this:


$categoryEntityId $installer->getEntityTypeId('catalog_category');
$installer->addAttribute($categoryEntityId'my_attribute', array(
    
'type' => 'int',
    
'input' => 'text',
    
'label' => 'My Attribute',
    
'required' => '0',
    
'user_defined' => '1',
    ));

The attribute shows up fine in the eav_attribute table.

However, I can’t figure out how to put data in this attribute from PHP. The following does not add anything to the catalog_category_entity_int table as I would expect:


$cat Mage::getModel('catalog/category')->load(3);
$cat->setMyAttribute(1234);
$cat->save();

How do I save and load data into my new category attribute?

Adding category attributes

Possibly Related Posts:


 

Leave a Reply