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?

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
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
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
6 votes
Accepted

How to create custom dropdown attribute for customer in magento

Try this: <?php require_once('app/Mage.php'); Mage::app('default'); $installer = new Mage_Customer_Model_Entity_Setup('core_setup'); $installer->startSetup(); $entityTypeId = (int)$...
Abdul's user avatar
  • 9,702
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
  • 35.7k
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,344
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.3k
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.4k
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.8k
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,236
2 votes

How do I show drop down list in advanced search?

You can rewrite this class to deal with select and multiselect frontend input types replace this public function getAttributeSelectElement($attribute) { $extra = ''; $options = $...
vhanahrni's user avatar
  • 111
2 votes
Accepted

Attributes did't selected in backend after changed from dropdown to multi-select

Attribute after moving from SELECT to MULTISELECT is working. It's getting saved in the backend. As suggested by "David Verholen", it's not good to use DIRECT SQL Queries. Always must use Install/...
Shivani's user avatar
  • 521
2 votes
Accepted

display attribute to specific customer group

A simple Google-search ("magento product attribute via customer group") reveals that this question has been asked before on stackoverflow. "Displaying custom product attributes based on customer ...
Elias's user avatar
  • 243
2 votes
Accepted

CE 1.9.2 - Create Product Attribute based on Custom Module

Presuming you have set up all your Models successfully. You can do this using your own source model. Create a file at Yourmodule/Namespace/Model/Source/Distributor.php Inside this you need to ...
JoshCarter's user avatar
2 votes

Magento 1 - How to display static block based on dropdown selection of created attribute?

It may be that your product model does not contain the value. Try : $choice = $_product->getResource()->getAttribute('tableselect')->getFrontend()->getValue($_product)); if ($choice == "...
Fisheye Chris's user avatar
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

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,775
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,129
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

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

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.3k
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

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