22 votes
Accepted

Magento2 : user define customer attribute not save value while create / save from admin

looks like the issue was due to the fact your attributes are not assigned to the customer attribute set. the following code is needed in your install: I added full code for you at https://bitbucket....
Herve Tribouilloy's user avatar
13 votes
Accepted

Magento 2 : How to know "used_in_forms" param of eav attribute for a form?

You can get all used_in_forms in magento by typing below query, Used in form customer attribute: SELECT DISTINCT form_code FROM customer_form_attribute WHERE 1 adminhtml_checkout ...
Rakesh Jesadiya's user avatar
12 votes
Accepted

magento 2 Get attribute option label by attribute option Id?

You need to add following in your __construct method protected $optionFactory; protected $_attributeOptionCollection; public function __construct( \Magento\Eav\Api\Data\...
Chander Shekhar's user avatar
9 votes

magento 2 Get attribute option label by attribute option Id?

Try the following code: $_optionId = '53'; $_attributeId = $_product->getResource()->getAttribute('color'); if ($_attributeId->usesSource()) { $_optionText = $_attributeId->...
Vlad Patru's user avatar
  • 1,200
9 votes
Accepted

Which entity allows scoped attributes?

customer and customer_address Does not support Scope Attribute [Global] catalog_category and catalog_product Does support Scope Attribute [Default, Website and Store] So the question is, Sales tables ...
Aditya Shah's user avatar
  • 7,617
8 votes

“Type Error occurred when creating object: Magento\\Eav\\Model\\Entity\\Attribute\\Source\\Config”

Try to look at the customer eav attribute with select value for frontend_input column in eav_attribute table, make sure the source_model column value is not null or empty or it fills with correct ...
Idham Choudry's user avatar
7 votes

Which entity allows scoped attributes?

As per my understanding you can only create custom attribute for below entity types: Customer (Scope: Global) customer_address (Scope: Global) catalog_category (Scope: Default, Website and Store) ...
Aman Agarwal's user avatar
6 votes
Accepted

Magento 2 Where is Product attribute Website_id stored in DB?

you can find the relation betweenn products and website in this table "catalog_product_website" Tell me if it works . Good Luck !!!
sami23's user avatar
  • 568
6 votes
Accepted

Magento 2 Can't add Attribute option upto 100 ? Is there any limit for the option?

Likely your PHP max input vars setting is to low, and it happens to cap at out 100 entries. Verify what this is set to, and raise it to something like 100,000 . Magento backend forms can contain many ...
Stephen Fritz's user avatar
5 votes

magento 2 Get attribute option label by attribute option Id?

Try the below code: $option_id = 5431; $attribute_code = 'coffee_type'; $objectManager = \Magento\Framework\App\ObjectManager::getInstance(); $eavConfig = $objectManager->get('\Magento\Eav\...
Mahendra's user avatar
  • 716
5 votes
Accepted

Magento 2: Create customer attributes programatically, without install script

After a long time and debugging and spent time on reading blogging site/forum I found the solution to create attribute in magento to programmatically and able to save value in this custom created ...
Purushotam Sharma's user avatar
5 votes

Magento 2 attribute backend_type static vs varchar

Static attributes are attributes stored in the main table of an entity - for catalog products, catalog_product_entity. For example, the attribute sku of catalog products is defined as static. Static ...
Vladyslav Sikailo's user avatar
4 votes

Magento2 custom attribute default value

Default values won't be applied to the existing entities, a default value will only set on an entity when an entity is saved.
Anshu Mishra's user avatar
  • 8,950
4 votes
Accepted

Magento 2 attribute backend_type static vs varchar

EAV is a flexible solution to storing data in a database. Relational databases are ideal for situations where there is a fixed number of descriptors (columns) for an entity row. This works well for, ...
Nilesh Gosai's user avatar
  • 1,135
3 votes

Magento 2: Create customer attributes programatically, without install script

Try following code: app/code/[VendorName]/[ModuleName]/registration.php \Magento\Framework\Component\ComponentRegistrar::register( \Magento\Framework\Component\ComponentRegistrar::MODULE,...
Pratik Oza's user avatar
  • 3,972
3 votes

Error with Magento\Eav\Model\Entity\Attribute how to fix?

Some migration or system that populates the database which caused the duplication of IDs. Magento core predicts a data created by its self, so this kind of error could be solved without stopping the ...
Rafael Corrêa Gomes's user avatar
3 votes

get eav attribute collection Code format in Magento2

Since getCollection is deprecated, I would go this way: namespace Vendor\Module\Model\Config\Source; use Magento\Framework\Data\OptionSourceInterface; use Magento\Eav\Model\ResourceModel\Entity\...
Attila Naghi's user avatar
  • 4,013
3 votes
Accepted

get eav attribute collection Code format in Magento2

add instance of Magento\Eav\Model\Attribute to the constructor of your class protected $eavAttribute; protected $entity; public function __construct( ... \Magento\Eav\Model\Attribute $...
Rakesh Varma's user avatar
  • 2,226
3 votes
Accepted

Magento 2.X: Customer custom attribute is not saving from admin or code

So I found the issue with the custom customer attribute. My process was : Create all my attributes with install/updrage scripts in my magento mpdules Use the Magento migration tool to migrate from ...
Taschert's user avatar
  • 569
3 votes
Accepted

How do I get a EAV Attribute Option Label from Option Id?

get the productdata by id or sku i am using getbyId $productData = $this->productRepository->getById($productId); $attributeValue = $productData->getAttributeText("attribute_code");//pass ...
mohith's user avatar
  • 486
3 votes

SQL error in [stage: data migration][step: EAV Step]: started

I have seen the same issue migrating a 1.9.2.4 store to 2.3.5-p1. The issue appears to be in the tool at src/Migration/Step/Eav/Data.php Around line 488. I got around it by checking if the attributes ...
Jonny C's user avatar
  • 131
3 votes
Accepted

Difference between catalog_attributes.xml vs eav_attributes.xml vs extension_attributes.xml

catalog_attributes.xml It contains the list of attributes that serve different purposes. For example, the group used_in_autogeneration is for listing attributes that have the value autogenerated. The ...
Anshu Mishra's user avatar
  • 8,950
2 votes
Accepted

Magento2 How to get the default attribute set id for Customer?

For get default attribute set ID for the customer: $attribute_set_id = \Magento\Customer\Api\CustomerMetadataInterface::ATTRIBUTE_SET_ID_CUSTOMER
Bhavin iFlair's user avatar
2 votes

Magneto2 : Add color swatch attribute option with colorcode value programmatically

Step 1 Start by creating a basic setup script for it, if you don't already have one. <?php namespace Package\Module\Setup; use Magento\Framework\Setup\UpgradeDataInterface; use Magento\Framework\...
Rakesh Donga's user avatar
  • 5,354
2 votes
Accepted

Error after creating boolean attribute magento2

First of all, $AttributeName is not defined. and you use that variable for frontend and label. I assume you changed your code before posting it here and you have somewhere $AttributeName = 'Attribute ...
Marius's user avatar
  • 198k
2 votes
Accepted

Magento 2 : addAttributeToFilter, addAttributeToSelect, addFieldToFilter not working

The collection works correct in my opinion, the data you look for is in store 2. So you just need to set the store id in your collection. $collection->setStoreId(2)->addAttributeToFilter('...
HelgeB's user avatar
  • 4,521
2 votes
Accepted

Is there any event on which we can observe eav attribute option save

You can try with this event it's working for me. Event name :: adminhtml_catalog_product_attribute_edit_frontend_prepare_form In observer you can get attribute detail and option like below ...
Zahirabbas's user avatar
  • 2,073
2 votes
Accepted

Doubt about attributes (getting the brand)

You can identify the type of an EAV attribute from its settings in the eav_attribute table: backend_type = int means that the attribute is of type integer and the value is stored in the table [...
HelgeB's user avatar
  • 4,521
2 votes

How is a product name retrieved if the query does not return it in the result set?

The main select contains only the data from the entity table (catalog_product_entity which happens your case) or the flat table if you have enabled the option to use flat tables for product data (...
HelgeB's user avatar
  • 4,521
2 votes
Accepted

What is the "static" backend type in EAV attribute Magento 2?

Static attributes are attributes stored in the main table of an entity - for catalog products, catalog_product_entity. For example, the attribute sku of catalog products is defined as static. Static ...
Sumit's user avatar
  • 4,875

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