sorry for may english ;)
I created mysql structure based on sahalMoidu's from first answer here. What i would like to do is create in product page select boxes which will send values via ajax change(). Values will change SKU and price.
My question is - How select(grab) PRODUCT_VARIANTS_ID if i will send via ajax set of values and product_id? Of course if there is a variant containing all values
MySQL structure is like in http://sqlfiddle.com/#!2/37268/2/0 On this result there is no need to grab value names etc so mysql result can by like shown below
what i have at the moment is sorted variants in array
SELECT * FROM shop_product_Variants pv LEFT JOIN shop_product_details pd ON pd.product_Variants_id = pv.product_Variants_id WHERE pv.product_id = 3
while($data = dbarray($result)) {
$attr[$data['product_Variants_id']][] = $data['value_id'];
}
print($attr);
the outpout is
Array (
[3] => Array ( [0] => 1 [1] => 5 [2] => 6 )
[4] => Array ( [0] => 1 [1] => 5 [2] => 8 )
)
This shows two variants with values for this product_id - how to store in variable a product_Variant_id (srray_key) whose values (for example [1,5,8] or other sent via ajax) are in one of those arrays? if there is no variant with all values - print '0".
Any help/suggestions? Maby other array structure containing also variant_id or othermysql result?