"SID")); page_open(array("sess" => "SID")); include("std.inc"); include("dt.inc"); include("klm.inc"); include("html.inc"); include("vault.inc"); include("template.inc"); include("template_helper.inc"); // include("reporter.inc"); include("standard.inc"); include("iao-shop.inc"); $sess->register("reporters_url"); page_close(); /* Notwendigen Variablen initialisieren oder aus dem POST/GET-Request ziehen*/ $id=get_var('id', $_REQUEST,"int", 50,"",1); $lang=get_var('lang', $_REQUEST,"char", 2,"de",1); $sort=get_var('sort', $_REQUEST,"char", 10,"titel",1); $skip=get_var('skip', $_REQUEST,"int", 10,"0",1); $anzahl=get_var('anzahl', $_REQUEST,"int", 10,"0",1); $action=get_var('action', $_REQUEST,"char", 15,"",1); $suche1=get_var('suche1', $_REQUEST,"char", 255,"",1); $suche2=get_var('suche2', $_REQUEST,"char", 255,"",1); $suche_autor=get_var('suche_autor', $_REQUEST,"char", 255,"",1); $suche_jahr=get_var('suche_jahr', $_REQUEST,"char", 255,"",1); $suche_titel=get_var('suche_titel', $_REQUEST,"char", 255,"",1); $allowed_sort=array("titel","nachname1","jahr"); if(in_array($sort,$allowed_sort)){ $sql_sort=$sort; ${"sort_$sort"} = "selected"; } $dbc = new DB_BU; $dbu = new DB_BU; $main_subst["#noindex#"] = 1; $this_template_url=$sess->url(""); $SID = str_replace("?SID=","",$this_template_url); $main_subst["#SID#"] = $SID; $main_subst["#post_url#"] = $sess->url("blaettern.php"); /*---------- Template for Data ----------*/ $template = new t_file("template4.html"); $main_subst["#current4#"] = "id=current"; $main_subst["#current_1#"] = ""; $main_subst["#current_2#"] = ""; $main_subst["#current_3#"] = ""; $main_subst["#current_4#"] = "current1"; $main_subst["#bread#"] = "Warenkorb"; $main_subst["#vignette#"] = ""; //$main_subst["#this#"] = $_SERVER['HTTP_HOST'].$_SERVER[REQUEST_URI]; $stmts = explode("&",$_SERVER['QUERY_STRING']); $i = 0; foreach($stmts as $stmt) { $st = explode("=", $stmt); if ($st[0] != "SID") { $i++; if($i == 1) $params .= "?"; else $params .= "&"; $params .= $st[0]."=".$st[1]; } } $main_subst["#this#"] = $_SERVER['HTTP_HOST'].urlencode($_SERVER['PHP_SELF'].$params); //Neue Publikation hinzufügen oder vorhandene hochzählen if($action=="add" AND $id AND $anzahl){ $dbc->query("SELECT * FROM warenkorb WHERE sid='$SID' AND publikationid='$id'"); if($dbc->num_rows()){ $dbu->query("UPDATE warenkorb SET anzahl=anzahl+$anzahl WHERE sid='$SID' AND publikationid='$id'"); }else{ $dbu->query("INSERT INTO warenkorb (sid,publikationid,created,ip,anzahl) VALUES ('$SID','$id',now(),'".$_SERVER["REMOTE_ADDR"]."','$anzahl')"); } } //Publikation löschen if($action=="delete" AND $id){ $dbc->query("DELETE FROM warenkorb WHERE sid='$SID' AND publikationid='$id'"); } ////////////////////////////////////////////////////////////////////////////////////////////// //// Postencounter (hier nochmal aktualisieren) ////////////////////////////////////////////////////////////////////////////////////////////// $html_postencounter=""; if($SID){ $dbin->query("SELECT count(id) AS html_postencounter FROM warenkorb WHERE sid='$SID'"); while($dbin->next_record()){ $html_postencounter = "(".$dbin->f("html_postencounter")." Pos.)"; } } $main_subst["#html_postencounter#"] = $html_postencounter; //URLs $parameter="suche_autor=".urlencode($suche_autor)."&suche_jahr=".urlencode($suche_jahr)."&suche_titel=".urlencode($suche_titel)."&suche2=".urlencode($suche2)."&suche1=".urlencode($suche1); $url_suche=$sess->url($conf_full_domain_path."/suche.php?$parameter"); $url_blaettern=$sess->url($conf_full_domain_path."/blaettern.php?$parameter"); $url_weiter=$sess->url($conf_full_domain_path_secure."/adresse.php"); //Daten abfragen $DEF_FIELDS = $dbc->listfields("publikationen"); $postencounter=0; $calc_postencounter=0; $zeige_versandkosten = false; $dbc->query("SELECT * FROM warenkorb WHERE sid='$SID'"); if($dbc->num_rows()){ $publikationen_liste.=" Sie haben bisher ausgesucht: \"\" Expl. Titel Preis "; while($dbc->next_record()){ $publikationid = $dbc->f("publikationid"); $anzahl = $dbc->f("anzahl"); $dbu->query("SELECT * FROM publikationen WHERE id='$publikationid'"); while($dbu->next_record()){ reset($DEF_FIELDS); while(list($row,$field) = each($DEF_FIELDS)){ $$field = clean_html($dbu->f($field)); } } $preis=$anzahl*$preis; $summe=$summe+$preis; if($versandkostenfrei==0){ $zeige_versandkosten = true; $calc_postencounter++; } if($preis==0){ $preis=""; }else{ $preis="€ ".str_replace(".",",",sprintf("%01.2f", $preis)); } $url_delete=$sess->url($conf_full_domain_path."/warenkorb.php?action=delete&id=$publikationid$parameter"); $publikationen_liste.=" $anzahl $titel $preis "; $postencounter++; } if($zeige_versandkosten==true){ $preis=$calc_postencounter*5; $summe=$summe+$preis; $preis="€ ".str_replace(".",",",sprintf("%01.2f", $preis)); $publikationen_liste.=" $calc_postencounter Porto und Verpackung: Pauschal € 5,- $preis "; } //Summe und Versandkosten if($summe==0){ $summe=""; }else{ $summe="€ ".str_replace(".",",",sprintf("%01.2f", $summe)); } $publikationen_liste.=" Summe:
inkl. Mwst. $summe "; }else{ //Noch keine Einträge im Warenkorb $publikationen_liste.=" Sie haben noch nichts ausgesucht.
"; } /* */ $content="

Warenkorb

"; $content.=" $publikationen_liste
"; if($postencounter>0){ $content.="
"; } $content.="
"; $main_subst["#content#"] = $content; $main_subst["#reporter_list#"] = $reporter_list; $gen = new t_generator($template); $gen -> output_section("main", $main_subst); ?>