Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Retrieve custom attribute for category
 
peer1979
Jr. Member
 
Total Posts:  4
Joined:  2012-06-03
 

I’m using Magento 1.7.0.2 and have created a custom attribute ‘category_is_page’. I’m trying to get the value in my template,
but it is not available.

I’ve created the attribute in the database (tables eav_attribute, eav_entoty_attribute, categolog_attribute) and it’s is accesible in the backend. But how do i access it in my template?

I’ve tried allot of things and i’m not getting there. Examples of not working snippets:

$l_obj_category $this->getCurrentCategory();
echo 
$l_obj_category->getData('category_is_page');

or

$l_obj_category $this->getCurrentCategory();
$l_obj_collection $l_obj_category->getCollection();
$l_obj_category->addAttributeToSelect('category_is_page');
$l_obj_collection->getData('category_is_page');

Who can help me?

 
Magento Community Magento Community
Magento Community
Magento Community
 
tzyganu
Mentor
 
Avatar
Total Posts:  2205
Joined:  2009-11-18
Bucharest, Romania
 

This should work:

$id $this->getCurrentCategory()->getId();
$category Mage::getModel('catalog/category')->setStoreId(Mage::app()->getCode()->getId())->load($id);
echo 
$category->getData('category_is_page');
//or
echo $category->getCategoryIsPage();

Marius.

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top