. offer.name -> offer.subname, damit ich eindeutige Feldbezeichner
[infodrom.org/infocon.infodrom.org] / src / shop / show.wml
1 #include <infocon.style>
2 #include <shop.inc>
3
4 <page title="InfoCon - Online-Shop">
5
6 <h1 align=center>Online-Shop</h1>
7
8 &nbsp;<table width=100% border=0 cellpadding=0 cellspacing=0>
9
10 <?
11   # So werden 1 Pixel dicke Rahmen erzeugt
12   $la = "<tr><td width=\"2\" bgcolor=\"#000000\"></td><td bgcolor=\"#000000\"><table cellpadding=\"0\" cellspacing=\"1\" width=\"100%\" border=\"0\" summary=\"\"><tr><td bgcolor=\"#ffffff\">";
13   $le = "</td></tr></table></td></tr>";
14   $ch = "#abdcfc";
15   $cd = "#eff0f1";
16
17   $dbh = dbconnect();
18
19   # FIXME: kill ' from $article
20   $sth = dbquery ($dbh, "SELECT * FROM article WHERE article = '$article'");
21
22   if (pg_NumRows ($sth) == 0) {
23     echo ($la);
24     echo ("<table width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" summary=\"\">");
25     printf ("<tr><th align=\"left\" colspan=\"2\" bgcolor=\"%s\">"
26            ."<font face=\"Helvetica,Arial\">Kein Artikel gefunden.</font></th></tr>",
27            $ch);
28     echo ("</table>");
29     echo ($le);
30   } else {
31     $row = pg_fetch_array ($sth, 0);
32     echo ($la);
33   
34     echo ("<table width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" summary=\"\">");
35     printf ("<tr><th align=\"left\" colspan=\"2\" bgcolor=\"%s\">"
36            ."<font face=\"Helvetica,Arial\">%s</font></th></tr>",
37            $ch, $row['name']);
38   
39     if (strlen ($row['url_path']) > 0) {
40       $img = sprintf ("src=\"%s\" width=\"%d\" height=\"%d\" alt=\"[Artikel #%s]\"",
41                       $row['url_path'], $row['url_width'], $row['url_height'], $row['article']);
42     } else {
43       $img = "src=\"<root_prefix>Pics/nopix.png\" width=\"158\" height=\"183\" alt=\"[Kein Bild vorhanden]\"";
44     }
45
46     # Sub-Query
47     $sthi = dbquery ($dbh, sprintf ("SELECT subname,price,articleid FROM offer WHERE article = '%s'ORDER BY articleid",
48                                       $row['article']));
49     if (pg_NumRows ($sthi) > 0) {
50       <protect>
51       $table = "<table width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" bgcolor=\"$cd\">";
52       </protect>
53       for ($ii=0; $ii < pg_NumRows ($sthi); $ii++) {
54         $rowi = pg_fetch_array ($sthi, $ii);
55         $table .= sprintf ("<tr><td align=\"left\" width=\"70%%\"><font face=\"Helvetica,Arial\">&nbsp;%s</font></td>",
56                            $rowi['subname']);
57         $table .= sprintf ("<td align=\"right\" width=\"20%%\"><font face=\"Helvetica,Arial\">%6.2f DM&nbsp;</font></td></tr>",
58                            $rowi['price']);
59       }
60       $table .= "</table>";
61     } else {
62       $table = "";
63     }
64     # /Sub-Query
65
66     <protect>
67     printf ("<tr><td width=\60%%\" align=\"left\" valign=\"top\">"
68            ."<font face=\"Helvetica,Arial\"><p>%s</font></td>"
69            ."<td width=\40%%\" rowspan=\"2\" align=\"center\" valign=\"top\"><img %s>&nbsp;</td></tr>",
70            $row['description'], $img);
71     </protect>
72     printf ("<tr><td width=\60%%\" align=\"left\" valign=\"bottom\">%s</td></tr>", $table);
73   
74     echo ("</table>");
75     echo ($le);
76   }
77 ?>
78
79 </table>
80
81 <p>Preise freibleibend.  Alle Preise verstehen sich inklusive gesetzlich vorgeschriebener Mehrwertsteuer.
82
83 </page>
84 # Local variables:
85 # mode: indented-text
86 # mode: auto-fill
87 # mode-: iso-accents
88 # end: