Reputation: 33
I am working on ecommerce project i had little confusion to create table on database.
Now i am creating multiple product in ecommerce like flikart. for clothing i need different specification(color,size) and for mobile i need different specification(ram,storage) and each product i had different specification.
If i view the page in front end (if i selected mobile means it should display only specification based on mobile phone).
how to create table for this purpose.
Upvotes: 0
Views: 1073
Reputation: 3593
You need to study about EAV
concept which is Entity Attribute value.
your tables could be:
categories (id, title, parent_id, status) ; here parent_id is to handle child categories
products (id, title, description, price, status, quantity)
attributes (id, title, status) ; attribute can have colors, sizes
attributevalues (id, attribute_id, value, status) ; it contains colors's attribute_id and values can be green, red, yellow etc
attributes_products (id, product_id, attribute_id, attributevalue_id, price, sign) ; it will be attaching attribute title with options to a product also how much price add or minus in case of products attributes
in case of query, do ask more
Upvotes: 1