<?php
include("panel/mpcresimsil.php");
?>
<?php
$sqlkatsinirson = $db->prepare("SELECT * FROM sitesablon WHERE id= 1");
$sqlkatsinirson->execute();
$katsinirson=$sqlkatsinirson->fetch(PDO::FETCH_ASSOC);
?>
<?php
if($katsinirson['uyelik'] == "1") {
include("uyeayar.php");
if(!isset($_SESSION["giris"])){
echo "";
}
else {
}
}
?>
<?php if(empty($_GET['status'])){
}; ?>
<?php $ayarlarsql = $db->prepare("SELECT * FROM sitebilgileri where id=1"); $ayarlarsql->execute(); $ayarlar = $ayarlarsql->fetch(PDO::FETCH_ASSOC); ?>
<?php
$sqlkatsinirson = $db->prepare("SELECT * FROM sitesablon WHERE id= 1");
$sqlkatsinirson->execute();
$katsinirson=$sqlkatsinirson->fetch(PDO::FETCH_ASSOC);
?>
<!doctype html>
<?php $ayarlarsql = $db->prepare("SELECT * FROM sitebilgileri where id=1"); $ayarlarsql->execute(); $ayarlar = $ayarlarsql->fetch(PDO::FETCH_ASSOC); ?>
<!DOCTYPE html><html lang="tr-TR"><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=0">
<title></title><meta name=description content="">
<?php include("menu.php"); ?>
<?php
//Setting session start
$total=0;
//get action string
$action = isset($_GET['action'])?
$_GET['action']:"";
//Add to cart
if($action=='addcart' ) {
$select = $db->prepare("SELECT * FROM galeri where id=?");
$select->execute(array($id));
$product = $select->fetch(PDO::FETCH_ASSOC);
$stoksepetgonder = strip_tags($_POST['stoksepetgonder']);
//$currentQty = $_SESSION['products'][$id]['qty']=$adet;
$_SESSION['products'][$id] =array('qty'=>$adet,'id'=>$product['id'], 'urunadi'=>$product['urunadi'],'img'=>$product['img'],'fiyat'=>$product['fiyat'],'bedensepet'=>$beden,'stoksepet'=>$stoksepetgonder,'urunkodu'=>$product['urunkodu'],'renk'=>$product['renk']);
$product='';
header("Location:shopping-cart.php");
}
//Empty All
if($action=='emptyall') {
$_SESSION['products'] =array();
header("Location:shopping-cart.php");
}
//Empty one by one
if($action=='empty') {
$products = $_SESSION['products'];
$_SESSION['products']= $products;
header("Location:shopping-cart.php");
}
//Get all Products
$query = "SELECT * FROM galeri";
$stmt = $db->prepare($query);
$stmt->execute();
$products = $stmt->fetchAll();
?>
<br>
<div class="container-full ustbar"><div class="container"><div class="row"><div class="col-xs-12 col-sm-12 " ><i class="fa fa-angle-right" aria-hidden="true"></i> Alışveriş Sepeti</div></div></div></div>
<div class="middle-content-area-divalaniorta"><div class="container"><div class="row">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
<?php if(!empty($_SESSION['products'])):?>
<div class="col-xs-12 col-sm-12" >
<table class="table table-striped">
<thead>
<tr>
<th>Fotoğraf</th>
<th>Ürün Adı</th>
<th>Ölçü</th>
<th>Birim Fiyatı</th>
<th>Toplam</th>
<th >Adet</th>
<th style="text-align: center;">Sil</th>
</tr>
</thead>
<?php foreach($_SESSION['products'] as $key=>$product):?>
<tr>
<td><img class="lazyload img-responsive" src="blank.png" data-src="panel/galeri/<?php echo $product['img']; ?>" style="width: 40px !important;"></td>
<td><?php echo $product['urunadi']?><br>
<?php echo $product['urunkodu']?><br>
<?php echo $product['renk']?></td>
<td><?php echo $product['bedensepet']?></td>
<td><?php echo $product['fiyat']?> TL</td>
<td><?php $tbf=$product['fiyat']*$product['qty']; echo $tbf;?> TL</td>
<td>
<script>function myFunction<?php echo $key?>() {
document.getElementById("submit<?php echo $key?>").click(); }</script>
<form method="post" action="shopping-cart.php?action=addcart" onchange="myFunction<?php echo $key?>()" >
<input name="adet" id="adet" class="form-control" type="number" style="width:75px;" min="1" max="<?php echo $product['stoksepet'];?>" step="1" value="<?php echo $product['qty']?>" >
<input name="stoksepetgonder" type="text" id="stoksepetgonder" value="<?php echo $product['stoksepet'];?>" size="2" readonly="true" style="display: none;">
<input type="hidden" name="beden" id="beden" value="<?php echo $product['bedensepet']?>">
<input type="hidden" name="id" id="id" value="<?php echo $key?>">
<INPUT name="submit<?php echo $key?>" id="submit<?php echo $key?>" type="submit" value="Güncelle" style="display: none;">
</form>
</td>
<td style="text-align: center;"><a href="shopping-cart.php?action=empty&id=<?php echo $key?>"><i class="fa fa-times-circle" style="font-size: 23px !important;"></i></a></td>
<?php
$total =$total+$tbf;?>
<?php endforeach;?>
</table>
<nav class="navbar navbar-inverse" style="background:#FFFFFF; border:1px solid #eeeeee !important; padding: 15px; text-align: right; width: 100%;">
<?php function ytlFormat
($para){ return @number_format($para,3,',','.');}; $kdvsizfiyat=ytlFormat
(round(($total/1.08),3)); ?>
Ara Toplam : <?php echo $kdvsizfiyat ?> TL<br>
+ %8 Kdv<br><br>Toplam : <?php echo $total?> TL<br>Kargo Bedeli : <?php echo $ayarlar['mobiltel'];?> TL<br><br>
<span style="font-weight: bold; font-size: 19px !important;text-align: right; border-top: 1px solid #eeeeee; padding-top: 10px;">Genel Toplam: <?php echo $total+$ayarlar['mobiltel'];?> TL</span>
<span name="kdvlifiyat" type="text" id="kdvlifiyat" style="text-align:right;" size="10" value="<?php echo $total?>" />
<span name="fiyat" type="text" id="fiyat" style="text-align:right;" size="10" value="<?php echo $kdvsizfiyat ?>" />
</nav>
<div class="container middle-content-area-aboutus" style="text-align: center;">
<div class="container-fluid">
<div class="row">
<?php if($sitesablon['uyelik'] == "1") { ?>
<div class="col-xs-12 col-sm-12" style="text-align: right;">
<form name="sep" id="sep" action="sepetim.php" onSubmit="return validate(this)" method="post">
<input type="submit" name="dugme" id="dugme" class="btn btn-primary" style="color: #FFFFFF !important;" value="Alışverişi Tamamla">
</form>
</div>
<?php } ?>
<?php if($sitesablon['uyelik'] != "1") { ?>
<form name="sep" id="sep" action="shopping-cart.php?action=siparis" onSubmit="return validate(this)" method="post">
<div class="col-xs-12 col-sm-6" >
<div class="col-xs-12 col-sm-6" style="text-align: left;" > Ad Soyad <br><input name="ad" type="text" id="ad" size="25" class="form-control" required/><br></div>
<div class="col-xs-12 col-sm-6" style="text-align: left;"> Telefon <br><input name="tel" type="text" id="tel" size="25" class="form-control" onKeyPress="fn_validateNumeric(this)" required/><br></div>
<div class="col-xs-12 col-sm-6" style="text-align: left;"> E-Mail <br><input name="mail" type="text" id="mail" size="25" class="form-control" required/><br></div>
<div class="col-xs-12 col-sm-6" style="text-align: left;">Ödeme Şekli <br><select name="odeme" id="odeme" class="form-control" required>
<option value="Kapıda odeme(kargo ile)" >Kapıda Ödeme (Kargo ile)</option>
</select><br></div>
</div>
<div class="col-xs-12 col-sm-6" style="text-align: left;"> Adres <br><textarea name="adres" cols="30" rows="5" id="adres" class="form-control" required></textarea><br>
</div>
<div class="col-xs-12 col-sm-12" style="text-align: right;">
<input type="submit" name="dugme" id="dugme" class="btn btn-primary" style="color: #FFFFFF !important;" value="Sipariş Ver">
</form>
</div>
<?php } ?>
<div class="col-xs-12 col-sm-12" style="text-align: left;"> <hr></div>
</div>
</div>
</div>
</div>
</div>
<?php
if($action=='siparis') {
include 'phpmailer/class.phpmailer.php';
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->SMTPAuth = true;
$mail->Host = $ayarlar['formsunucu'];
$mail->Port = 587;
$mail->Username = $ayarlar['formemail'];
$mail->Password = $ayarlar['formsifre'];
$mail->SetFrom($mail->Username, "Sipariş Maili");
$mail->AddAddress($ayarlar['formemail'], 'Sipariş Mesajı');
$mail->CharSet = 'UTF-8';
$mail->Subject = "Sipariş Maili";
$msg1 = '<h3>Sipariş Veren Bilgileri : </h3>Ad, Soyad : '.$_POST["ad"].'<br>E-Posta : '.$_POST["mail"].'<br>Tel : '.$_POST["tel"].'<br>Ödeme Şekli : '.$_POST["odeme"].'<br>Adres : '.$_POST["adres"].'<br>Siparişler :<hr>';
$total=0;
$message = // contents of report in $message
"
<html>
<head></head>
<body>
<h3>Siparişler : </h3>
<table name='contact_seller' style='border-collapse:collapse';>
<thead>
<tr>
</tr>
</thead>
<tbody>";
foreach($_SESSION['products'] as $key=>$product):
$tbf=$product['fiyat']*$product['qty'];
$message .='Ürün Adı :'.$product['urunadi'].'<br>Ürün Kodu :'.$product['urunkodu'].'<br>Rengi :'.$product['renk'].'<br>Ölçü :'.$product['bedensepet'].'<br>Adet :'.$product['qty'].'<br>Fiyatı :'.$product['fiyat'].' TL <br>Toplam Tutar :'.$tbf.' TL <br><hr>';
$total=$total+$tbf;
endforeach;
$message .= "</tbody>
</table>
</body>
</html>";
$msg3 ='Genel Toplam :'.$total.' TL <br><br><br><br>';
$mail->MsgHTML($msg1.$message.$msg3);
if($mail->Send()) {
?>
<script>window.onload = function() {
document.getElementById("siparis").click();
}</script>
<form method="post" action="siparis.php" >
<input type="submit" name="siparis" id="siparis" class="btn btn-primary" style="display: none !important;" value="Sipariş Ver"></div>
</form>
<?php
}
else { header("Location:index.php");}
} ?>
<nav class="navbar navbar-inverse" style="background:#FFFFFF; border:0px solid #eeeeee !important; padding: 15px; text-align: right;">
<a href="index.php" class="btn btn-default">Alışverişe Devam</a>
<a href="shopping-cart.php?action=emptyall" class="btn btn-default">Sepeti Boşalt</a>
</nav>
</div>
<?php endif;?>
<?php
if ($_SESSION['products']==null){
?>
<div class="col-xs-12 col-sm-12" >
Sepetiniz Boş
</div>
<?php
}?>
</div></div></div>
</div>
</div>
<br><br><br><br>
<?php include("footer.php"); ?>