DEV Community

Muhammad Sadam Sadewa
Muhammad Sadam Sadewa

Posted on

How to organize dynamic attributes/properties of products specification?

Hello all,

First, I'm newbie and really happy to join this awesome community.

Currently, I'm learning to build a assets management system. The system I was design is consist part of brand, attribute, category, model, and asset.

I'm trying to achieve that all model should have same attribute when they are in the same category. Example a model of Google Pixel 3 and Pixel 4 should be have same attribute like SoC, display, ram size, internal storage, and etc because they are in the same category "Smartphone".

What I do is bind attribute to category. So, when user trying to add category he needs to declare the attributes of assets. And when he add new model and choose the category, a group of inputs it's show up as he declare when he add attribute to category.

The Table Relation

I'm still working on it, and don't know how it's work when user disable or edit attributes.

Please, need your advice or any other best practices to achive dynamic attribute?

Thank you,
mssadewa

Discussion (2)

Collapse
aarone4 profile image
Aaron Reese • Edited on

Hi Muhammed , welcome to the community. You are facing the classic entity-attribut-value problem and there is no one good answer. Any solution will involve compromise, especially in a relational model.
How will you handle changes in category attributes and their valid range of values. E.g. smartphones get hologram projection an up to 7 cameras. Now old phones don't have the old attribute. How are you going to search across categories for products that have similar attribute values but may be in different categories. Eg compact, DSLR and video cameras
EAV is often 'solved' using documents, either JSON or XML and implenting search technology for the index. Good luck in solving this .It is one of the trickiest problems to fix at scale

Collapse
mssadewa profile image
Muhammad Sadam Sadewa Author

Hi Aaron,
Thanks for the respon.
That what I though when specification/attribute evolve, user need to update the attribute and I'm still don't know what will happen when active asset and model exist and user update attribute of category.
I've read about EAV and implement it on but I'm forgot to update the table relation diagram.
Thank you