Timeline for Magento 2 - How to get attribute options value of eav entity?
Current License: CC BY-SA 3.0
13 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Aug 31, 2018 at 6:12 | comment | added | zekia | @Marius I've read this article but there's a big step between a basic module and a module with controllers and blocks. I can't fill the blanks there. That's why I asked for a more detailed step-step answer. | |
Aug 29, 2018 at 11:20 | comment | added | Marius♦ | @zekia maybe this helps: inchoo.net/magento-2/how-to-create-a-basic-module-in-magento-2 | |
Aug 29, 2018 at 10:39 | comment | added | zekia | Could you post this as a step-step answer?? I don't know how to create a module like that in magento2, so I don;t know how to use that code. | |
Oct 20, 2016 at 11:28 | comment | added | Pandurang Babar | @MagentoOdoo.com get value and label like below <?php foreach ($options as $option):?> <option value="<?php echo $option['value'] ?>"<?php if ($option['value'] == $fieldValue) echo ' selected="selected"' ?>><?php echo $option['label']->getText();?></option> <?php endforeach;?> | |
May 23, 2016 at 9:55 | review | Suggested edits | |||
May 23, 2016 at 10:06 | |||||
Mar 8, 2016 at 12:16 | comment | added | Marius♦ | @KAndy Good remark. You can write that as an answer. I think it's far better than mine. | |
Mar 8, 2016 at 11:54 | comment | added | KAndy |
Small but important remark: If available, better to use Module Service Layer. For eav attributes it's \Magento\Eav\Api\Attribute RepositoryInterface . Anything not marked as @api treated as private and can be removed in minor releases.
|
|
Mar 8, 2016 at 8:47 | comment | added | MrTo-Kane | Okey! I resolved => $attributesArrays = array(); foreach($options as $cal=>$val){ $attributesArrays[$val['value']] = $val['label']->getText(); } | |
Mar 8, 2016 at 8:29 | comment | added | MrTo-Kane | array(2) { [0]=> array(2) { ["value"]=> int(1) ["label"]=> object(Magento\Framework\Phrase)#1504 (2) { ["text":"Magento\Framework\Phrase":private]=> string(7) "Enabled" ["arguments":"Magento\Framework\Phrase":private]=> array(0) { } } } [1]=> array(2) { ["value"]=> int(2) ["label"]=> object(Magento\Framework\Phrase)#1494 (2) { ["text":"Magento\Framework\Phrase":private]=> string(8) "Disabled" ["arguments":"Magento\Framework\Phrase":private]=> array(0) { } } } } | |
Mar 8, 2016 at 8:26 | comment | added | Marius♦ | see how the result looks like. Var dump it or something. | |
Mar 8, 2016 at 8:21 | vote | accept | MrTo-Kane | ||
Mar 8, 2016 at 8:19 | comment | added | MrTo-Kane | How to get "value" and "label"? | |
Mar 8, 2016 at 7:58 | history | answered | Marius♦ | CC BY-SA 3.0 |