mercredi 3 avril 2019

How to get detail of product variant with ajax when change dropdown value of product

I create shop project with laravel and I have product and product_variants tables...Now in product single page I have select box that is product variants

For ex: shirt1 have two color (two variant) and different price each color ....I load this two color in dropdown select with their id's

For ex:

main product url:

example.com/product/spray-color

green color of product:

example.com/product/spray-color?detail=113

that 113 is id of product_variant in table


product_variant structure
id  -  product_id  -  variant_value  -  variant_type  - price

and one example:

id  -  product_id  -  variant_value  -  variant_type  - price
112        1               green           color         200
113        1               red             color         300


Question

How can I use ajax (pjax) to change the product price (in show page) when user click on one color without page refresh?and push state detail in url



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire