header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); // always modified
header("Cache-Control: no-store, no-cache, must-revalidate"); // HTTP/1.1
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache"); // HTTP/1.0
/*
tr07_cart.php
*/
$str_now = date ("d.m.Y H:i");
$NL="\n";
$BR=' ';
$waehrung="DM";
$waehrung="€"; // EURO
$phpprogname="tr07_cart.php";
$tablename_cart="tr07_cart";
$tablename_prod="tr07_prod";
$isOdbc=false;
$bln_deploy=true;
$bln_protected=false;
if(!$bln_deploy)
{
$str_host="editarea";
$str_user="postgres";
$str_port="5432";
$str_dbname="traudlriessdb";
$str_pfad="/usr/local/apache/htdocs/www.traudlriess.de/";
$str_pg_connect="host=$str_host user=$str_user port=$str_port dbname=$str_dbname";
$str_email_adress='jk@lemonjuice.de';
}
else
{
// postgres auf www.traudlriess.de
$str_host="localhost";
$str_user="traudlriess";
$str_password="sqltraudl";
$str_port="5432";
$str_dbname="traudlriess";
$str_pfad="/home/traudlriess/pub_html/";
$str_pg_connect="user=$str_user password=$str_password port=$str_port dbname=$str_dbname ";
$str_email_adress='order@traudl-riess.de';
}
$str_bgcolor="#d7dade";
$str_redirecttime='5000'; //Millisekunden
$array_transToHTML= array('ä'=>'ä','Ä'=>'Ä','ö'=>'ö','Ö'=>'Ö','ü'=>'ü','Ü'=>'Ü','ß'=>'ß');
$menge=array();
$str_mode="";
$bln_error=false;
$str_error="";
$str_redirect=''.$NL;
$str_wkhref2='Warenkorb ';
$str_htmlstart='
Warenkorb '.$NL;
$str_htmlstart.=''.$NL;
$str_htmlstart.=' ';
$str_htmlstart2='Warenkorb '.$NL;
$str_htmlstart2.=''.$NL;
$str_htmlend='';
function lj_connect_db()
{
global $isOdbc;
global $str_pg_connect;
if(!$isOdbc)
{
return pg_pConnect($str_pg_connect);
}
else
{
return odbc_connect("riestest", "admin", "");
}
}
function lj_close_db($pgsqlconn)
{
global $isOdbc;
if(!$isOdbc)
{
pg_Close($pgsqlconn);
}
else
{
odbc_Close($pgsqlconn);
}
}
function lj_fetch_array($result,$num)
{
global $isOdbc;
if(!$isOdbc)
{
$int_rows=pg_NumRows($result);
if ($int_rows <= $num) // num starts with 0
{
return false;
}
else
{
return pg_fetch_array($result,$num);
}
}
else
{
return odbc_fetch_array($result);
}
}
function lj_exec($sqlconn, $SELECT)
{
global $isOdbc;
if(!$isOdbc)
{
//print $SELECT . " ";
return pg_exec($sqlconn, $SELECT);
}
else
{
return odbc_exec($sqlconn, $SELECT);
}
}
function lj_free_result($result)
{
global $isOdbc;
if(!$isOdbc)
{
return pg_freeresult($result);
}
else
{
return odbc_free_result($result);
}
}
function pgsqlEncode ($str_in)
{
global $NL;
global $BR;
$str_out = '';
$int_l = strlen($str_in);
for ($int_i = 0; $int_i < $int_l; $int_i++)
{
$str_c = substr($str_in, $int_i, 1);
if ($str_c == "'" || $str_c == "\\")
{
if ($int_i < $int_l)
{
$str_right = substr($str_in, $int_i, 2);
}
else
{
$str_right = '';
}
if ($int_i > 0)
{
$str_left = substr($str_in, $int_i-1, 2);
}
else
{
$str_left = '';
}
if ($str_left == "\\'" || $str_left == "\\\\" || $str_right == "\\'" || $str_right == "\\\\")
{
// (use a "'" insead for MS-SQL!)
//print 'FOUND: already masked: ' . $str_out . $str_c . $BR . $NL;
// already masked!
$str_out = $str_out . $str_c;
//print $str_out . $BR;
}
else
{
//print 'FOUND: mask now: ' . $str_out . ' \\ ' . $str_c . $BR . $NL;
// maske the character for mysql (use a "'" insead for MS-SQL!)
$str_out = $str_out . '\\' . $str_c;
//print $str_out . $BR;
}
}
else
{
$str_out = $str_out . $str_c;
}
}
return $str_out;
}
function warenkorblink1($int_positionen_gesamt)
{
$str_bild='';
$str_link_start='';
$str_link_end='';
$str_alt='';
if($int_positionen_gesamt>0)
{
$str_bild="voll";
$str_alt="Der Warenkorb enthält $int_positionen_gesamt Posten.";
$str_link_start='';
$str_link_end=' ';
}
else
{
$str_bild="leer";
$str_alt="Der Warenkorb ist leer.";
}
$str_html=' '.$str_link_start ;
$str_html.=' ';
$str_html.=$str_link_end.' ';
return $str_html;
}
function loginlink1 ()
{
$str_html.= '';
return $str_html;
}
function myround($preis)
{
$preis=round($preis*100)/100;
return $preis;
}
function formatName($str_name)
{
global $array_transToHTML;
reset($array_transToHTML);
$str_name=str_replace("\\n","",$str_name); // '\n' entfernen
while( list($key,$val)=each($array_transToHTML) )
{
$str_name=str_replace($key,$val,$str_name);
}
return $str_name;
}
function formatInfo($str_name)
{
global $array_transToHTML;
reset($array_transToHTML);
$str_name=str_replace("\\n","",$str_name); // '\n' entfernen
while( list($key,$val)=each($array_transToHTML) )
{
$str_name=str_replace($key,$val,$str_name);
}
return $str_name;
}
/*-- Funktion um Input zu prüfen --*/
function checkInput($value)
{
$value=intval($value);
if($value>=0 )
{
return $value;
}
else
{
return 0;
}
}
function makeEmail($preview)
{
global $pgsqlconn,$menge,$info1,$info2,$int_cust_id,$NL,$str_email,$str_fax,$str_telefon,$str_kommentar;
global $array_customer;
global $str_htmlstart;
global $tablename_cart, $tablename_prod;
$array_artikel=array();
$float_gesamtpreis=0;
$preis=array();
$SQL="SELECT * from ".$tablename_cart." c, ".$tablename_prod." p where c.cust_id=$int_cust_id and c.prod_id = p.prod_id order by p.prod_art_nr";
$result=pg_exec($pgsqlconn,$SQL);
$int_anzahl= pg_NumRows($result);
$str_html_artikel='';
if($preview=='preview')
{
$str_html_artikel.='';
}
$str_html_artikel.='----------------- Bestellung ---------------'.$NL;
if($preview=='preview')
{
$str_html_artikel.='' ;
}
for($i=0;$i<$int_anzahl;$i++)
{
$array_artikel[$i]=pg_fetch_array($result,$i);
}
for($i=0;$i= 5 && !empty($array_artikel[$i]["prod_preis_5"]) && $array_artikel[$i]["prod_preis_5"] > 0.0 )
{
$preis[$i]=$array_artikel[$i]["prod_preis_5"];
}
if($int_menge >= 6 && !empty($array_artikel[$i]["prod_preis_6"]) && $array_artikel[$i]["prod_preis_6"] > 0.0 )
{
$preis[$i]=$array_artikel[$i]["prod_preis_6"];
}
if($int_menge >= 10 && !empty($array_artikel[$i]["prod_preis_10"]) && $array_artikel[$i]["prod_preis_10"] > 0.0 )
{
$preis[$i]=$array_artikel[$i]["prod_preis_10"];
}
if($int_menge >= 20 && !empty($array_artikel[$i]["prod_preis_20"]) && $array_artikel[$i]["prod_preis_20"] > 0.0 )
{
$preis[$i]=$array_artikel[$i]["prod_preis_20"];
}
if($int_menge >= 50 && !empty($array_artikel[$i]["prod_preis_50"]) && $array_artikel[$i]["prod_preis_50"] > 0.0 )
{
$preis[$i]=$array_artikel[$i]["prod_preis_50"];
}
if($int_menge >= 100 && !empty($array_artikel[$i]["prod_preis_100"]) && $array_artikel[$i]["prod_preis_100"] > 0.0 )
{
$preis[$i]=$array_artikel[$i]["prod_preis_100"];
}
if($int_menge >= 200 && !empty($array_artikel[$i]["prod_preis_200"]) && $array_artikel[$i]["prod_preis_200"] > 0.0 )
{
$preis[$i]=$array_artikel[$i]["prod_preis_200"];
}
if($int_menge >= 500 && !empty($array_artikel[$i]["prod_preis_500"]) && $array_artikel[$i]["prod_preis_500"] > 0.0 )
{
$preis[$i]=$array_artikel[$i]["prod_preis_500"];
}
if($int_menge >= 1000 && !empty($array_artikel[$i]["prod_preis_1000"]) && $array_artikel[$i]["prod_preis_1000"] > 0.0 )
{
$preis[$i]=$array_artikel[$i]["prod_preis_1000"];
}
$float_gesamtpreis+=$int_menge*$preis[$i];
$str_pos = '' . ($i+1);
while (strlen($str_pos) < 3)
{
$str_pos = ' ' . $str_pos;
}
$str_amount = '' . intval($array_artikel[$i]["cart_amount"]);
while (strlen($str_amount) < 5)
{
$str_amount = ' ' . $str_amount;
}
$str_preis = number_format($preis[$i],2,",","");
while (strlen($str_preis) < 8)
{
$str_preis = ' ' . $str_preis;
}
$str_html_artikel.=$NL;
$str_html_artikel.= 'Position: '.$str_pos.' ';
$str_html_artikel.= 'Menge: '.$str_amount.' ';
if($preview=='preview')
{
$str_html_artikel.=' Stück ';
}
else
{
$str_html_artikel.=' Stück ';
}
$str_html_artikel.= $array_artikel[$i]["prod_art_nr"].' ';
if($preview=='preview')
{
$str_html_artikel.=formatName($array_artikel[$i]["prod_art_name"]);
}
else
{
$str_html_artikel.=$array_artikel[$i]["prod_art_name"];
}
if($preview=='preview')
{
$str_html_artikel.=' '.formatName($array_artikel[$i]["prod_info_val1"]);
$str_html_artikel.=' '.formatName($array_artikel[$i]["prod_info_val2"]);
}
else
{
$str_html_artikel.=' '.$array_artikel[$i]["prod_info_val1"];
$str_html_artikel.=' '.$array_artikel[$i]["prod_info_val2"];
}
if(trim($array_artikel[$i]["cart_info1"])!="")
{
if($preview=='preview')
{
$str_html_artikel.=formatName($array_artikel[$i]["cart_info1"]);
}
else
{
$str_html_artikel.=$array_artikel[$i]["cart_info1"];
}
}
if(trim($array_artikel[$i]["cart_info2"])!="")
{
if($preview=='preview')
{
$str_html_artikel.=formatName($array_artikel[$i]["cart_info2"]);
}
else
{
$str_html_artikel.=$array_artikel[$i]["cart_info2"];
}
}
$str_html_artikel.=' je '.$str_preis.' '.$waehrung.' '.$NL;
}
if($preview=='preview')
{
$str_html_artikel.= $NL.'';
$str_html_artikel.= 'Summe '.number_format($float_gesamtpreis,2,",","").' '.$waehrung.' ';
$str_html_artikel.= 'zzgl. MWST ';
$str_html_artikel.= number_format(myround($float_gesamtpreis*0.16),2,",","").' '.$waehrung.' ';
$str_html_artikel.= 'Gesamtpreis inkl. MWST ';
$str_html_artikel.= number_format(myround($float_gesamtpreis*1.16),2,",","").' '.$waehrung.'
';
}
else
{
$str_summe = '' . number_format($float_gesamtpreis,2,",","");
$str_mwst = '' . number_format(myround($float_gesamtpreis*0.16),2,",","");
$str_gesamt = '' . number_format(myround($float_gesamtpreis*1.16),2,",","");
while (strlen($str_summe) < 8)
{
$str_summe = ' ' . $str_summe;
}
while (strlen($str_mwst) < 8)
{
$str_mwst = ' ' . $str_mwst;
}
while (strlen($str_gesamt) < 8)
{
$str_gesamt = ' ' . $str_gesamt;
}
$str_html_artikel.=$NL;
$str_html_artikel.= '---------------------------------------'.$NL;
$str_html_artikel.= 'Summe: '.$str_summe.' '.$waehrung.''.$NL;
$str_html_artikel.= 'MWST: '.$str_mwst.' '.$waehrung.''.$NL;
$str_html_artikel.= 'Gesamtpreis inkl. MWST: '.$str_gesamt.' '.$waehrung.''.$NL;
}
if($preview=='send')
{
$str_email;
$str_fax;
$str_telefon;
$bln_daten_geaendert=false;
$str_geaendert='';
if($str_email!=$array_customer["cust_email"])
{
$bln_daten_geaendert=true;
$str_geaendert=' E-Mail ';
}
if($str_fax!=$array_customer["cust_fax"])
{
$bln_daten_geaendert=true;
$str_geaendert.=' Fax ';
}
if($str_telefon!=$array_customer["cust_tel"])
{
$bln_daten_geaendert=true;
$str_geaendert.=' Telefon ';
}
$str_html_artikel.=$NL.'---------------- Kommentar -------------------'.$NL.$NL;
$str_html_artikel.=$NL.$str_kommentar.$NL.$NL;
$str_html_artikel.=$NL.'---------------- Adresse -------------------'.$NL.$NL;
$str_html_artikel.=$array_customer["cust_name1"].$NL;
$str_html_artikel.=$array_customer["cust_name2"].$NL;
$str_html_artikel.=$array_customer["cust_adr1"].$NL;
$str_html_artikel.=$array_customer["cust_adr2"].$NL;
$str_html_artikel.=$array_customer["cust_plz"].' '.$array_customer["cust_ort"].$NL;
$str_html_artikel.=$array_customer["cust_land"].$NL;
$str_html_artikel.=$array_customer["cust_region"].$NL;
$str_html_artikel.='Tel:'.$str_telefon.$NL;
$str_html_artikel.='Fax:'.$str_fax.$NL;
$str_html_artikel.='E-Mail:'.$str_email.$NL;
$str_html_artikel.=$array_customer["cust_www"].$NL;
if($bln_daten_geaendert)
{
$str_sql_email = pgsqlEncode ($str_email);
$str_sql_telefon = pgsqlEncode ($str_telefon);
$str_sql_fax = pgsqlEncode ($str_fax);
$SQL="Update tr_cust set cust_email='$str_sql_email', cust_tel='$str_sql_telefon', cust_fax='$str_sql_fax' where cust_id=".$int_cust_id;
$result=pg_exec($pgsqlconn,$SQL);
$str_html_artikel.="Achtung !! Daten ( $str_geaendert) geändert";
}
}
else if($preview=='preview')
{
$str_html_artikel.=$NL.$NL.' ';
}
return $str_html_artikel;
}
/*-- Datenbankverbindung --*/
//$pgsqlconn=pg_pConnect($str_pg_connect);
//$pgsqlconn = odbc_connect("riestest", "admin", "");
$pgsqlconn = lj_connect_db();
if(!$pgsqlconn)
{
$bln_error=true;
$str_error='nodb';
}
/*-- get _f --*/
if(!isset($HTTP_GET_VARS["_f"]))
{
$str_mode="status";
}
else
{
$str_mode=$HTTP_GET_VARS["_f"];
}
/*-- get User-Information --*/
if($bln_protected)
{
if(!isset($REMOTE_USER))
{
$bln_error=true;
$str_error='remoteuser';
}
else
{
$user=$REMOTE_USER;
// Apache-htaccess mit Dbeintag vergleichen
$SQL="SELECT * from tr_cust where cust_login='".$user."'";
$result =lj_exec($pgsqlconn, $SQL);
//$rows=pg_NumRows($result);
if(!$result) //User in htaccess aber nicht in DB
{
$bln_error=true;
$str_error='dbuser';
}
else
{
// cust_id aus DB holen
$arr=lj_fetch_array($result,0);
$int_cust_id=$arr["cust_id"];
$str_cust_kdnr=$arr["cust_kdnr"];
$array_customer=$arr;
// Anzahl der Positionen ermitteln
$SQL="SELECT cart_id from ".$tablename_cart." where cust_id=$int_cust_id";
$result=lj_exec($pgsqlconn,$SQL);
//ToDo
$int_positionen_gesamt=pg_NumRows($result);
}
}
}
/*-- read get and post --*/
switch($str_mode)
{
case 'status':
break;
case 'email':
if( !isset($HTTP_POST_VARS["kommentar"]))
{
$bln_error=true;
$str_error='get/post';
}
else
{
$str_email=$HTTP_POST_VARS["email"];
$str_fax=$HTTP_POST_VARS["fax"];
$str_telefon=$HTTP_POST_VARS["telefon"];
$str_kommentar=$HTTP_POST_VARS["kommentar"];
}
break;
case 'add':
case 'bestellung':
case 'update':
if( !isset($HTTP_POST_VARS["m"]))
{
$bln_error=true;
$str_error='get/post';
}
else
{
$menge=$HTTP_POST_VARS["m"];
$info1=$HTTP_POST_VARS["info1"];
$info2=$HTTP_POST_VARS["info2"];
}
break;
case 'showimg':
if(!isset( $HTTP_GET_VARS["id"]) || ! isset($HTTP_GET_VARS["wgr"]) )
{
$bln_error=true;
$str_error='get/post';
}
else
{
$id=$HTTP_GET_VARS["id"];
$wgr=$HTTP_GET_VARS["wgr"];
}
break;
case 'delete':
if(!isset($HTTP_GET_VARS["cart_id"]))
{
$bln_error=true;
$str_error='get/post';
}
else
{
$cart_id=$HTTP_GET_VARS["cart_id"];
}
break;
case 'showcart':
break;
}
/*-- shop_open darf nur showimg oder status--*/
if(!$bln_protected && $str_mode!='showimg')
{
$str_mode='status';
}
/*-- doPHP --*/
if(!$bln_error)
{
switch($str_mode)
{
case 'status';
break;
case 'add':
$int_positionen_neu=0;
reset($menge);
while(list($key,$val)=each($menge) )
{
if(checkInput($val))
{
$int_positionen_neu++;
$str_sql_info1 = pgsqlEncode($info1[$key]);
$str_sql_info2 = pgsqlEncode($info2[$key]);
$SQL="INSERT into ".$tablename_cart." (cust_id,prod_id,cart_amount,cart_info1,cart_info2) ";
$SQL.=" values ($int_cust_id,$key,$val,'$str_sql_info1','$str_sql_info2')";
$result=lj_exec($pgsqlconn,$SQL);
$int_positionen_gesamt++;
}
}
break;
case 'update':
reset($menge);
while(list($key,$val)=each($menge) )
{
if(checkInput($val) )
{
$SQL="UPDATE ".$tablename_cart." set cart_amount=$val ";
if(trim($info1[$key])=="")
{
$SQL.=" ,cart_info1='' ";
}
if(trim($info2[$key])=="")
{
$SQL.=" ,cart_info2='' ";
}
$SQL.=" where cart_id=$key";
$result=lj_exec($pgsqlconn,$SQL);
}
else // wenn Feld 0 dann aus Cart löschen
{
$SQL="Delete from ".$tablename_cart." where cart_id=$key";
$result=lj_exec($pgsqlconn,$SQL);
$int_positionen_gesamt--;
}
}
$str_mode='showcart';
break;
case 'showimg':
$str_img=$str_pfad.'prod_images/wgr'.$wgr.'/'.$id.'.jpg';
$str_imgurl='../prod_images/showimg.php?bild=wgr'.$wgr.'/'.$id.'.jpg&wgr='.$wgr;
if(file_exists($str_img) && is_file($str_img))
{
$array_imgsize=getimagesize($str_img);
}
else
{
$str_img=$str_pfad.'prod_images/wgr'.$wgr.'/'.$id.'.gif';
$str_imgurl='../prod_images/showimg.php?bild=wgr'.$wgr.'/'.$id.'.gif&wgr='.$wgr;
if(is_file($str_img))
{
$array_imgsize=getimagesize($str_img);
}
else
{
$str_mode='noimg';//kein Bild da
}
}
break;
case 'deletecart':
$SQL="delete from ".$tablename_cart." where cust_id=$int_cust_id ";
$result=lj_exec($pgsqlconn,$SQL);
if($result)
{
$int_positionen_gesamt=0;
}
$str_mode='showcart'; // !! Achtung !! jetzt geht's mit 'showcart' weiter
break;
case 'delete':
$SQL="DELETE from ".$tablename_cart." where cart_id=$cart_id";
$result=lj_exec($pgsqlconn,$SQL);
if($result)
{
$int_positionen_gesamt--;
}
$str_mode='showcart'; // !! Achtung !! jetzt geht's mit 'showcart' weiter
break;
case 'showcart':
// do nothing
break;
case 'bestellung':
reset($menge);
while(list($key,$val)=each($menge) )
{
if(checkInput($val) )
{
$SQL="UPDATE ".$tablename_cart." set cart_amount=$val ";
if(trim($info1[$key])=="")
{
$SQL.=" ,cart_info1='' ";
}
if(trim($info2[$key])=="")
{
$SQL.=" ,cart_info2='' ";
}
$SQL.=" where cart_id=$key";
$result=lj_exec($pgsqlconn,$SQL);
}
else // wenn Feld 0 dann aus Cart löschen
{
$SQL="Delete from ".$tablename_cart." where cart_id=$key";
$result=lj_exec($pgsqlconn,$SQL);
$int_positionen_gesamt--;
}
}
if($int_positionen_gesamt==0)
{
$str_mode='showcart';
}
else
{
$str_html = makeEmail('preview');
$str_html = ''
. 'Online-Bestellung ' . $str_cust_kdnr . " ". $str_now
. " \n"
. $str_html;
}
break;
case 'email' :
$str_html=makeEmail('send');
if (!empty($str_email))
{
$str_mailCc = $str_email;
$str_mailTo = $str_email_adress . ', ' . $str_mailCc;
}
else
{
$str_mailTo = $str_email_adress;
}
$str_subject = "Online-Bestellung " . $str_cust_kdnr . " " . $str_now;
$str_content = "Online-Bestellung " . $str_cust_kdnr . " " . $str_now . "\n"
. $str_html;
if(mail($str_mailTo,$str_subject,$str_content,"From: info@traudlriess.de"))
{
$SQL="delete from ".$tablename_cart." where cust_id=$int_cust_id";
$result=lj_exec($pgsqlconn,$SQL);
if($result)
{
$int_positionen_gesamt=0;
}
}
else
{
$bln_error=true;
}
break;
default:
$bln_error = true;
$str_error=__LINE__;
// fehlermeldung
}
}
if(!$bln_error)
{
switch($str_mode)
{
case 'status';
break;
case 'showimg':
break;
case 'add':
break;
case 'update':
break;
case 'bestellung':
break;
case 'email':
break;
case 'showcart':
$array_artikel=array();
$float_gesamtpreis=0;
$preis=array();
$SQL="SELECT * from ".$tablename_cart." c, ".$tablename_prod." p where c.cust_id=$int_cust_id and c.prod_id = p.prod_id order by p.prod_art_nr";
$result=lj_exec($pgsqlconn,$SQL);
//ToDo
$int_anzahl= pg_NumRows($result);
for($i=0;$i<$int_anzahl;$i++)
{
$array_artikel[$i]=lj_fetch_array($result,$i);
}
for($i=0;$i= 5 && !empty($array_artikel[$i]["prod_preis_5"]) && $array_artikel[$i]["prod_preis_5"] > 0.0 )
{
$preis[$i]=$array_artikel[$i]["prod_preis_5"];
}
if($int_menge >= 6 && !empty($array_artikel[$i]["prod_preis_6"]) && $array_artikel[$i]["prod_preis_6"] > 0.0 )
{
$preis[$i]=$array_artikel[$i]["prod_preis_6"];
}
if($int_menge >= 10 && !empty($array_artikel[$i]["prod_preis_10"]) && $array_artikel[$i]["prod_preis_10"] > 0.0 )
{
$preis[$i]=$array_artikel[$i]["prod_preis_10"];
}
if($int_menge >= 20 && !empty($array_artikel[$i]["prod_preis_20"]) && $array_artikel[$i]["prod_preis_20"] > 0.0 )
{
$preis[$i]=$array_artikel[$i]["prod_preis_20"];
}
if($int_menge >= 50 && !empty($array_artikel[$i]["prod_preis_50"]) && $array_artikel[$i]["prod_preis_50"] > 0.0 )
{
$preis[$i]=$array_artikel[$i]["prod_preis_50"];
}
if($int_menge >= 100 && !empty($array_artikel[$i]["prod_preis_100"]) && $array_artikel[$i]["prod_preis_100"] > 0.0 )
{
$preis[$i]=$array_artikel[$i]["prod_preis_100"];
}
if($int_menge >= 200 && !empty($array_artikel[$i]["prod_preis_200"]) && $array_artikel[$i]["prod_preis_200"] > 0.0 )
{
$preis[$i]=$array_artikel[$i]["prod_preis_200"];
}
if($int_menge >= 500 && !empty($array_artikel[$i]["prod_preis_500"]) && $array_artikel[$i]["prod_preis_500"] > 0.0 )
{
$preis[$i]=$array_artikel[$i]["prod_preis_500"];
}
if($int_menge >= 1000 && !empty($array_artikel[$i]["prod_preis_1000"]) && $array_artikel[$i]["prod_preis_1000"] > 0.0 )
{
$preis[$i]=$array_artikel[$i]["prod_preis_1000"];
}
$inputname="m[".$array_artikel[$i]["cart_id"]."]";
$float_gesamtpreis+=$int_menge*$preis[$i];
$str_html_artikel.=$NL.''.($i+1).' '.$NL.'';
$str_html_artikel.= $array_artikel[$i]["prod_art_nr"];
$str_html_artikel.=' '.$NL.''.formatName($array_artikel[$i]["prod_art_name"]);
$str_html_artikel.=' '.$NL.'';
$str_html_artikel.=' ';
$str_html_artikel.=$NL.' je '.number_format($preis[$i],2,",","").' '.$waehrung.' '.$NL;
$str_html_artikel.='= '.number_format((intval($array_artikel[$i]["cart_amount"])*$preis[$i]),2,",","").' '.$waehrung.' ';
$str_html_artikel.=' ';
$str_html_artikel.=' '.$NL;
//Zeile für Zusatzinfo/input
$str_html_artikel.=' ';
if( trim($array_artikel[$i]["prod_info_val1"])!="" || trim($array_artikel[$i]["prod_info_val2"])!="" )
{
$str_html_artikel.=''.formatInfo($array_artikel[$i]["prod_info_val1"]);
if(trim($array_artikel[$i]["prod_info_val1"])!="" && trim($array_artikel[$i]["prod_info_val2"])!="")
{
$str_html_artikel.=' - ';
}
$str_html_artikel.=formatInfo($array_artikel[$i]["prod_info_val2"]).' ';
}
else
{
$str_html_artikel.=' ';
}
$str_html_artikel.='';
if(trim($array_artikel[$i]["cart_info1"])!="")
{
$str_html_artikel.=' ';
}
if(trim($array_artikel[$i]["cart_info1"])!=""&&trim($array_artikel[$i]["cart_info2"])!="")
{
$str_html_artikel.=' ';
}
if(trim($array_artikel[$i]["cart_info2"])!="")
{
$str_html_artikel.=' ';
}
$str_html_artikel.=' ';
}
break;
default:
$bln_error = true;
// fehlermeldung
}
}
/*-- doHTML --*/
if(!$bln_error)
{
switch($str_mode)
{
case 'add':
print $str_htmlstart;
print warenkorblink1($int_positionen_gesamt);
print ' '.$int_positionen_neu;
if($int_positionen_neu>1)
{
print ' Positionen hinzugefügt. ' . '('. $int_positionen_gesamt . ')';
}
else
{
print ' Position hinzugefügt. ' . '('. $int_positionen_gesamt . ')';
}
print $str_redirect;
print $str_htmlend;
break;
case 'showimg':
print $str_htmlstart;
print '';
if($bln_protected)
{
print warenkorblink1($int_positionen_gesamt);
}
else
{
print loginlink1();
}
print $str_redirect;
print $str_htmlend;
break;
case 'noimg':
print $str_htmlstart;
if($bln_protected)
{
print warenkorblink1($int_positionen_gesamt);
}
else
{
print loginlink1();
}
print ' Leider ist kein Bild verfügbar';
print $str_redirect;
break;
print $str_htmlend;
case 'showcart':
print $str_htmlstart2;
if($int_positionen_gesamt>0)
{
print '
';
print '';
print 'Pos. Artnr. ';
print $str_html_artikel;
print ' ';
print 'Summe ';
print number_format($float_gesamtpreis,2,",","").' '.$waehrung.'';
print ' ';
print 'zzgl. MWST ';
print number_format(myround($float_gesamtpreis*0.16),2,",","").' '.$waehrung.'';
print ' ';
print 'Gesamtpreis inkl. MWST ';
print number_format(myround($float_gesamtpreis*1.16),2,",","").' '.$waehrung.'';
print '
';
/*
print '';
print ' '.number_format($float_gesamtpreis,2,",","").' '.$waehrung.' ';
print 'zzgl. MWST ';
print number_format(myround($float_gesamtpreis*0.16),2,",","").' '.$waehrung.' ';
print 'Gesamtpreis inkl. MWST ';
print number_format(myround($float_gesamtpreis*1.16),2,",","").' '.$waehrung.'
';
*/
}
else
{
print '';
}
if($int_positionen_gesamt>0)
{
print '
';
}
print '';
print '';
print 'Hinweis:
';
print 'Alle Preise ohne Gewähr! Bei Abweichung gegenüber dem Hauptkatalog gelten die Preise des Hauptkataloges. Sollten Sie eine Abweichung feststellen bitten wir Sie höflich uns darüber zu informieren. info@traudl-riess.de ';
print '
';
print $str_htmlend;
break;
case 'status':
print $str_htmlstart;
if($bln_protected)
{
print warenkorblink1($int_positionen_gesamt);
}
else
{
print loginlink1();
}
print $str_htmlend;
break;
case 'bestellung':
print $str_htmlstart2;
print $str_html;
print ' ';
print ' '.$NL;
print $str_htmlend;
break;
case 'email':
print $str_htmlstart2;
//print $str_html;
print '';
print 'Bestellung aufgenommen. Vielen Dank !!';
print ' ';
print '';
print '
';
print $str_htmlend;
break;
default:
print $str_htmlstart;
print 'Fehler: default str_mode='.$str_mode;
print $str_htmlend;
break;
}
}
else
{
switch($str_mode)
{
case 'add':
print $str_htmlstart;
print 'Bitte wenden Sie sich an:'.$str_error;
print $str_htmlend;
break;
case 'noimg' :
print $str_htmlstart;
print 'Leider kein Bild verfügbar';
if($bln_protected)
{
print warenkorblink1($int_positionen_gesamt);
}
else
{
print loginlink1();
}
print $str_redirect;
print $str_htmlend;
break;
case 'showimg':
print "TESTE";
print $str_htmlstart;
if($bln_protected)
{
print warenkorblink1($int_positionen_gesamt);
}
else
{
print loginlink1();
}
print $str_htmlend;
break;
case 'showcart':
break;
case 'email':
break;
}
}
//print $debug;
//ToDo
//pg_Close($pgsqlconn);
lj_close_db($pgsqlconn);
?>