4
I am about to start the development of an e-commerce, but I am focused on the issue of modeling, especially regarding categories and subcategories of products. For example. A category can have several sub-categories. Each sub-category can also have sub-categories (maximum of 3 levels). Sort of like this:
-Categoria
--Sub Categoria
---Sub-sub categoria
How would that look in the database? Would it be a relationship? If yes, or if not, someone can give an example?
Another question. Example:
Vestiário
-- Camisetas
-- Masculino
---- Camiseta M. pollo tam. G (produto)
If this T-shirt belongs to men, then it automatically perceives T-shirts and clothing. I will use Rails, as I would implement this kind of behavior there?
I don’t know Rails, but I think the concept of scaffolding of it may be useful.
– Oralista de Sistemas
See if this helps: link
– Mukotoshi
I would make a table of categories with self-relationship allowing n subcategories, the relationship with products would be something of the product-<product_category>----category , trying to summarize .... (1) Refrigerant category, sub-glues , sub-sugar-free /// (2) Non-dietetics category , sub-refrigerants , the product Motta-glue-on categories (1) and (2)
– Motta
About the modeling part of the database, see How to model a tree data structure using a relational database?. About doing this in Rails I didn’t find much here on the site, but maybe this be a start.
– bfavaretto
@Motta Your comment is almost an answer, missing only a little detail.
– user7261
@Andrey , I will try to detail how to answer, but the kind of question that does not have a single answer.
– Motta