cancel
Showing results for 
Search instead for 
Did you mean: 

Adding configurable products to cart

Adding configurable products to cart

Hi ,

I am building a configurable matrix layout where user can add multiple products at a time. The problem is how can i get the child products with the inputs provided by user. Here is the array of output i am getting.

Array ( [product] => 65 [child_price] => Array ( [93-51,179-170] => 10 [93-51,179-171] => 10 [93-4,179-168] => 10 [93-4,179-170] => [93-4,179-171] => [93-52,179-168] => [93-52,179-170] => [93-52,179-171] => ) [child] => Array ( [93-51,179-170] => 2 [93-51,179-171] => 2 [93-4,179-168] => 2 [93-4,179-170] => [93-4,179-171] => [93-52,179-168] => [93-52,179-170] => [93-52,179-171] => ) [custom_option] => gdfgdfgfdgfgffgfgfgfdgdfgdfgfdgfdgdfgfdg= [parent_id] => 65 

here [93-51,179-170] => 10 means , user selected red color of L size for quantity 10. Now how can i split find the child product from this data?

2 REPLIES 2

Re: Adding configurable products to cart

m

Re: Adding configurable products to cart

Hello @dineshprim

Let me explain shared output:

93 = attribute_id of color 
51 = option_id of any specific color,
179 = attribute_id of size
170 = option_id of any specific size


Just simplify child price array and run for loop to split values accordingly.

Manish Mittal
https://www.manishmittal.com/