Subversion-Projekte lars-tiefland.shop_ns

Revision

Revision 2 | Revision 8 | Zur aktuellen Revision | Details | Vergleich mit vorheriger | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
2 lars 1
<?php
2
    /**
3
     * @package shop
4
     * @author Lars Tiefland <ltiefland@gmail.com>
5
     * @copyright 2012
6
     * @version $Id$
7
     */
8
 
9
    /**
10
     * @package shop
11
     * @author Lars Tiefland <ltiefland@gmail.com>
12
     * @copyright 2012
13
     * @version $Id$
14
     */
15
 
16
    namespace Weban;
17
    require_once "classes/preise.class.php";
18
    class artikel
19
    {
20
        public $id;
21
        public $name;
22
        public $beschreibung;
23
        public $link;
24
        public $hersteller;
25
        public $bilder;
26
        public $kennung;
27
        public $ean;
28
        public function __construct( $id )
29
        {
30
            $sql = "SELECT
31
                    id,
32
                    kurzbezeichnung AS name,
33
                    beschreibung,
34
                    father,
35
                    hersteller,
36
                    kennung,
37
                    ean
38
                FROM
39
                    artikel
40
                WHERE
41
                    id = $id
42
                AND
43
                    language='" . $GLOBALS["INI"]["language"] . "'
44
            ";
45
            $res = $GLOBALS["db"]->query( $sql );
46
            $row = $res->fetchRow();
47
            $this->id = $row["id"];
48
            $this->name = $row["name"];
49
            $this->beschreibung = $row["beschreibung"];
50
            $this->father = $row["father"];
51
            $this->kennung = $row["kennung"];
52
            $this->ean = $row["ean"];
53
            $this->link = "/index.php?item=" . $this->id;
54
            $fd = new directory( $this->father );
55
            $this->artikelstamm = $fd->artikelstamm;
56
            $this->hersteller = new hersteller( $row["hersteller"] );
57
            $this->bilder = artikel_bild::Liste( $this->id );
58
            $staffeln = preise::Liste( $this->id );
59
            foreach ( $staffeln as $p_index => $staffel )
60
            {
61
                $preis = $staffel["preis"][0];
62
                unset( $staffel["preis"][0] );
63
                unset( $staffel["menge"][0] );
64
                $this->preis[$p_index]["preis"] = $preis;
65
                $this->preis[$p_index]["staffel"] = $staffel;
66
            }
7 lars 67
            if ( count( $this->bilder ) > 1 )
68
            {
69
                $thumbs = "";
70
                foreach ( $this->bilder as $bild )
71
                {
72
                    if ( $bild["typ"] == "Bild" )
73
                    {
74
                        $thumbs .= "
75
                            <li>
76
                                <a href=\"javascript:void(0);\" rel=\"{gallery: gal1, smallimage: /images/Bild_" .
77
                            $bild["bild_index"] . "/kl/" . $bild["url"] .
78
                            ", largeimage: /images/Bild_" . $bild["bild_index"] .
79
                            "/" . $bild["url"] . "}\">
80
                                <img src=\"/images/Bild_" . $bild["bild_index"] .
81
                            "/mini/" . $bild["url"] . "\" />
82
                                </a>
83
                            </li>
84
                        ";
85
                    }
86
                }
87
                $this->thumbs = $thumbs;
88
            }
2 lars 89
            $this->instantConfirm = "/index.php?basket=true&item=$this->id&menge=1";
90
        }
91
 
92
        public static function Liste( $father )
93
        {
94
            $items = array();
95
            $sql = "SELECT
96
                    id
97
                FROM
98
                    artikel
99
                WHERE
100
                    father = $father
101
                AND
102
                    status = 0
103
                AND
104
                    language='" . $GLOBALS["INI"]["language"] . "'
105
            ";
106
            $res = $GLOBALS["db"]->query( $sql );
107
            while ( $row = $res->fetchRow() )
108
            {
109
                $items[] = new artikel( $row["id"] );
110
            }
111
            return $items;
112
        }
113
 
114
    }
115
?>