Skip to main content
40 votes
Accepted

When we look at an eavSetup what values are available for type and input?

You can find type and input value from the database eav_attribute table. Type datetime decimal int static text varchar Input boolean date gallery hidden image media_image multiline multiselect ...
Rakesh Jesadiya's user avatar
27 votes
Accepted

Magento 2: Are Flat Tables Still a Thing?

Yes, flat tables are still a thing. You can enable flat tables for products and categories from stores->configuration->catalog->storefront. Why do we need flat tables? They do offer significant ...
Abhishek Jakhotiya's user avatar
22 votes

Find the table for custom attribute values

When you create an attribute for a product, EAV (Entity Attribute Value) comes into the picture. To get a value you need to know the basic ways Magento stores EAV data. For this, the following tables ...
Ashish Madankar M2 Professiona's user avatar
20 votes
Accepted

What are entities in Magento 2?

The eav_attribute table's column entity_type_id is mapped to the eav_entity_type table, you can see the entities there.
Atish Goswami's user avatar
15 votes

Make Magento 2 Product Attribute Read-Only

Starting from 2.1 Magento uses UI component to build product admin form. Thus, it should be customized as suggested in the manual. In particular, your task could be accomplished with modifier ...
dan.kocherga's user avatar
11 votes

Magento 2 - Add custom attribute in customer registration form

If your install data script successfully installed your custom attribute, now you just need to override addition information phtml file and set your custom attribute in that. Create Vendor/TestModule/...
Janak Bhimani's user avatar
11 votes
Accepted

Magento 2 : How to Get all User Defined Attributes in Product Model

We should use Service Contracts Layer. /** * @var \Magento\Framework\Api\SearchCriteriaBuilder */ protected $searchCriteriaBuilder; /** * @var \Magento\Eav\Api\AttributeRepositoryInterface */ ...
Khoa TruongDinh's user avatar
11 votes
Accepted

row_id vs entity_id in magento 2.3 EE

Time Dimension row_id is used to facilitate the Time Dimension for entities that support it. By having this additional identifier, it allows an entity (product, category, sales rule, etc..) to be ...
sdaugherty's user avatar
  • 1,231
10 votes

Magento 2 - How to get attribute options value of eav entity?

Use the following code to get all attribute options. function getExistingOptions( $object_Manager ) { $eavConfig = $object_Manager->get('\Magento\Eav\Model\Config'); $attribute = $eavConfig->...
Liz Eipe C's user avatar
  • 1,296
9 votes

Setting attribute labels programmatically

You can set the frontend labels with the following code in your UpgradeData or InstallData script: /** @var \Magento\Eav\Setup\EavSetup $eavSetup */ $eavSetup = $this->eavSetupFactory->...
Andreas von Studnitz's user avatar
8 votes

Magento 2: Are Flat Tables Still a Thing?

Based on magento documentation for flat table mentioned in https://docs.magento.com/m2/ce/user_guide/catalog/catalog-flat.html Starting with Magento 2.3.0+, the use of a flat catalog is no longer a ...
Sarjan Gautam's user avatar
7 votes

Why attributes of bundle items of a bundle product are also saved to the bundle product itself? (database-wise)

Update: how to stop the indexer from including child products Extend and modify Mage_Catalog_Model_Resource_Product_Indexer_Eav_Abstract. Look for the function _prepareRelationIndex(). Modify the SQL ...
d.yuk's user avatar
  • 679
7 votes
Accepted

Get `entity_type_id` by `entity_type_code`

To do so you need to use Magento/Eav/Model/Config class. Here's some code using the object manager (it is not recommended, please use dependency injection in your final code) $entityTypeId = $...
Raphael at Digital Pianism's user avatar
7 votes

Attribute property 'system' - what it exactly does

If some attribute is flagged as "is_system" = true Then such attribute deny to change some specific options on attribute edit page, as shown below vendor/magento/module-customer-custom-attributes/...
zhartaunik's user avatar
  • 3,846
7 votes

Magento 2: Schema Changes for EE Catalog Staging

I can't reference the code on account of EE licensing, but in short: Yes. Magento Enterprise Edition 2.1.0 introduced a new 'content staging' feature, which involves some quite invasive changes to the ...
Ryan Hoerr's user avatar
  • 12.3k
7 votes

What is the difference between `joinField` and `joinTable` in collections?

Both methods are almost identical, the difference is that joinField() only selects a single column from the joined table, while you can specify an array of columns in joinTable`. So you can always ...
Fabian Schmengler's user avatar
7 votes
Accepted

What is the use of the is_data_sharing field in eav_entity_type?

I may be wrong, but I think for now it does nothing. Maybe it's the start of a feature that didn't get implemented yet. I've searched in the code for anything matching is_data_sharing, isDataSharing ...
Marius's user avatar
  • 198k
7 votes

What is the right way to get both, the admin translation and the frontend value of a multiselect attribute?

Assuming your attribute options are coming from a table, and I assume they are because you reference admin and store values, we should be able to call \Magento\Eav\Model\Entity\Attribute\Source\Table::...
Richard Klint's user avatar
6 votes

Source Model not found for Attribute

For those who might have this issue, I solved it by another way. It happened when I disabled a module and some attributes were still trying to be launched in db, even if they were useless. what i did ...
Nicolas D's user avatar
  • 191
6 votes

Magento 2 - How to get attribute options value of eav entity?

I use the Api Service Layer Magento\Eav\Api\AttributeRepositoryInterface suggested by @kandy in comments on @marius answer. Inject the service data member in your constructor as follow. protected $...
Muhammad Saeed Khan's user avatar
6 votes
Accepted

Attribute property 'system' - what it exactly does

System attributes are the default attributes shipped natively with the software. The purpose is to be able to differentiate Magento system attributes and custom attributes. I reckon it is similar to ...
Raphael at Digital Pianism's user avatar
6 votes
Accepted

Magento 2: What is the difference between the row_id and entity_id in the %_entity tables?

From what I have found on this one, row_id is the identifier for the row, while entity_id is the actual entity. There are situations where a Scheduled Update is set to run for a fixed period and in ...
Joshua Fricke's user avatar
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
6 votes

Product EAV Index never finishes processing

I think one is to set change in the database the state of the processing indexes because till there are processing indexes no other index gets updated and neither the command line works. You can use ...
surbhi agr's user avatar
6 votes
Accepted

Magento 2 How to add custom attribute to customer address and how to insert value in that attribute?

I have created it with below code in InstallData.php file. namespace Module\Name\Setup; use Magento\Customer\Setup\CustomerSetupFactory; use Magento\Eav\Model\Entity\Attribute\Set as AttributeSet; ...
Utsav Gupta's user avatar
  • 1,243
5 votes

Magento2 Adding Custom Order Attribute

Create your own module and create the Setup/InstallData.php <?php namespace Own\Module\Setup; use Magento\Customer\Model\Customer; use Magento\Framework\Encryption\Encryptor; use Magento\...
ntzz's user avatar
  • 534
5 votes

What are entities in Magento 2?

Well, englishly speaking, every object is an entity right ? But I reckon you're referring to an entity as the EAV (Entity - Attribute - Value) implementation of Magento. So to answer your question, ...
Raphael at Digital Pianism's user avatar
5 votes

Magento 2 - How to get attribute options value of eav entity?

You can do it simply call below code inside your Block file. <?php namespace Vendor\Package\Block; class Blockname extends \Magento\Framework\View\Element\Template { protected $...
Rakesh Jesadiya's user avatar
5 votes

Magento attribute change backend_type from varchar to text

Even though the shell script by vladPavlov may work, I preferred doing it via a setup script using models and no direct SQL. The following script will change the type from the attribute my_attribute ...
Simon's user avatar
  • 5,736
5 votes

Filter Category Collection by Enabled, Visible Products

$collection = Mage::getModel('catalog/product')->getCollection()->addAttributeToSelect('*'); $collection->addFieldToFilter('visibility', Mage_Catalog_Model_Product_Visibility::VISIBILITY_BOTH)...
Priyanka Saini's user avatar

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