include("includes/session.html");
include("includes/config.html");
include("includes/dbconnect.html");
$aid=$_REQUEST['aid'];
$bildvorhanden=0;
if(!isset($aid) && $aid=="" && !is_numeric($aid))
{
@mysql_close($dblink);
header("location:index.html");
}
else
{
$artikel=@mysql_query("select * from artikel where aid='$aid' and status='0' LIMIT 1");
if(@mysql_num_rows($artikel)=="0")
{
@mysql_close($dblink);
header("location:index.html");
}
else
{
$erg_artikel=@mysql_fetch_array($artikel);
$optionen_vorhanden=0;
$werte_vorhanden=0;
$opt_kats=@mysql_query("select ao.fid, ho.id, ho.feldname, ho.feldeinheit from sh_artikeloptionen as ao inner join sh_hkoptionen as ho on ao.fid=ho.id where ao.aid='$aid' group by ao.fid order by ho.sort");
if(@mysql_num_rows($opt_kats)!="0")
{
$optionen_vorhanden=1;
while($erg_opt_kats=@mysql_fetch_array($opt_kats))
{
$arr_optionen_ids[]=$erg_opt_kats[id];
$arr_optionen_feldname[$erg_opt_kats[id]]=$erg_opt_kats[feldname];
$arr_optionen_feldeinheit[$erg_opt_kats[id]]=$erg_opt_kats[feldeinheit];
$opt_vals=@mysql_query("select * from sh_artikeloptionen where aid='$aid' and fid='$erg_opt_kats[fid]'");
if(@mysql_num_rows($opt_vals)!="0")
{
$werte_vorhanden=1;
while($erg_opt_vals=@mysql_fetch_array($opt_vals))
{
$arr_werte[$erg_opt_kats[id]][$erg_opt_vals[id]]=$erg_opt_vals[wert];
}
}
else
{
$arr_werte[$erg_opt_kats[id]]="";
}
}
}
else
{
$arr_optionen_ids="";
}
$artenchecker=mysql_query("select * from sh_artikelarten where aid='$aid' LIMIT 1");
if(@mysql_num_rows($artenchecker)=="1")
{
$artikelarten_vorhanden=1;
}
else
{
$artikelarten_vorhanden=0;
}
if($erg_artikel[bild]!="")
{
$bildvorhanden=1;
$bildanzeige="";
}
else
{
$bildvorhanden=0;
$bildanzeige="
";
}
$metatitle=$erg_artikel[artikel];
$metadesc=str_replace("\r\n"," ",$erg_artikel[beschreibung]);
if(strlen($metadesc) > 150)
{
$metadesc=substr($metadesc,0,150)." ...";
}
}
}
if(isset($_POST['wkadd']))
{
$menge=$_POST['menge'];
$preis=$_POST['preis'];
$artid=$_POST['artid'];
$grmess=mysql_query("select aid from artikel where aid='$aid' and status='0' and bestellbar='1' LIMIT 1");
if(mysql_num_rows($grmess)!="0")
{
$erg_grmess=mysql_fetch_array($grmess);
$zeit=time();
if(@is_array($_POST['opt']) && @in_array("0",$_POST['opt']))
{
$wkmess1="Bitte füllen Sie alle Angaben aus";
}
elseif(empty($menge))
{
$wkmess1="Bitte geben Sie eine Stückzahl ein";
}
elseif($menge==0)
{
$wkmess1="Bitte geben Sie bei der Stückzahl nicht 0 ein";
}
elseif(!eregi("^[1-9]{1}[0-9]{0,2}$",$menge))
{
$wkmess1="Bitte geben Sie die Stückzahl richtig in Zahlen ein";
}
else
{
if($menge==1)
{
$wurde="wurde";
}
if($menge > 1)
{
$wurde="wurden";
}
if(@is_array($_POST['opt']) && @count($_POST['opt']) > 0) // db_options zusammenbauen
{
$db_options="";
$o=0;
@ksort($_POST['opt']);
foreach($_POST['opt'] as $okey=>$oval)
{
$o++;
$db_options.=$o==1?"$okey|$oval":"#$okey|$oval";
}
}
else
{
$db_options="";
}
$wkcheck=mysql_query("select eid, aid, artid, options from warenkorb where eid='$eid' and aid='$aid' and artid='$artid' and options='$db_options'");
if(mysql_num_rows($wkcheck)=="0")
{
@mysql_query("insert into warenkorb (eid,aid,artid,options,menge,preis,zeit) values ('$eid','$aid','$artid','$db_options','$menge','$preis','$zeit')");
$wkmess="$menge Stk. $wurde in den Warenkorb gelegt";
}
else
{
@mysql_query("update warenkorb set menge=menge+$menge where eid='$eid' and aid='$aid' and artid='$artid' and options='$db_options'");
$wkmess="Die Menge wurde um $menge Stk. erhöht";
}
}
}
}
$bestellbar_hinweis="Dieser Artikel ist nur mehr
bei uns vor Ort verfügbar.";
?>
| include("includes/navi.html"); include("includes/wknavi.html"); ?> |
|
|||||||||||||||||||||||||||||||||||||||