0

I have added a new category attribute but after creating attribute, Im not able to fetch value...

A custom attribute is visible on the backend but how could I get value. I have followed this tutorial.

https://www.atwix.com/magento/add-category-attribute/

  • Have you well your custom attribute in category admin ? and are you well saving the data ? – PЯINCƏ Jul 30 '18 at 8:05
  • data is getting a store in the database. and custom_attribute field is also stored in the eva_attribute table. but not able to fetch the value. – Gaurav Kakkar Jul 30 '18 at 8:08
0

From the moment the attribute is well saved in the database, you should get it:

  1. Try to reindex All

  2. Try this:

    $categoryId = 112; //for exemple.
    $myCustomAttribute = Mage::getModel('catalog/category')->load($categoryId)->getData('custom_attribute_name');
    
    Zend_Debug::dump($myCustomAttribute);
    
  • I Have tried this print_r(Mage::getModel('catalog/category')->load($_category->getId())->getData()); 'custom_attribute_name' is not showing there. – Gaurav Kakkar Jul 30 '18 at 8:28
  • Please check the screenshot i.stack.imgur.com/TIZLY.png – Gaurav Kakkar Jul 30 '18 at 8:31
  • Did you try to reindex ? try also to clean cache then try again – PЯINCƏ Jul 30 '18 at 8:44
  • i have cleared all the cache and reindexing too.. – Gaurav Kakkar Jul 30 '18 at 8:45
  • In your config.xml try to update <class>Mage_Catalog_Model_Resource_Setup</class> to <class>Mage_Catalog_Model_Resource_Eav_Mysql4_Setup</class> – PЯINCƏ Jul 30 '18 at 9:11
-1
Mage::getResourceModel('catalog/category')->getAttributeRawValue($_category->getId(), "custom_attribute", Mage::app()->getStore()->getId());

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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