I have a webpage using two drop down menus to select the inside color and the outside color of my product. link to site Click Here When the inside color is chosen the correct image is displayed but when I choose from the outside color drop down the other image disappears and the new selection is displayed. I need both of them to be displayed at the same time can someone help me change this contribution to suit my needs? I believe it is because the drop downs are all named the same. How can I change the php to use the proper names of the drop down menus?
This draws the drop down menus (html_output.php)and names them all 'zoek' right?
function tep_draw_pull_attribute_down_menu($name, $values, $default = '', $parameters = '', $required = false) {
global $HTTP_GET_VARS, $HTTP_POST_VARS;
$field = '<select name="' . tep_output_string($name) . '"';
if (tep_not_null($parameters)) $field .= ' ' . $parameters;
$field .= '>';
if (empty($default) && ( (isset($HTTP_GET_VARS[$name]) && is_string($HTTP_GET_VARS[$name])) || (isset($HTTP_POST_VARS[$name]) && is_string($HTTP_POST_VARS[$name])) ) ) {
if (isset($HTTP_GET_VARS[$name]) && is_string($HTTP_GET_VARS[$name])) {
$default = stripslashes($HTTP_GET_VARS[$name]);
} elseif (isset($HTTP_POST_VARS[$name]) && is_string($HTTP_POST_VARS[$name])) {
$default = stripslashes($HTTP_POST_VARS[$name]);
}
}
for ($i=0, $n=sizeof($values); $i<$n; $i++) {
$field .= '<option value="' . tep_output_string($values[$i]['id']) . '"';
if ($default == $values[$i]['id']) {
$field .= ' SELECTED';
}
$field .= ' name="zoek">' . tep_output_string($values[$i]['text'], array('"' => '"', '\'' => ''', '<' => '<', '>' => '>')) . '</option>';
}
$field .= '</select>';
if ($required == true) $field .= TEXT_FIELD_REQUIRED;
return $field;
and this is what's used (ajaximage.php) to answer the request:
$id = $_GET['zoek'];
$options_query = tep_db_query("select pov.products_options_values_id, pov.products_options_values_thumbnail from " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov where pov.products_options_values_id = '" .$id . "'");
$options = tep_db_fetch_array($options_query);
if($options['products_options_values_thumbnail'] != '' && OPTIONS_IMAGES_CLICK_ENLARGE == 'true')
{
echo "<a href='" . tep_href_link(FILENAME_OPTIONS_IMAGES_POPUP, "oID=" . $id) ."' target='blank'><img src=./images/options/".$options['products_options_values_thumbnail']." height=".OPTIONS_IMAGES_HEIGHT." width=".OPTIONS_IMAGES_WIDTH."></a>";
}
if($options['products_options_values_thumbnail'] == '' && OPTIONS_IMAGES_CLICK_ENLARGE == 'true')
{
echo TEXT_IMAGE_NOT_FOUND;
}
if($options['products_options_values_thumbnail'] != '' && OPTIONS_IMAGES_CLICK_ENLARGE == 'false')
{
echo "<img src=./images/options/".$options['products_options_values_thumbnail']." height=".OPTIONS_IMAGES_HEIGHT." width=".OPTIONS_IMAGES_WIDTH.">";
and this is the javascript that handles it all right?
<script language="javascript">
function createRequestObject() {
var req;
if(window.XMLHttpRequest){
req = new XMLHttpRequest();
} else if(window.ActiveXObject) {
req = new ActiveXObject("Microsoft.XMLHTTP");
} else {
req = NULL;
alert('Probleem met het aanmaken van hetXMLHttpRequest object');
}
return req;
}
var http = createRequestObject();
function sendRequestSearch(iets) {
http.open('get', 'ajaximage.php?zoek='+iets);
http.onreadystatechange = handleResponseSearch;
http.send(null);
}
function handleResponseSearch() {
if(http.readyState == 4 && http.status == 200){
if(http.responseText) {
document.getElementById("zoek_resultaten").innerHTML = http.responseText;
} else {
document.getElementById("zoek_resultaten").innerHTML = " ";
}
} else {
document.getElementById("zoek_resultaten").innerHTML = " ";
}
}
</script>
I could really use some help here as I know just enough to say I don't know enough.