Skip to main content
19 votes
Accepted

How to show the drop down attribute value using getData() method in magento 2?

Instead of getData() you need to use getAttributeText('attribute_code') for dropdown attributes. like $_product->getAttributeText('material'); For multi-select try this : $result = $_product-&...
Ashish Jagnani's user avatar
14 votes
Accepted

Configurable product attribute sort order in Dropdown 2.12

I faced the same attribute options sorting issue at front-end, As I checked this issue and found that while fetching the attribute options, there is no sorting filter added in the query by default in ...
Jagdish Ram's user avatar
8 votes
Accepted

Magento 2 - Set simple product Color when creating product programmatically

$attr = $_product->getResource()->getAttribute('color'); $avid = $attr->getSource()->getOptionId('Blue'); //name in Default Store View $_product->setData('color', $avid); I found the answer from here ...
user3748173's user avatar
8 votes

How to show the drop down attribute value using getData() method in magento 2?

To fetch value of attribute Use: $this->getProduct()->getAttributeText('material'); Or $this->getProduct()->getResource()->getAttributeRawValue($this->getProduct()->getId(),'...
Sameer Bhayani's user avatar
8 votes

How to show the drop down attribute value using getData() method in magento 2?

You can get product attribute option values by below code $_product->getAttributeText('material'); You can get multi select option values by $_attributeValue = $block->getProduct()->...
Suresh Chikani's user avatar
7 votes
Accepted

Create Product Attribute Of Type MULTISELECT or dropdown select & Create Option Labels Diffrent for Diffrent Store using install or upgrade schema

I have check the core how magento install the label and I found code in below file vendor/magento/module-eav/Setup/EavSetup.php in this file I got addAttributeOption method. After seeing the ...
Murtuza Zabuawala's user avatar
5 votes

Default value of 'yes/no' dropdown custom product attribute

I had the problem that with the code snippets above a select-attribute was created instead of a yes/no attribute. To fix this I had to use 'input' => 'boolean' instead of: 'input' ...
ahe_borriglione's user avatar
5 votes
Accepted

How to add new Option to drop down attributes magento2?

Try following way: protected $eavAttributeFactory; protected $attributeOptionManagement; public function __construct( \Magento\Eav\Model\Entity\AttributeFactory $eavAttributeFactory, \...
Sohel Rana's user avatar
5 votes
Accepted

Add a drop-down field in checkout form Magento 2

Step 1: Create module.xml app/code/Vendor/CheckoutAdditionalField/etc/module.xml <?xml version="1.0"?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:...
Rakesh Donga's user avatar
  • 5,394
4 votes
Accepted

Magento 2 : Display dropdown attribute with its label in product listing page

For that, you need to override renderer.phtml file and need to change onlySwatches and enableControlLabel attributes value. Go to app/design/frontend/<VendorName>/<themeName>/...
Rohan Hapani's user avatar
  • 17.5k
3 votes

How to show the drop down attribute value using getData() method in magento 2?

$_product->getAttributeText('material'); is the right answer --- beware that $_product->getResource() is a deprecated function
Alex's user avatar
  • 13.9k
3 votes

Configurable product attribute sort order in Dropdown 2.12

Go to Configurable product page -> Edit Configuration -> Click next -next - next and don't change anything Then save the product and they should be in order.
Sebastian Tomic's user avatar
3 votes
Accepted

set custom dropdown attribute for customer

You did not create Customer attribute properly. As you have create a dropdown Customer attribute so you need to define source model for this attribute. "source" => "[module_Model_Prefix]/...
Amit Bera's user avatar
  • 77.6k
3 votes
Accepted

How to show the product attribute in the product listing page Magento 2.3

Method 1: echo $_product->getAttributeText('manufacturer'); Method 2: $manufacturer = $_product->getResource()->getAttribute('manufacturer'); echo $manufacturer->getFrontend()->...
leo's user avatar
  • 1,246
2 votes

Configurable product attribute sort order in Dropdown 2.12

In v2.3.x you can sort the order of the attributes by option label in a configurable product drop down selector by extending Magento\ConfigurableProduct\Model\AttributeOptionProvider and using ...
paj's user avatar
  • 5,954
2 votes
Accepted

How to enable search for selected dropdown values?

check below code <div class="search"> <li class="fields"> <label for="technologies"><?php echo $this->__('Technologies'); ?></label> <?php $url = Mage::getBaseUrl()...
Prashant Barot's user avatar
2 votes
Accepted

How to get value of custom dropdown product attribute?

$product = Mage::getModel('catalog/product')->load($item->getProductId()); $product->getAttributeText('soldby');
Konstantin Gerasimov's user avatar
2 votes
Accepted

getAttributeRawValue gives an id

Try it using getAttributeText() function and this function will only work with the attribute type select $col=$simp->getAttributeText('manufacturer_color'); getAttributeRawValue() returns the id ...
Gopal Patel's user avatar
  • 3,139
2 votes
Accepted

Magento 1.9: validate custom attribute

I suggest to use default Magento validation method as below. Replace <script type="text/javascript"> // Add our field to the data submitted by Review.save() Review.prototype.save = Review....
Amitkumar solanki's user avatar
2 votes
Accepted

Magento 2: Get Product Attribute’s Select Option Id as Per Option Value For Configurable Product

You have defined $attr instead of $packaging in your code. <?php $packaging =$_product->getResource()->getAttribute('packaging')->getFrontend()->getValue($_product);?> $...
Rakesh Jesadiya's user avatar
2 votes
Accepted

How to Show Admin Label in drop down fillter on product grid?

You need to create custom file for add options in dropdown like below way : <item name="options" xsi:type="object">Vendor\Module\Ui\Component\Listing\Column\Myoptions</item> You need to ...
Rohan Hapani's user avatar
  • 17.5k
2 votes
Accepted

Display product attribute dropdown box value on product page, with custom placement?

See the blocks original template (vendor/magento/module-catalog/view/frontend/templates/product/view/attribute.phtml), especially this condition: $_attributeType = $block->getAtType(); //[...] if ($...
Christoph Farnleitner's user avatar
1 vote

getAttributeRawValue gives an id

You can use getAttributeText to get product label. $label = Mage::getModel("catalog/product")->load($simp)->getAttributeText("manufacturer_name"); You can use as per Marius's answer like, $...
Jaimin Sutariya's user avatar
1 vote

Show the SKU in the dropdown of Configurable Products?

I don't think this is possible. And here is why. Let's say you have a configurable product with 2 configurable attributes. Size and color. 2 sizes (S, L) and 2 colors (Red, Blue). So there are 4 ...
Marius's user avatar
  • 198k
1 vote

How to get value of custom dropdown product attribute?

Please try this: $seller= Mage::getModel('catalog/product')->load($item->getProductId()); $seller->getAttributeText('soldby');
Prasanta Hatui's user avatar
1 vote

How to show the drop down attribute value using getData() method in magento 2?

The answers above were partially missing something (at least for my case, since I needed to use the custom attribute value inside the cart template), if you want to pass the custom attribute to a ...
Oliver Benoit's user avatar
1 vote

Configurable product attribute sort order in Dropdown 2.12

Because this issue is still present also in the latest release 2.1.7 you can use this workaround: Go to configurable product page->Configurations->remove all simple products After that add them ...
WEBSHOT's user avatar
  • 282
1 vote

Configurable product attribute sort order in Dropdown 2.12

If you mean that Newborn is attribute value, you need to go to Stores -> Attributes (Product), find needed attribute and also using drag&drop with your mouse change position of options. The ...
Lilian Rameriz's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible