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?
Possibly Related Posts:
- 花粉ェ…
- Do you know how many of your customers are over the age of 18?? We can tell you http://t.co/RKNC85ti
- #Magento – Fix Product Reviews by jim222: I run a multi-site Magento store. A… http://t.co/todb1Fp4 #freelance #job
- Faille clients Magento : 3 semaines plus tard, silence radio de l’éditeur. #fail #comprendpas http://t.co/WRAMkzbr
- I received +K in magento from @EbullientErin, thanks! http://t.co/dfCN1tUc
RSS Feed