Question about ID attributes. How do they assign non-default numbers? For example, brand1 = id1. Size 47 = id47
Converted Attribute Code
When creating an attribute, Magento usually just stripts
special characters and converts to
lowercase when generating an Attribute Code. For example:
I am an attribute becomes
Assigned Attribute ID
When the Attribute ID is generated, it assigns the last unused ID (as controlled by the DB Table settings). So, if my last attribute have an ID of
45 then the next one would be
46. This is still the case even if you remove old attributes. The ID never “back-fills”.
You can verify this in phpMyAdmin under the Table
eav_attribute under the Operations tab:
So my next Product Attribute will be assigned Attribute ID
Good. Where to change is understandable. The question is a little different. If I change the ID in the database - what is the danger? For example, a manufacturer with “manufacturer=5642” to “manufacturer=30” Or size from “size=5601” to “size=47”.
It’s hard to say. Making direct DB changes normally tends to break everything rather quickly. This post displays a Table Diagram (Magento 2 Database Diagram) that gives you a visual indication of how one table is linked to another. Breaking that chain may have a cascading effect. The only one to know for sure is testing it in your development environment.