Index: src/system/classes/checkout/CheckoutControl.inc.php IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- src/system/classes/checkout/CheckoutControl.inc.php (date 1431685954000) +++ src/system/classes/checkout/CheckoutControl.inc.php (revision ) @@ -121,13 +121,15 @@ foreach($gm_attributes as $t_options_id => $t_options_values_id) { - $gm_attribute_stock = xtc_db_query("SELECT products_attributes_id - FROM products_attributes + $gm_attribute_stock = xtc_db_query("SELECT a.products_attributes_id + FROM products_attributes a + LEFT JOIN products_attributes_download AS d ON (a.products_attributes_id = d.products_attributes_id) WHERE - products_id = '" . (int)$gm_attribute_array[0] . "' AND - options_id = '" . (int)$t_options_id . "' AND - options_values_id = '" . (int)$t_options_values_id . "' AND - (attributes_stock - " . (double)$_SESSION['cart']->contents[$products[$i]['id']]['qty'] . ") < 0"); + a.products_id = '" . (int)$gm_attribute_array[0] . "' AND + a.options_id = '" . (int)$t_options_id . "' AND + a.options_values_id = '" . (int)$t_options_values_id . "' AND + (a.attributes_stock - " . (double)$_SESSION['cart']->contents[$products[$i]['id']]['qty'] . ") < 0 AND + d.products_attributes_id IS NULL"); if(xtc_db_num_rows($gm_attribute_stock) == 1) { $any_out_of_stock = true;