Subversion-Projekte lars-tiefland.content-management

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
1 lars 1
<?
2
	require_once "connect2.php";
3
	//mysql_query("use pluemacher_de");
4
 
5
	session_start();
6
	if (!$_SESSION[Language]) {$_SESSION[Language] = "DE";}
7
 
8
	if ($action)
9
	{
10
		switch($action)
11
		{
12
			case "delete": // Löschen einer Kombination
13
					$query="DELETE FROM Versandart_to_Bezahlweise.* WHERE Versandart=$Versandart AND Bezahlweise=$Bezahlweise and Language='".$_SESSION[Language]."'";
14
					mysql_query($query) or die(mysql_error()."<hr>$query<hr>");
15
				break;
16
 
17
			case "SYNC": // Synchronisierung der Kombinationen mit der Artikeltabelle
18
					$query="
19
						SELECT
20
							Versandart_to_Bezahlweise.artikel as ID,
21
							Versandart_to_Bezahlweise.Language,
22
							-3 as Father,
23
							concat(Versandart.Name,' ',Bezahlweise.Name) as kurzbezeichnung,
24
							Versandart_to_Bezahlweise.Preis as preis1,
25
							Versandart_to_Bezahlweise.Preis as preis2,
26
							Versandart_to_Bezahlweise.Preis as preis3,
27
							Versandart_to_Bezahlweise.Preis as preis4,
28
							Versandart_to_Bezahlweise.Preis as preis5,
29
							Versandart_to_Bezahlweise.Preis as preis6,
30
							Versandart_to_Bezahlweise.Lieferstatus,
31
 
32
							Versandart_to_Bezahlweise.Eigenschaft_1,
33
							Versandart_to_Bezahlweise.Eigenschaft_2,
34
							Versandart_to_Bezahlweise.Eigenschaft_3,
35
							Versandart_to_Bezahlweise.Eigenschaft_4,
36
							Versandart_to_Bezahlweise.Eigenschaft_5,
37
							Versandart_to_Bezahlweise.Versandart,
38
							Versandart_to_Bezahlweise.Bezahlweise
39
						FROM
40
							Versandart,
41
							Bezahlweise,
42
							Versandart_to_Bezahlweise
43
						WHERE
44
							Versandart_to_Bezahlweise.Versandart=Versandart.ID
45
						AND
46
							Versandart_to_Bezahlweise.Bezahlweise=Bezahlweise.ID
47
						AND
48
							Versandart.Language=Versandart_to_Bezahlweise.Language
49
					";
50
					$result=mysql_query($query) or die(mysql_error()."<hr>$query<hr>");
51
					while($syncData=mysql_fetch_assoc($result))
52
					{
53
						$Bezahlweise=array_pop($syncData);
54
						$Versandart=array_pop($syncData);
55
 
56
						$syncCallQuery="
57
							REPLACE INTO
58
								artikel
59
								(".implode(", ",array_keys($syncData)).")
60
							VALUES
61
								('".implode("', '",$syncData)."')
62
						";
63
						$resultSyncCall=mysql_query($syncCallQuery) or die(mysql_error()."<hr>$syncCallQuery<hr>");
64
						$syncCallQuery2="
65
							UPDATE
66
								Versandart_to_Bezahlweise
67
							SET
68
								artikel = ".mysql_insert_id()."
69
							WHERE
70
								Versandart_to_Bezahlweise.Versandart=$Versandart
71
							AND
72
								Versandart_to_Bezahlweise.Bezahlweise=$Bezahlweise
73
						";
74
						mysql_query($syncCallQuery2) or die(mysql_error()."<hr>$syncCallQuery2<hr>");
75
					}
76
				break;
77
 
78
			default: // Änderungen durchführen
79
					unset($_POST[action]);
80
					if ($_POST[Lieferstatus])
81
					{
82
						$_POST[Lieferstatus]=array_sum($_POST[Lieferstatus]);
83
					}
84
 
85
					$names="".implode(",",array_keys($_POST))."";
86
					$values="'".implode("','",$_POST)."'";
87
 
88
					$query="replace into Versandart_to_Bezahlweise ($names) values ($values)";
89
					mysql_query($query) or die(mysql_error()."<hr>$query<hr>");
90
				break;
91
		}
92
	}
93
?>
94
<html>
95
<head>
96
<title>Versandart und Bestellweise einrichten</title>
97
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
98
<style type="text/css">
99
<!--
100
.td {  font-family: Arial, Helvetica, sans-serif; font-size: 14px; background-color: #DDDDDD;}
101
.small { font-family: Arial, Helvetica, sans-serif; font-size: 10px; background-color: #DDDDDD; }
102
-->
103
</style>
104
 
105
<script language="Javascript">
106
function killkomma(w)
107
{
108
 return w.replace(/,/,'.');
109
}
110
</script>
111
 
112
</head>
113
<body bgcolor="#FFFFFF" text="#000000" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
114
<form action="<? echo $self ?>" method="post">
115
  <table width="100%" border="0" cellspacing="5" cellpadding="0">
116
    <tr>
117
      <td valign="top">
118
        <table border="0" width="100%" cellspacing="3" cellpadding="2">
119
          <tr align="center">
120
            <td nowrap class="td" colspan="3">Eingetragene Kombinationen:</td>
121
          </tr>
122
          <?
123
	$result=mysql_query(
124
	"
125
		SELECT
126
			Versandart.Name as VersandartName,
127
			Bezahlweise.Name as BezahlweiseName,
128
			Versandart_to_Bezahlweise.Versandart as VersandartID,
129
			Versandart_to_Bezahlweise.Bezahlweise as BezahlweiseID,
130
			Versandart_to_Bezahlweise.Preis
131
		FROM
132
			Versandart,
133
			Bezahlweise,
134
			Versandart_to_Bezahlweise
135
		WHERE
136
			Versandart.Language='DE'
137
		AND
138
			Versandart_to_Bezahlweise.Versandart = Versandart.ID
139
		AND
140
			Versandart_to_Bezahlweise.Bezahlweise = Bezahlweise.ID
141
		ORDER BY 1
142
	"
143
	) or die(mysql_error());
144
	while($zeile=mysql_fetch_assoc($result))
145
	{
146
?>
147
          <tr>
148
            <td nowrap class="small" width="100%"><a href="<? echo $self ?>?Versandart=<? echo $zeile[VersandartID]; ?>&Bezahlweise=<? echo $zeile[BezahlweiseID]; ?>">
149
              <? echo $zeile[VersandartName]; ?>
150
              <? echo $zeile[BezahlweiseName]; ?>
151
              </a></td>
152
            <td nowrap class="small" align="right">
153
              <? echo $zeile[Preis]; ?>
154
            </td>
155
            <td nowrap class="small" width="12"><a href="<? echo $self ?>?Versandart=<? echo $zeile[VersandartID]; ?>&Bezahlweise=<? echo $zeile[BezahlweiseID]; ?>&action=delete" onClick="return confirm('Kombination\n&quot;<? echo $zeile[VersandartName]; ?> <? echo $zeile[BezahlweiseName]; ?>&quot;\nwirklich löschen');"><img src="../images/Icons/delete.gif" width="12" height="12" border="0" alt="Kombination &quot;<? echo $zeile[VersandartName]; ?> <? echo $zeile[BezahlweiseName]; ?>&quot; löschen"></a></td>
156
          </tr>
157
          <?
158
	}
159
?>
160
        </table>
161
            </td>
162
      <td class="td"><table border="0" width="100%" cellspacing="0" cellpadding="0">
163
  <tr>
164
    <td>&nbsp;</td>
165
  </tr>
166
</table>
167
</td>
168
      <td width="75%" align="center" valign="top">
169
        <table border="0" width="100%" cellspacing="3" cellpadding="2">
170
          <tr align="center">
171
            <td class="td">Versandart </td>
172
            <td class="td">Bezahlweise </td>
173
            <td class="td">vorhanden</td>
174
            <td class="td">Artikel ID</td>
175
          </tr>
176
          <tr align="center">
177
            <td class="td">
178
              <select name="Versandart" onChange="document.location.href='<? echo $self ?>?Versandart='+this.form.Versandart.value+'&Bezahlweise='+this.form.Bezahlweise.value">
179
                <option></option>
180
                <?
181
	$result=mysql_query("select * from Versandart where Language='DE' order by Name") or die(mysql_error());
182
	while($zeile=mysql_fetch_array($result))
183
	{
184
?>
185
                <option value="<? echo $zeile[ID]; ?>"<? if ($Versandart == $zeile[ID]) { echo " selected"; } ?>>
186
                <? echo $zeile[Name]; ?>
187
                </option>
188
                <?
189
	}
190
?>
191
              </select>
192
            </td>
193
            <td class="td">
194
              <select name="Bezahlweise" onChange="document.location.href='<? echo $self ?>?Versandart='+this.form.Versandart.value+'&Bezahlweise='+this.form.Bezahlweise.value">
195
                <option></option>
196
                <?
197
	$result=mysql_query("select * from Bezahlweise where Language='DE' order by Name") or die(mysql_error());
198
	while($zeile=mysql_fetch_array($result))
199
	{
200
?>
201
                <option value="<? echo $zeile[ID]; ?>"<? if ($Bezahlweise == $zeile[ID]) { echo " selected"; } ?>>
202
                <? echo $zeile[Name]; ?>
203
                </option>
204
                <?
205
	}
206
?>
207
              </select>
208
            </td>
209
            <td class="td">
210
              <?
211
		$result=mysql_query("select * from Versandart_to_Bezahlweise where Versandart=$Versandart and Bezahlweise=$Bezahlweise and Language='DE'");
212
		if ($result)
213
		{
214
			if ($DATA=mysql_fetch_assoc($result))
215
			{
216
				echo "JA";
217
			}
218
			else
219
			{
220
				echo "NEIN";
221
			}
222
		}
223
	  ?>
224
            </td>
225
            <td class="td">
226
              <? if ($DATA[artikel]) { ?>
227
              <input type="text" name="artikel" size="3" value="<? echo $DATA[artikel] ?>">
228
              <? } else { ?>-<? } ?>
229
            </td>
230
          </tr>
231
          <tr align="center">
232
            <td colspan="4" class="td">Preis:
233
              <input type="text" name="Preis" value="<? echo $DATA[Preis] ?>" onChange="this.value=killkomma(this.value);">
234
            </td>
235
          </tr>
236
          <tr align="center">
237
            <td colspan="4" class="small">Diese Kombination als Option anzeigen,
238
              wenn alle Artikel im Warenkorb zusammengenommen die folgenden Bedingungen
239
              erf&uuml;llen:</td>
240
          </tr>
241
        </table>
242
        <br>
243
        <table border="0" cellspacing="3" cellpadding="2"  width="70%">
244
          <tr>
245
            <td width="50%" class="td" align="center">Sprache des Shops:</td>
246
            <td colspan="2" class="td" align="center">
247
              <? echo $_SESSION[Language]; ?>
248
              <input type="hidden" name="Language" value="<? echo $_SESSION[Language]; ?>">
249
            </td>
250
          </tr>
251
        </table>
252
        <br>
253
        <table border="0" cellspacing="3" cellpadding="2"  width="70%">
254
          <tr>
255
            <td width="50%" class="td">&nbsp;</td>
256
            <td class="small" width="25%" align="center">JA</td>
257
            <td class="small" align="center">Nein/Egal</td>
258
          </tr>
259
          <?
260
	for ($Eigenschaft_nr=1; $Eigenschaft_nr<=5; $Eigenschaft_nr++)
261
	{
262
?>
263
          <tr>
264
            <td width="50%" class="td">
265
              <?
266
		$Feld="Eigenschaft_".$Eigenschaft_nr;
267
		if (isset($user_rechte[online_shop][artikel][$Feld]))
268
		{
269
			if ($web_rechte[online_shop][artikel][$Feld])
270
			{
271
				echo $web_rechte[online_shop][artikel][$Feld];
272
			}
273
			else
274
			{
275
				echo "Eigenschaft ".$Eigenschaft_nr;
276
			}
277
		}
278
?>
279
            </td>
280
            <td class="td" align="center">
281
              <input type="radio" name="<? echo $Feld ?>" value="1" <? if ($DATA[$Feld] == 1) {echo " checked";} ?>>
282
            </td>
283
            <td class="td" align="center">
284
              <input type="radio" name="<? echo $Feld ?>" value="0" <? if ($DATA[$Feld] != 1) {echo " checked";} ?>>
285
            </td>
286
          </tr>
287
          <?
288
	}
289
?>
290
        </table>
291
        <br>
292
        <table border="0" cellspacing="3" cellpadding="2"  width="70%">
293
          <tr>
294
            <td class="small" align="center">L&auml;nder, f&uuml;r die diese Versand-
295
              Bezahlvariante gilt:</td>
296
          </tr>
297
          <tr>
298
            <td class="td">
299
              <table width="90%" border="0" cellspacing="0" cellpadding="0">
300
                <?
301
	$Laender=array('Deutschland','Niederlande','Österreich','Belgien','Luxemburg','Dänemark','Schweiz','Frankreich','Großbritannien','Italien','Spanien','Portugal','Schweden','Finnland','Norwegen');
302
	for ($bit=0; $bit<15; $bit++)
303
	{
304
?>
305
                <tr align="center">
306
                  <td width="75%" class="td">
307
                    <? echo $Laender[$bit] ?>
308
                  </td>
309
                  <td width="25%" class="td">
310
                    <input type="checkbox" name="Lieferstatus[]" value="<? echo 1 << $bit ?>"<? if ($DATA[Lieferstatus] & (1 << $bit)) {echo " checked";} ?>>
311
                  </td>
312
                </tr>
313
                <?
314
	}
315
?>
316
              </table>
317
            </td>
318
          </tr>
319
        </table>
320
        <br>
321
        <table width="100%" border="0" cellspacing="0" cellpadding="0">
322
          <tr>
323
            <td align="right" class="td">&nbsp;</td>
324
            <td align="center" class="td" width="50%" valign="middle">
325
              <input type="submit" name="action" value="Abschicken">
326
            </td>
327
          </tr>
328
        </table>
329
      </td>
330
    </tr>
331
  </table>
332
</form>
333
</body>
334
</html>