Hello i was developing ecommerce website using laravel as a backend and react on the frontend using inertia and i am having trouble with product attributes on create new product page .... what i wanted to build was a product variation system like wordpress or shopify.
I am getting the attributes on multiple select input and then i wanted to create a variation from the selected input .......like if the selected values are size and color i will get the values of those and create a variation combination like :-
Large/red , Large/blue with their own price and quantity
#creating product attribute variation combination in laravel and react js
1 messages · Page 1 of 1 (latest)
Hey, so first - thanks for creating a thread, allows us to keep all the discussion together
Not sure from you're question which bit you're having trouble with, is the the database structure, or something on the front-end?
Both how to set the database structure for combinations and on the frontend how to make a combination from a multi select input
So, for stuff specific to React you might not get much help here, this is a Laravel discord and our experience is limited.
in terms of the variations table, i think what you need is a "product_variations" table, then the ability to relate those different attributes to your variation somehow
So are the attributes in the DB, or just strings?
In the DB each attribute has values separated by comma
so that might be problematic, as there's no way to refer to a single value in that comma separated column
you might have to start by creating attributes tables that allow you to have one attribute value per row
so that it has an ID to refer to
Honestly? The best approach would be
Find an example e-commerce app that does what you want, you mentioned wordpress
download wordpress, install woocommerce, and set up a product with a variant
then look at how they're storing things in the database
right from attributes up to products and their variants
That might give you a better starting point
Thanks
have your react form pass a JSON payload containing the product variations, and parse them via Laravel into proper model relations etc.