Skip to content

Instantly share code, notes, and snippets.

@duwaljyoti
Last active November 26, 2017 02:53
Show Gist options
  • Select an option

  • Save duwaljyoti/91e9c3bd0eb8ef732e43e9d73e54e67d to your computer and use it in GitHub Desktop.

Select an option

Save duwaljyoti/91e9c3bd0eb8ef732e43e9d73e54e67d to your computer and use it in GitHub Desktop.
i have one product..
for eg.. apache..
apache has three attributes..
attributes => 1) color 2) brakes 3) ABS
value of attributes..
color => 1) red 2) white
brakes => 1) disc 2) drum
ABS => 1) Yes 2) No
now for admin panel..i want them as single one because they may have different price
i want to list variants like.. price items_num_left available_discount
1) apache red disc brake with ABS 85,000 45 7,000
2) apache red disc brake without ABS 88,000 87 9,000
3) apache red drum brake with ABS 87,00 47 11,000
4) apache red drum brake without ABS 84,000 33 14,000
5) apache while disc brake with ABS 88,000 22 8,000
6) apache white disc brake without ABS 91,000 71 12,000
7) apache white drum brake with ABS 87,000 56 12,000
8) apache white drum brake without ABS 86,000 48 13,000
whereas in the front end of the website..
i want it sth like..
choose color (select box) => 1) Red 2) white (default red)
choose brake system (select box) => 1) Drum 2) Disc (default drum)
choose ABS (select box) => 1) Yes 2) No
I currently have an attribute table..
where
color, brake-system and abs will get stored..
and a product_attribute table
where its value..will be stored..
and the confusion now is on how shall i get the product variant in the above manner
i want it to be sth like..
https://www.amazon.com/levaca-Womens-Sleeve-Button-Pockets/dp/B01N7LMPOU/ref=zg_bs_fashion_8?_encoding=UTF8&refRID=68V7ABASRBSYJ6V5P0CN&th=1&psc=1
https://www.flipkart.com/billion-perfectfit-solid-men-round-neck-grey-white-t-shirt/p/itmewv9tyzcm6atu?pid=TSHEVPYJZCWXHVZY&sattr=color&st=color
on above product
there are two attributes..
1) size
2) Color..
lets say i have more than multiple attributes..
1) how shall i handle this situation? (database schema)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment