DEV Community

Muhammad Sadam Sadewa
Muhammad Sadam Sadewa

Posted on

3

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

Hostinger image

Get n8n VPS hosting 3x cheaper than a cloud solution

Get fast, easy, secure n8n VPS hosting from $4.99/mo at Hostinger. Automate any workflow using a pre-installed n8n application and no-code customization.

Start now

Top comments (2)

Collapse
 
aarone4 profile image
Aaron Reese • Edited

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

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

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay