Subversion-Projekte lars-tiefland.php_share

Revision

Blame | Letzte Änderung | Log anzeigen | RSS feed

<?
        include_once("/web/apache/mediaran.de/preisagent/transfer/connect.php"); 

/* RW 10.02.2004
select
        // alte Preisberechnung
        IF (preis5 < 0, round(abs(preis1*preis5 / 100),2),preis5) as preis,
        // neue Preisberechnung
        IF (preis5 < 0, ceiling(abs(preis1*preis5 / 10))/10,preis5) as preis2
from 
        artikel
where
        (artikel.preis5 < 0)
*/

/* RW 04.03.2004
        // alt:
where 
        ((artikel.preis5 > 0) or (artikel.preis5 < 0))
        // neu:
where 
        preis != 0
*/

        function load_artikel($root)
        {
                $buffer=array();
                $query = "
                select 
                        ID,
                        father as category,
                        kurzbezeichnung as bezeichnung,
                        langbezeichnung as kurzbezeichnung,
                        IF (bild_7_url ='', NULL, concat('/artikel/standard/',bild_7_url)) as bild,
                        beschreibung,
                        ID as artikelnr,
                        16 as mwst,
                        IF (preis5 < 0, ceiling(abs(preis1*preis5 / 10))/10,preis5) as preis,
                        '' as detailbeschreibung,
                        IF (bild_7_url ='', NULL, concat('/artikel/detail/',bild_7_url)) as detailbild,
                        'template_smalllist.template' as templatefile_smalllist,
                        'template_detail.template' as templatefile_detail,
                        0 as is_invisible,
                        concat('statictext: ', gewicht) as gewicht
                from
                        artikel
                where
                        (
                                (artikel.preis5 > 0) 
                                or
                                (
                                        (artikel.preis5 < 0) and (artikel.preis1 > 0)
                                )
                        )
                        and artikel.Father = $root
                        and artikel.Language = 'DE'
                        and artikel.Eigenschaft_4 = 0
                order by 
                        artikel.kurzbezeichnung
                ";
                $result = mysql_query ($query) or die (mysql_errno().": ".mysql_error()."<hr>".$query."<hr>");
                while($zeile=mysql_fetch_assoc($result))
                {
                        $buffer[]=$zeile;
                }
                return $buffer;
        }

        function load_dir($root)
        {
                $buffer=array();
                
                $query="select * from directory where Father = $root and language='DE' order by Kennung";
                $result = mysql_query ($query) or die (mysql_errno().": ".mysql_error()."<hr>".$query);
                while($zeile=mysql_fetch_assoc($result))
                {
                        $zeile["subdirs"]=load_dir($zeile[ID]);
                        $zeile["artikel"]=load_artikel($zeile[ID]);
                        $buffer[]=$zeile;
                }
                return $buffer;
        }
        
        function core_data($root = -1)
        {
                $buffer["subdirs"]=load_dir($root);
                $buffer["artikel"]=load_artikel($root);
                return $buffer;
        }
?>