CODE-AXION's avatar

i am confused if i should use product_category pivot table or use tags table and product_tags table

i have an ecommerce application where i have categories and subcategories now the problem is for eg:- i have a category calls Clothes which have subcategories Men, Women and Kids and each subcategory has its own subcategories like men hoodies, men jeans etc... but i want to show men hoodies in black hoodies category too etc...

so i have 2 options either make 1) product_category table or make 1) tags table and 2) product_tags table so what should i do ??...

Clothes - Main Category--
|_Men
			|_Men Hoodies // this is the men hoodies
			|_Men Jeans
			|_Men Jackets
		
|_Women
			|_Women Skirts
			|_Women Hoodies
			|_Women Bags
|_Kids
			|_Kids Toys
			|_Kids Pants

All Hoodies - Main Category--
			|_ Black Hoodies //but i want to show the men hoodies here too
			|_ Detachable Hoodies
			|_ Funky Hoodies

0 likes
3 replies
Nihir's avatar

You have to use product_category or in table you can try category_id which is easy to make realationship via model.

CODE-AXION's avatar

@Nihir yeah i have already done that thing i was just confuse to either use tags or use product_category table

Nihir's avatar

Then you have to use product_category .

1 like

Please or to participate in this conversation.