Get custom category attribute valueHow to Get All Custom Category Attribute Values?Get Custom Attribute in CategoryRemove store level value for category attributeHow to get value of Custom attribute?create custom attribute for root category in adminSet value for custom attributeGet custom image attribute from categoryMagento2 : Custom Category Attribute value Not Saving?Get custom attribute in category loop?Magento2.2.2 : Custom Category Attribute value Not Saving?
Adding labels and comments to a matrix
Developers demotivated due to working on same project for more than 2 years
Single word that parallels "Recent" when discussing the near future
Will casting a card from the graveyard with Flashback add a quest counter on Pyromancer Ascension?
The meaning of the Middle English word “king”
Tube from Heathrow to King's Cross
Will a coyote attack my dog on a leash while I'm on a hiking trail?
How about space ziplines
How can I add a .pem private key fingerprint entry to known_hosts before connecting with ssh?
Holding rent money for my friend which amounts to over $10k?
Can a tourist shoot a gun for recreational purpose in the USA?
Why doesn't Iron Man's action affect this person in Endgame?
Filter a data-frame and add a new column according to the given condition
Why can't I share a one use code with anyone else?
Did galley captains put corks in the mouths of slave rowers to keep them quiet?
Is this possible when it comes to the relations of P, NP, NP-Hard and NP-Complete?
Wireless headphones interfere with Wi-Fi signal on laptop
Can only the master initiate communication in SPI whereas in I2C the slave can also initiate the communication?
Was the dragon prowess intentionally downplayed in S08E04?
Can my Serbian girlfriend apply for a UK Standard Visitor visa and stay for the whole 6 months?
Why does lemon juice reduce the "fish" odor of sea food — specifically fish?
Why weren't the bells paid heed to in S8E5?
Extract the characters before last colon
the grammar about `adv adv` as 'too quickly'
Get custom category attribute value
How to Get All Custom Category Attribute Values?Get Custom Attribute in CategoryRemove store level value for category attributeHow to get value of Custom attribute?create custom attribute for root category in adminSet value for custom attributeGet custom image attribute from categoryMagento2 : Custom Category Attribute value Not Saving?Get custom attribute in category loop?Magento2.2.2 : Custom Category Attribute value Not Saving?
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I have created a custom category attribute using this tutorial http://gauss-development.com/blog/tutorials/adding-custom-category-attributes-magento/.
<?php
$installer = $this;
$installer->startSetup();
$attribute = array(
'type' => 'text',
'label' => 'Extra Title',
'input' => 'text',
'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL,
'visible' => true,
'required' => false,
'user_defined' => true,
'default' => "",
'group' => "General Information"
);
$installer->addAttribute('catalog_category', 'cat_extra_title', $attribute);
$installer->endSetup();
?>
I have checked that the attribute is stored in eav_attribute table normally, but I can't get it's value.
$category = Mage::registry('current_category');
if ($category)
$value = $category->getData('cat_extra_title'); //value is empty
Any ideas?
magento-1.9 category eav custom-attributes
|
show 6 more comments
I have created a custom category attribute using this tutorial http://gauss-development.com/blog/tutorials/adding-custom-category-attributes-magento/.
<?php
$installer = $this;
$installer->startSetup();
$attribute = array(
'type' => 'text',
'label' => 'Extra Title',
'input' => 'text',
'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL,
'visible' => true,
'required' => false,
'user_defined' => true,
'default' => "",
'group' => "General Information"
);
$installer->addAttribute('catalog_category', 'cat_extra_title', $attribute);
$installer->endSetup();
?>
I have checked that the attribute is stored in eav_attribute table normally, but I can't get it's value.
$category = Mage::registry('current_category');
if ($category)
$value = $category->getData('cat_extra_title'); //value is empty
Any ideas?
magento-1.9 category eav custom-attributes
1
which page you are showing the value?
– Qaisar Satti
May 4 '16 at 6:28
1
First you try to print the values of the current category by using var_dump($category->getData()). Whether the values of 'cat_extra_title' is retrieving or not.
– Manikandan
May 4 '16 at 6:40
@Manikandan there are values retrieved but the 'cat_extra_title' value is not included in them. Why?
– zekia
May 4 '16 at 8:12
2
try $category->getCatExtraTitle();
– Manikandan
May 4 '16 at 9:05
1
Can you print the values and share the link
– Manikandan
May 4 '16 at 9:15
|
show 6 more comments
I have created a custom category attribute using this tutorial http://gauss-development.com/blog/tutorials/adding-custom-category-attributes-magento/.
<?php
$installer = $this;
$installer->startSetup();
$attribute = array(
'type' => 'text',
'label' => 'Extra Title',
'input' => 'text',
'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL,
'visible' => true,
'required' => false,
'user_defined' => true,
'default' => "",
'group' => "General Information"
);
$installer->addAttribute('catalog_category', 'cat_extra_title', $attribute);
$installer->endSetup();
?>
I have checked that the attribute is stored in eav_attribute table normally, but I can't get it's value.
$category = Mage::registry('current_category');
if ($category)
$value = $category->getData('cat_extra_title'); //value is empty
Any ideas?
magento-1.9 category eav custom-attributes
I have created a custom category attribute using this tutorial http://gauss-development.com/blog/tutorials/adding-custom-category-attributes-magento/.
<?php
$installer = $this;
$installer->startSetup();
$attribute = array(
'type' => 'text',
'label' => 'Extra Title',
'input' => 'text',
'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL,
'visible' => true,
'required' => false,
'user_defined' => true,
'default' => "",
'group' => "General Information"
);
$installer->addAttribute('catalog_category', 'cat_extra_title', $attribute);
$installer->endSetup();
?>
I have checked that the attribute is stored in eav_attribute table normally, but I can't get it's value.
$category = Mage::registry('current_category');
if ($category)
$value = $category->getData('cat_extra_title'); //value is empty
Any ideas?
magento-1.9 category eav custom-attributes
magento-1.9 category eav custom-attributes
edited May 4 '16 at 5:49
Baby in Magento
9001355170
9001355170
asked May 4 '16 at 5:46
zekiazekia
973624
973624
1
which page you are showing the value?
– Qaisar Satti
May 4 '16 at 6:28
1
First you try to print the values of the current category by using var_dump($category->getData()). Whether the values of 'cat_extra_title' is retrieving or not.
– Manikandan
May 4 '16 at 6:40
@Manikandan there are values retrieved but the 'cat_extra_title' value is not included in them. Why?
– zekia
May 4 '16 at 8:12
2
try $category->getCatExtraTitle();
– Manikandan
May 4 '16 at 9:05
1
Can you print the values and share the link
– Manikandan
May 4 '16 at 9:15
|
show 6 more comments
1
which page you are showing the value?
– Qaisar Satti
May 4 '16 at 6:28
1
First you try to print the values of the current category by using var_dump($category->getData()). Whether the values of 'cat_extra_title' is retrieving or not.
– Manikandan
May 4 '16 at 6:40
@Manikandan there are values retrieved but the 'cat_extra_title' value is not included in them. Why?
– zekia
May 4 '16 at 8:12
2
try $category->getCatExtraTitle();
– Manikandan
May 4 '16 at 9:05
1
Can you print the values and share the link
– Manikandan
May 4 '16 at 9:15
1
1
which page you are showing the value?
– Qaisar Satti
May 4 '16 at 6:28
which page you are showing the value?
– Qaisar Satti
May 4 '16 at 6:28
1
1
First you try to print the values of the current category by using var_dump($category->getData()). Whether the values of 'cat_extra_title' is retrieving or not.
– Manikandan
May 4 '16 at 6:40
First you try to print the values of the current category by using var_dump($category->getData()). Whether the values of 'cat_extra_title' is retrieving or not.
– Manikandan
May 4 '16 at 6:40
@Manikandan there are values retrieved but the 'cat_extra_title' value is not included in them. Why?
– zekia
May 4 '16 at 8:12
@Manikandan there are values retrieved but the 'cat_extra_title' value is not included in them. Why?
– zekia
May 4 '16 at 8:12
2
2
try $category->getCatExtraTitle();
– Manikandan
May 4 '16 at 9:05
try $category->getCatExtraTitle();
– Manikandan
May 4 '16 at 9:05
1
1
Can you print the values and share the link
– Manikandan
May 4 '16 at 9:15
Can you print the values and share the link
– Manikandan
May 4 '16 at 9:15
|
show 6 more comments
3 Answers
3
active
oldest
votes
After testing many possible solutions, this was the only one that worked for me:
$cat_extra_title = Mage::getModel('catalog/category')->load($category->getId())->getData('cat_extra_title');
2
It's actually not a good practice to call "->load" every time when you need just one attribute. First of all - if you have Category Flat enabled (check in System - Configuration - Catalog) - do a reindex of Flat Category and check if column for your attribute appeared in flat table. And second - check my reply below
– Neklo.com
May 5 '16 at 7:02
I was looking for something like this today and your solution works. Thanx
– Rob D. A.
May 11 '18 at 16:09
add a comment |
when adding new attribute for Category or Product, we need to put this attribute in Attribute Set and Attribute Group.
So your code should look like this:
$installer->addAttribute('catalog_category', 'cat_extra_title', array(
'type' => 'text',
'label' => 'Extra Title',
'input' => 'text',
'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL,
'required' => false,
'default' => '',
'user_defined' => true,
'default' => "",
));
$entityTypeId = $installer->getEntityTypeId('catalog_category');
$attributeSetId = $installer->getDefaultAttributeSetId($entityTypeId);
$attributeGroupId = $installer->getDefaultAttributeGroupId($entityTypeId, $attributeSetId);
$installer->addAttributeToGroup(
$entityTypeId,
$attributeSetId,
$attributeGroupId,
'cat_extra_title'
);
add a comment |
I ran into the same issue today. I created a new custom category attribute (an int/select one), and I would try this, in list.phtml, and get an empty value:
$value = Mage::registry('current_category')->getData('my_custom_Attribute');
However, this was solved by re-indexing catalog_category_flat
; with n98:
n98-magerun.phar index:reindex catalog_category_flat
Now, the same code produces the value, so long as a value exists for the category (if the value is empty/NULL, then, of course, it will still produce a NULL value).
New contributor
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "479"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f113833%2fget-custom-category-attribute-value%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
After testing many possible solutions, this was the only one that worked for me:
$cat_extra_title = Mage::getModel('catalog/category')->load($category->getId())->getData('cat_extra_title');
2
It's actually not a good practice to call "->load" every time when you need just one attribute. First of all - if you have Category Flat enabled (check in System - Configuration - Catalog) - do a reindex of Flat Category and check if column for your attribute appeared in flat table. And second - check my reply below
– Neklo.com
May 5 '16 at 7:02
I was looking for something like this today and your solution works. Thanx
– Rob D. A.
May 11 '18 at 16:09
add a comment |
After testing many possible solutions, this was the only one that worked for me:
$cat_extra_title = Mage::getModel('catalog/category')->load($category->getId())->getData('cat_extra_title');
2
It's actually not a good practice to call "->load" every time when you need just one attribute. First of all - if you have Category Flat enabled (check in System - Configuration - Catalog) - do a reindex of Flat Category and check if column for your attribute appeared in flat table. And second - check my reply below
– Neklo.com
May 5 '16 at 7:02
I was looking for something like this today and your solution works. Thanx
– Rob D. A.
May 11 '18 at 16:09
add a comment |
After testing many possible solutions, this was the only one that worked for me:
$cat_extra_title = Mage::getModel('catalog/category')->load($category->getId())->getData('cat_extra_title');
After testing many possible solutions, this was the only one that worked for me:
$cat_extra_title = Mage::getModel('catalog/category')->load($category->getId())->getData('cat_extra_title');
answered May 5 '16 at 7:00
zekiazekia
973624
973624
2
It's actually not a good practice to call "->load" every time when you need just one attribute. First of all - if you have Category Flat enabled (check in System - Configuration - Catalog) - do a reindex of Flat Category and check if column for your attribute appeared in flat table. And second - check my reply below
– Neklo.com
May 5 '16 at 7:02
I was looking for something like this today and your solution works. Thanx
– Rob D. A.
May 11 '18 at 16:09
add a comment |
2
It's actually not a good practice to call "->load" every time when you need just one attribute. First of all - if you have Category Flat enabled (check in System - Configuration - Catalog) - do a reindex of Flat Category and check if column for your attribute appeared in flat table. And second - check my reply below
– Neklo.com
May 5 '16 at 7:02
I was looking for something like this today and your solution works. Thanx
– Rob D. A.
May 11 '18 at 16:09
2
2
It's actually not a good practice to call "->load" every time when you need just one attribute. First of all - if you have Category Flat enabled (check in System - Configuration - Catalog) - do a reindex of Flat Category and check if column for your attribute appeared in flat table. And second - check my reply below
– Neklo.com
May 5 '16 at 7:02
It's actually not a good practice to call "->load" every time when you need just one attribute. First of all - if you have Category Flat enabled (check in System - Configuration - Catalog) - do a reindex of Flat Category and check if column for your attribute appeared in flat table. And second - check my reply below
– Neklo.com
May 5 '16 at 7:02
I was looking for something like this today and your solution works. Thanx
– Rob D. A.
May 11 '18 at 16:09
I was looking for something like this today and your solution works. Thanx
– Rob D. A.
May 11 '18 at 16:09
add a comment |
when adding new attribute for Category or Product, we need to put this attribute in Attribute Set and Attribute Group.
So your code should look like this:
$installer->addAttribute('catalog_category', 'cat_extra_title', array(
'type' => 'text',
'label' => 'Extra Title',
'input' => 'text',
'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL,
'required' => false,
'default' => '',
'user_defined' => true,
'default' => "",
));
$entityTypeId = $installer->getEntityTypeId('catalog_category');
$attributeSetId = $installer->getDefaultAttributeSetId($entityTypeId);
$attributeGroupId = $installer->getDefaultAttributeGroupId($entityTypeId, $attributeSetId);
$installer->addAttributeToGroup(
$entityTypeId,
$attributeSetId,
$attributeGroupId,
'cat_extra_title'
);
add a comment |
when adding new attribute for Category or Product, we need to put this attribute in Attribute Set and Attribute Group.
So your code should look like this:
$installer->addAttribute('catalog_category', 'cat_extra_title', array(
'type' => 'text',
'label' => 'Extra Title',
'input' => 'text',
'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL,
'required' => false,
'default' => '',
'user_defined' => true,
'default' => "",
));
$entityTypeId = $installer->getEntityTypeId('catalog_category');
$attributeSetId = $installer->getDefaultAttributeSetId($entityTypeId);
$attributeGroupId = $installer->getDefaultAttributeGroupId($entityTypeId, $attributeSetId);
$installer->addAttributeToGroup(
$entityTypeId,
$attributeSetId,
$attributeGroupId,
'cat_extra_title'
);
add a comment |
when adding new attribute for Category or Product, we need to put this attribute in Attribute Set and Attribute Group.
So your code should look like this:
$installer->addAttribute('catalog_category', 'cat_extra_title', array(
'type' => 'text',
'label' => 'Extra Title',
'input' => 'text',
'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL,
'required' => false,
'default' => '',
'user_defined' => true,
'default' => "",
));
$entityTypeId = $installer->getEntityTypeId('catalog_category');
$attributeSetId = $installer->getDefaultAttributeSetId($entityTypeId);
$attributeGroupId = $installer->getDefaultAttributeGroupId($entityTypeId, $attributeSetId);
$installer->addAttributeToGroup(
$entityTypeId,
$attributeSetId,
$attributeGroupId,
'cat_extra_title'
);
when adding new attribute for Category or Product, we need to put this attribute in Attribute Set and Attribute Group.
So your code should look like this:
$installer->addAttribute('catalog_category', 'cat_extra_title', array(
'type' => 'text',
'label' => 'Extra Title',
'input' => 'text',
'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL,
'required' => false,
'default' => '',
'user_defined' => true,
'default' => "",
));
$entityTypeId = $installer->getEntityTypeId('catalog_category');
$attributeSetId = $installer->getDefaultAttributeSetId($entityTypeId);
$attributeGroupId = $installer->getDefaultAttributeGroupId($entityTypeId, $attributeSetId);
$installer->addAttributeToGroup(
$entityTypeId,
$attributeSetId,
$attributeGroupId,
'cat_extra_title'
);
answered May 5 '16 at 7:10
Neklo.comNeklo.com
2,2991618
2,2991618
add a comment |
add a comment |
I ran into the same issue today. I created a new custom category attribute (an int/select one), and I would try this, in list.phtml, and get an empty value:
$value = Mage::registry('current_category')->getData('my_custom_Attribute');
However, this was solved by re-indexing catalog_category_flat
; with n98:
n98-magerun.phar index:reindex catalog_category_flat
Now, the same code produces the value, so long as a value exists for the category (if the value is empty/NULL, then, of course, it will still produce a NULL value).
New contributor
add a comment |
I ran into the same issue today. I created a new custom category attribute (an int/select one), and I would try this, in list.phtml, and get an empty value:
$value = Mage::registry('current_category')->getData('my_custom_Attribute');
However, this was solved by re-indexing catalog_category_flat
; with n98:
n98-magerun.phar index:reindex catalog_category_flat
Now, the same code produces the value, so long as a value exists for the category (if the value is empty/NULL, then, of course, it will still produce a NULL value).
New contributor
add a comment |
I ran into the same issue today. I created a new custom category attribute (an int/select one), and I would try this, in list.phtml, and get an empty value:
$value = Mage::registry('current_category')->getData('my_custom_Attribute');
However, this was solved by re-indexing catalog_category_flat
; with n98:
n98-magerun.phar index:reindex catalog_category_flat
Now, the same code produces the value, so long as a value exists for the category (if the value is empty/NULL, then, of course, it will still produce a NULL value).
New contributor
I ran into the same issue today. I created a new custom category attribute (an int/select one), and I would try this, in list.phtml, and get an empty value:
$value = Mage::registry('current_category')->getData('my_custom_Attribute');
However, this was solved by re-indexing catalog_category_flat
; with n98:
n98-magerun.phar index:reindex catalog_category_flat
Now, the same code produces the value, so long as a value exists for the category (if the value is empty/NULL, then, of course, it will still produce a NULL value).
New contributor
New contributor
answered May 10 at 0:01
Aaron ManninoAaron Mannino
1
1
New contributor
New contributor
add a comment |
add a comment |
Thanks for contributing an answer to Magento Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f113833%2fget-custom-category-attribute-value%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
which page you are showing the value?
– Qaisar Satti
May 4 '16 at 6:28
1
First you try to print the values of the current category by using var_dump($category->getData()). Whether the values of 'cat_extra_title' is retrieving or not.
– Manikandan
May 4 '16 at 6:40
@Manikandan there are values retrieved but the 'cat_extra_title' value is not included in them. Why?
– zekia
May 4 '16 at 8:12
2
try $category->getCatExtraTitle();
– Manikandan
May 4 '16 at 9:05
1
Can you print the values and share the link
– Manikandan
May 4 '16 at 9:15