| 1 |
lars |
1 |
<?
|
|
|
2 |
require_once "../Online-Shop/connect2.php";
|
|
|
3 |
|
|
|
4 |
function getOptions($itemId)
|
|
|
5 |
{
|
|
|
6 |
$buffer=array();
|
|
|
7 |
$query="
|
|
|
8 |
SELECT
|
|
|
9 |
Features.ID as featureID,
|
|
|
10 |
Features.Name as featureName,
|
|
|
11 |
Feature_options.Value as optionName,
|
|
|
12 |
Feature_options.ID as optionValue
|
|
|
13 |
FROM
|
|
|
14 |
Feature_options,
|
|
|
15 |
Feature_to_Ware,
|
|
|
16 |
Features
|
|
|
17 |
WHERE
|
|
|
18 |
Feature_options.Feature = Features.ID
|
|
|
19 |
AND
|
|
|
20 |
Feature_to_Ware.Feature = Features.ID
|
|
|
21 |
AND
|
|
|
22 |
1 << Feature_options.bit & Feature_to_Ware.Feature_options > 0
|
|
|
23 |
AND
|
|
|
24 |
Feature_to_Ware.Ware = $itemId
|
|
|
25 |
AND
|
|
|
26 |
Features.Language = 'DE'
|
|
|
27 |
AND
|
|
|
28 |
Features.Sonderoption = 0
|
|
|
29 |
AND
|
|
|
30 |
Features.Einzeloption = 0
|
|
|
31 |
";
|
|
|
32 |
$result = mysql_query ($query) or die (mysql_errno().": ".mysql_error()."<hr>".$query);
|
|
|
33 |
while($zeile=mysql_fetch_assoc($result))
|
|
|
34 |
{
|
|
|
35 |
if (!$buffer[$zeile[featureID]])
|
|
|
36 |
{
|
|
|
37 |
$buffer[$zeile[featureID]] = array
|
|
|
38 |
(
|
|
|
39 |
"featureID" => $zeile[featureID],
|
|
|
40 |
"featureName" => $zeile[featureName],
|
|
|
41 |
"options" => array()
|
|
|
42 |
);
|
|
|
43 |
}
|
|
|
44 |
$buffer
|
|
|
45 |
[$zeile[featureID]]
|
|
|
46 |
[options]
|
|
|
47 |
[$zeile[optionValue]]
|
|
|
48 |
=
|
|
|
49 |
array
|
|
|
50 |
(
|
|
|
51 |
"optionValue" => $zeile[optionValue],
|
|
|
52 |
"optionName" => $zeile[optionName]
|
|
|
53 |
);
|
|
|
54 |
}
|
|
|
55 |
return $buffer;
|
|
|
56 |
}
|
|
|
57 |
|
|
|
58 |
?>
|
|
|
59 |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
|
|
60 |
<html>
|
|
|
61 |
<head>
|
|
|
62 |
<title>Unbenanntes Dokument</title>
|
|
|
63 |
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
|
|
64 |
</head>
|
|
|
65 |
<script language=javascript>
|
|
|
66 |
window.resizeTo(500, 500);
|
|
|
67 |
window.menubar.visible = false;
|
|
|
68 |
window.locationbar.visible = false;
|
|
|
69 |
</script>
|
|
|
70 |
<body>
|
|
|
71 |
<?
|
|
|
72 |
// Wenn das Formular aktiviert wurde, Änderungen in der Session speichern
|
|
|
73 |
if(isset($_POST['submit_options'])) {
|
|
|
74 |
// Für jedes Element des Formulars, bis auf "submit_options", den Wert in die Session packen
|
|
|
75 |
foreach($_POST as $key => $value) {
|
|
|
76 |
if($key != 'submit_options') {
|
|
|
77 |
$_SESSION['best_manu.php']['warenkorb'][$_GET['ID']]['options'][$key]['gewaehlt'] = $value;
|
|
|
78 |
}
|
|
|
79 |
}
|
|
|
80 |
}
|
|
|
81 |
|
|
|
82 |
|
|
|
83 |
// Ausgabe
|
|
|
84 |
echo '<b>' . $_SESSION['best_manu.php']['warenkorb'][$_GET['ID']]['kurzbezeichnung'] . '</b><br><br>';
|
|
|
85 |
echo 'Optionen:<br><br>';
|
|
|
86 |
echo '<form method="post" action="' . $PHP_SELF . '?ID=' . $_GET['ID'] . '" name="form_options"><table>';
|
|
|
87 |
|
|
|
88 |
$options = $_SESSION['best_manu.php']['warenkorb'][$_GET['ID']]['options'];
|
|
|
89 |
foreach($options as $key => $value) {
|
|
|
90 |
// für jede option des artikels
|
|
|
91 |
echo '<tr><td>' . $key . '</td><td>' . $value['featureName'] . '</td><td>';
|
|
|
92 |
echo '<select name="' . $key . '">';
|
|
|
93 |
foreach($options[$key]['options'] as $key2 => $value2) {
|
|
|
94 |
// für jeden wert der option
|
|
|
95 |
echo '<option value="' . $value2['optionValue'] . '"';
|
|
|
96 |
if($_SESSION['best_manu.php']['warenkorb'][$_GET['ID']]['options'][$key]['gewaehlt'] == $value2['optionValue']) {
|
|
|
97 |
echo ' selected ';
|
|
|
98 |
}
|
|
|
99 |
echo '>' . $value2['optionName'] . '</option>';
|
|
|
100 |
}
|
|
|
101 |
echo '</select>';
|
|
|
102 |
echo '</td></tr>';
|
|
|
103 |
}
|
|
|
104 |
|
|
|
105 |
echo '</table>';
|
|
|
106 |
echo '<br><input type="submit" name="submit_options" value="Änderung übernehmen" /></form>';
|
|
|
107 |
?>
|
|
|
108 |
|
|
|
109 |
<?
|
|
|
110 |
if(isset($_POST['submit_options'])) {
|
|
|
111 |
echo '<font color="blue">Änderungen übernommen</font>';
|
|
|
112 |
}
|
|
|
113 |
|
|
|
114 |
?>
|
|
|
115 |
|
|
|
116 |
<br><br><div align="right"><a href="javascript:window.close()">Fenster schließen</div>
|
|
|
117 |
|
|
|
118 |
</body>
|
|
|
119 |
</html>
|