$module = "members"; $sagmenu = "1"; $title = "Treading Area - Basket"; include "../header.php"; if ($_SESSION['UserId']==""){ Header("Location: ".$myurl."members/index.php"); } else { ?> if ($_GET['more'] == "add") { $sorgu = "select u.urun_adi, f.* from fsepet as f, urun as u where f.fid = u.fid and f.urunid = u.id and f.uid = '".$_SESSION['UserId']."' and f.urunid = '".$_GET['PID']."' "; if ($_GET['piece'] == "") { $adet = 1; } else { $adet = $_GET['piece']; } if (mysql_num_rows(mysql_query($sorgu)) > 0) { $veri=mysql_fetch_array(mysql_query($sorgu)); $yeni_miktar = $veri['miktar'] + $adet; $urun = mysql_fetch_array(mysql_query("select u.* from urun as u, fsepet as f where f.urunid = u.id and f.uid = '".$_SESSION['UserId']."' and f.fid = '".$urun['fid']."' and u.id = f.urunid ")); if ($urun['parabirimi'] == 1) { $ytlfiyat = $urun['fiyat']; /*} else if ($urun['parabirimi'] == 3) { $ytlfiyat = $urun['fiyat'] * $euro_alis; } else if ($urun['parabirimi'] == 2) { $ytlfiyat = $urun['fiyat'] * $dolar_alis;*/ } else { $ytlfiyat = 0; } $kdv = (($ytlfiyat * $yeni_miktar) / 100) * $urun['kdv']; $ttutar = ($ytlfiyat * $yeni_miktar) + $kdv; $kdvdahil = (($ytlfiyat * $urun['kdv']) /100) + $ytlfiyat; @mysql_query("update fsepet set miktar = '".$yeni_miktar."', kdv = '".$kdv."', ttutar = '".$ttutar."' where urunid = '".$_GET['PID']."' and uid = '".$_SESSION['UserId']."' limit 1 "); } else { $urun = mysql_fetch_array(mysql_query("select * from urun where id = '".$_GET['PID']."' limit 1 ")); if ($urun['parabirimi'] == 1) { $ytlfiyat = $urun['fiyat']; /*} else if ($urun['parabirimi'] == 3) { $ytlfiyat = $urun['fiyat'] * $euro_alis; } else if ($urun['parabirimi'] == 2) { $ytlfiyat = $urun['fiyat'] * $dolar_alis;*/ } else { $ytlfiyat = 0; } $kdv = (($ytlfiyat * $adet) / 100) * $urun['kdv']; $ttutar = ($ytlfiyat * $adet) + $kdv; $kdvdahil = (($ytlfiyat * $urun['kdv']) /100) + $ytlfiyat; $ekle = mysql_query("insert into fsepet (id, fid, uid, urunid, miktar, tutar, kdv, ttutar) VALUES ( '', '".$urun['fid']."', '".$_SESSION['UserId']."', '".$_GET['PID']."', '".$adet."', '".$ytlfiyat."', '".$kdv."', '".$ttutar."')"); } } // sepet güncelleme işlemlerini buraya yazalım. if ($_POST['guncelle'] == "yes") { for ($a=0; $a<$_POST['urun_say']; $a++) { while(list($key, $value) = each($_POST['miktar'])) { if ($value == 0) { $sil = mysql_query("delete from fsepet where id = '".$key."' limit 1 "); } else { $urun = mysql_fetch_array(mysql_query("select u.* from urun as u, fsepet as f where f.urunid = u.id and f.uid = '".$_SESSION['UserId']."' and f.id = '".$key."' ")); if ($urun['parabirimi'] == 1) { $ytlfiyat = $urun['fiyat']; /*} else if ($urun['parabirimi'] == 3) { $ytlfiyat = $urun['fiyat'] * $euro_alis; } else if ($urun['parabirimi'] == 2) { $ytlfiyat = $urun['fiyat'] * $dolar_alis;*/ } else { $ytlfiyat = 0; } $kdv = (($ytlfiyat * $value) / 100) * $urun['kdv']; $ttutar = ($ytlfiyat * $value) + $kdv; $kdvdahil = (($ytlfiyat * $urun['kdv']) /100) + $ytlfiyat; $guncelle = mysql_query("update fsepet set miktar = '".$value."', tutar = '".$ytlfiyat."', kdv = '".$kdv."', ttutar = '".$ttutar."' where id = '".$key."' limit 1 "); } } } } //if guncelle yes if ($_POST['guncelle'] == "sil") { if ($_POST['sec']!=""){ while(list($key, $value) = each($_POST['sec'])) { if ($value == "on") { $sil = mysql_query("delete from fsepet where id = '".$key."' limit 1 "); } } } } ?>
Your Basket |