Subversion-Projekte lars-tiefland.content-management

Revision

Blame | Letzte Änderung | Log anzeigen | RSS feed

<?
        require_once "../Online-Shop/connect2.php";
        
        function getOptions($itemId)
        {
                $buffer=array();
                $query="
                        SELECT
                                Features.ID as featureID,
                                Features.Name as featureName,
                                Feature_options.Value as optionName,
                                Feature_options.ID as optionValue
                        FROM
                                Feature_options,
                                Feature_to_Ware,
                                Features
                        WHERE
                                Feature_options.Feature = Features.ID
                        AND
                                Feature_to_Ware.Feature = Features.ID
                        AND
                                1 << Feature_options.bit & Feature_to_Ware.Feature_options > 0
                        AND
                                Feature_to_Ware.Ware = $itemId
                        AND
                                Features.Language = 'DE'
                        AND
                                Features.Sonderoption = 0
                        AND
                                Features.Einzeloption = 0
                        ";
                $result = mysql_query ($query) or die (mysql_errno().": ".mysql_error()."<hr>".$query);
                while($zeile=mysql_fetch_assoc($result))
                {
                        if (!$buffer[$zeile[featureID]])
                        {
                                $buffer[$zeile[featureID]] = array
                                (
                                        "featureID"             =>      $zeile[featureID],
                                        "featureName"   =>      $zeile[featureName],
                                        "options"               =>      array()
                                );
                        }
                        $buffer
                        [$zeile[featureID]]
                        [options]
                        [$zeile[optionValue]]
                        =
                        array
                        (
                                "optionValue"   =>      $zeile[optionValue],
                                "optionName"    =>      $zeile[optionName]
                        );
                }
                return $buffer;
        }

?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Unbenanntes Dokument</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<script language=javascript>
        window.resizeTo(500, 500);
        window.menubar.visible = false;
        window.locationbar.visible = false;
</script>
<body>
<?
// Wenn das Formular aktiviert wurde, Änderungen in der Session speichern
if(isset($_POST['submit_options'])) {
        // Für jedes Element des Formulars, bis auf "submit_options", den Wert in die Session packen
        foreach($_POST as $key => $value) {
                if($key != 'submit_options') {
                        $_SESSION['best_manu.php']['warenkorb'][$_GET['ID']]['options'][$key]['gewaehlt'] = $value;
                }
        }
}


// Ausgabe
echo '<b>' . $_SESSION['best_manu.php']['warenkorb'][$_GET['ID']]['kurzbezeichnung'] . '</b><br><br>';
echo 'Optionen:<br><br>';
echo '<form method="post" action="' . $PHP_SELF . '?ID=' . $_GET['ID'] . '" name="form_options"><table>';

$options = $_SESSION['best_manu.php']['warenkorb'][$_GET['ID']]['options'];
foreach($options as $key => $value) {
        // für jede option des artikels
        echo '<tr><td>' . $key . '</td><td>' . $value['featureName'] . '</td><td>';
        echo '<select name="' . $key . '">';
        foreach($options[$key]['options'] as $key2 => $value2) {
                // für jeden wert der option
                echo '<option value="' . $value2['optionValue'] . '"';
                if($_SESSION['best_manu.php']['warenkorb'][$_GET['ID']]['options'][$key]['gewaehlt'] == $value2['optionValue']) {
                        echo ' selected ';
                }
                echo '>' . $value2['optionName'] . '</option>';
        }
        echo '</select>';
        echo '</td></tr>';
}

echo '</table>';
echo '<br><input type="submit" name="submit_options" value="Änderung übernehmen" /></form>';
?>

<?
if(isset($_POST['submit_options'])) {
        echo '<font color="blue">Änderungen übernommen</font>';
}

?>

<br><br><div align="right"><a href="javascript:window.close()">Fenster schließen</div>

</body>
</html>