Index: includes/functions_product.php =================================================================== --- includes/functions_product.php (revision 750) +++ includes/functions_product.php (working copy) @@ -47,6 +47,9 @@ continue; } + // set options + $OPTIONS = ''; + // prefix $valuepfx = "p$product[productid]"; @@ -61,28 +64,31 @@ $OPTIONS .= construct_option($version['version'], "{$valuepfx}c0v$version[versionid]", $select, 0, $prefix); } } + else + { + $OPTIONS = ''; + } - // add it as an optgroup - $HTML .= construct_optgroup($product['title'], 0, $OPTIONS, $prefix); - $OPTIONS = ''; - // components (can't be a nested - it's not valid) if (is_array($components["$product[productid]"])) { foreach ($components["$product[productid]"] AS $component) { + // set options2 + $OPTIONS2 = ''; + // prefix - $valuepfx .= "c$component[productid]"; + $valuepfx = "p$product[productid]c$component[productid]"; // construct global options - $OPTIONS .= construct_pcv_select_global_version($component['componentmother'], $component['productid'], $versions, 1, $prefix, $select); + $OPTIONS2 .= construct_pcv_select_global_version($component['componentmother'], $component['productid'], $versions, 1, $prefix, $select); // product versions if (is_array($versions["$component[componentmother]"])) { foreach ($versions["$component[componentmother]"] AS $version) { - $OPTIONS .= construct_option($version['version'], "{$valuepfx}v$version[versionid]", $select, 1, $prefix); + $OPTIONS2 .= construct_option($version['version'], "{$valuepfx}v$version[versionid]", $select, 1, $prefix); } } @@ -91,15 +97,17 @@ { foreach ($versions["$component[productid]"] AS $version) { - $OPTIONS .= construct_option($version['version'], "{$valuepfx}v$version[versionid]", $select, 1, $prefix); + $OPTIONS2 .= construct_option($version['version'], "{$valuepfx}v$version[versionid]", $select, 1, $prefix); } } // add optgroup - $HTML .= construct_optgroup($component['title'], 1, $OPTIONS, $prefix); - $OPTIONS = ''; + $OPTIONS .= construct_optgroup($component['title'], 1, $OPTIONS2, $prefix); } } + + // add it as an optgroup + $HTML .= construct_optgroup($product['title'], 0, $OPTIONS, $prefix); } return $HTML;