Subversion-Projekte lars-tiefland.shop_ns

Revision

Revision 7 | Zur aktuellen Revision | Details | 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
            }
67
            $this->instantConfirm = "/index.php?basket=true&item=$this->id&menge=1";
68
        }
69
 
70
        public static function Liste( $father )
71
        {
72
            $items = array();
73
            $sql = "SELECT
74
                    id
75
                FROM
76
                    artikel
77
                WHERE
78
                    father = $father
79
                AND
80
                    status = 0
81
                AND
82
                    language='" . $GLOBALS["INI"]["language"] . "'
83
            ";
84
            $res = $GLOBALS["db"]->query( $sql );
85
            while ( $row = $res->fetchRow() )
86
            {
87
                $items[] = new artikel( $row["id"] );
88
            }
89
            return $items;
90
        }
91
 
92
    }
93
?>