magento set dropdown attribute value by selected value instead of idProduct attribute genarate value depending on other attribute valueHow to remove a product's attribute valueAdd/Edit Product - Append selected attribute value to product titleSet dropdown value using text valueMagento Configurable Product Page Update Custom Dropdown With Attribute ValueAttribute dropdown not showing on product page Magento1.9.2.1Magento 2: Product/Customer Attribute with Dropdown Not Taking it's Given ValueNew value to dropdown of product attribute is ignored : Magento 2.1How to add attribute options value in Magento2 Programmatically?Why Product attribute assigned to all attribute set
When should a starting writer get his own webpage?
label a part of commutative diagram
Did Nintendo change its mind about 68000 SNES?
How to find the largest number(s) in a list of elements?
Why didn’t Eve recognize the little cockroach as a living organism?
Hot air balloons as primitive bombers
Nested Dynamic SOQL Query
Asserting that Atheism and Theism are both faith based positions
Determine voltage drop over 10G resistors with cheap multimeter
How to balance a monster modification (zombie)?
Why is this tree refusing to shed its dead leaves?
Why is participating in the European Parliamentary elections used as a threat?
TDE Master Key Rotation
The English Debate
How can an organ that provides biological immortality be unable to regenerate?
Why doesn't the fusion process of the sun speed up?
PTIJ: Which Dr. Seuss books should one obtain?
Are hand made posters acceptable in Academia?
Is xar preinstalled on macOS?
How much propellant is used up until liftoff?
What is the difference between something being completely legal and being completely decriminalized?
Emojional cryptic crossword
Recursively updating the MLE as new observations stream in
Does fire aspect on a sword, destroy mob drops?
magento set dropdown attribute value by selected value instead of id
Product attribute genarate value depending on other attribute valueHow to remove a product's attribute valueAdd/Edit Product - Append selected attribute value to product titleSet dropdown value using text valueMagento Configurable Product Page Update Custom Dropdown With Attribute ValueAttribute dropdown not showing on product page Magento1.9.2.1Magento 2: Product/Customer Attribute with Dropdown Not Taking it's Given ValueNew value to dropdown of product attribute is ignored : Magento 2.1How to add attribute options value in Magento2 Programmatically?Why Product attribute assigned to all attribute set
i wrote custom code to assign attribute to product , issue is with dropdown attribute say color with values : red , green , yellow
not i want to set value of color to be red so i used code below
$product->setColor('red')
but it does not works as i neet to put id instead of vlaue , but i do not want to put id , can anyone help in this case
product magento-1
bumped to the homepage by Community♦ 12 hours ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
add a comment |
i wrote custom code to assign attribute to product , issue is with dropdown attribute say color with values : red , green , yellow
not i want to set value of color to be red so i used code below
$product->setColor('red')
but it does not works as i neet to put id instead of vlaue , but i do not want to put id , can anyone help in this case
product magento-1
bumped to the homepage by Community♦ 12 hours ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
add a comment |
i wrote custom code to assign attribute to product , issue is with dropdown attribute say color with values : red , green , yellow
not i want to set value of color to be red so i used code below
$product->setColor('red')
but it does not works as i neet to put id instead of vlaue , but i do not want to put id , can anyone help in this case
product magento-1
i wrote custom code to assign attribute to product , issue is with dropdown attribute say color with values : red , green , yellow
not i want to set value of color to be red so i used code below
$product->setColor('red')
but it does not works as i neet to put id instead of vlaue , but i do not want to put id , can anyone help in this case
product magento-1
product magento-1
edited Feb 15 at 4:24
Rizwan
830526
830526
asked Dec 2 '15 at 3:46
mcodermcoder
40811031
40811031
bumped to the homepage by Community♦ 12 hours ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
bumped to the homepage by Community♦ 12 hours ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
Try this
<?php
//Possible color value
$attribute = Mage::getModel('eav/config')->getAttribute('catalog_product', 'color'); //"color" is the attribute_code
$allOptions = $attribute->getSource()->getAllOptions(true, true);
foreach ($allOptions as $instance)
$id = $instance['value']; //id of the option
$value = $instance['label']; //Label of the option
?>
it will display your Label and ID
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%2f92270%2fmagento-set-dropdown-attribute-value-by-selected-value-instead-of-id%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Try this
<?php
//Possible color value
$attribute = Mage::getModel('eav/config')->getAttribute('catalog_product', 'color'); //"color" is the attribute_code
$allOptions = $attribute->getSource()->getAllOptions(true, true);
foreach ($allOptions as $instance)
$id = $instance['value']; //id of the option
$value = $instance['label']; //Label of the option
?>
it will display your Label and ID
add a comment |
Try this
<?php
//Possible color value
$attribute = Mage::getModel('eav/config')->getAttribute('catalog_product', 'color'); //"color" is the attribute_code
$allOptions = $attribute->getSource()->getAllOptions(true, true);
foreach ($allOptions as $instance)
$id = $instance['value']; //id of the option
$value = $instance['label']; //Label of the option
?>
it will display your Label and ID
add a comment |
Try this
<?php
//Possible color value
$attribute = Mage::getModel('eav/config')->getAttribute('catalog_product', 'color'); //"color" is the attribute_code
$allOptions = $attribute->getSource()->getAllOptions(true, true);
foreach ($allOptions as $instance)
$id = $instance['value']; //id of the option
$value = $instance['label']; //Label of the option
?>
it will display your Label and ID
Try this
<?php
//Possible color value
$attribute = Mage::getModel('eav/config')->getAttribute('catalog_product', 'color'); //"color" is the attribute_code
$allOptions = $attribute->getSource()->getAllOptions(true, true);
foreach ($allOptions as $instance)
$id = $instance['value']; //id of the option
$value = $instance['label']; //Label of the option
?>
it will display your Label and ID
answered Dec 2 '15 at 4:59
Magento 2Magento 2
2,41472875
2,41472875
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%2f92270%2fmagento-set-dropdown-attribute-value-by-selected-value-instead-of-id%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