-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathalisverissepeti.php
224 lines (212 loc) · 12.8 KB
/
alisverissepeti.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
<?php
if (isset($_SESSION["Kullanici"])) {
$stokIcinSepettekiUrunlerSorgusu = $dbConnection->prepare("select * from sepet where UyeId = ?");
$stokIcinSepettekiUrunlerSorgusu->execute([$kullaniciId]);
$stokIcinSepettekiUrunSayisi = $stokIcinSepettekiUrunlerSorgusu->rowCount();
$stokIcinSepettekiKayitlar = $stokIcinSepettekiUrunlerSorgusu->fetchAll(PDO::FETCH_ASSOC);
if ($stokIcinSepettekiUrunSayisi > 0) {
foreach ($stokIcinSepettekiKayitlar as $stokIcinSepettekiSatirlar) {
$stokIcinSepetIdsi = $stokIcinSepettekiSatirlar["id"];
$stokIcinSepettekiUrununVaryantIdsi = $stokIcinSepettekiSatirlar["VaryantId"];
$stokIcinSepettekiUrununAdedi = $stokIcinSepettekiSatirlar["UrunAdedi"];
$stokIcinUrununVaryantBilgileriSorgusu = $dbConnection->prepare("select * from urunvaryantlari where id = ? limit 1");
$stokIcinUrununVaryantBilgileriSorgusu->execute([$stokIcinSepettekiUrununVaryantIdsi]);
$stokIcinVaryantKaydi = $stokIcinUrununVaryantBilgileriSorgusu->fetch(PDO::FETCH_ASSOC);
$stokIcinUrununStokAdedi = $stokIcinVaryantKaydi["StokAdedi"];
if ($stokIcinUrununStokAdedi == 0) {
$sepetSilSorgusu = $dbConnection->prepare("delete from sepet where id = ? and UyeId = ? limit 1");
$sepetSilSorgusu->execute([$stokIcinSepetIdsi, $kullaniciId]);
} elseif ($stokIcinSepettekiUrununAdedi > $stokIcinUrununStokAdedi) {
$sepetGuncellemeSorgusu = $dbConnection->prepare("update sepet set UrunAdedi = ? where id = ? and UyeId = ? limit 1");
$sepetGuncellemeSorgusu->execute([$stokIcinUrununStokAdedi, $stokIcinSepetIdsi, $kullaniciId]);
}
}
}
?>
<table width="1065" align="center" border="0" cellpadding="0" cellspacing="0" bgcolor="F9F9F9">
<tr>
<td colspan="3">
<hr />
</td>
</tr>
<tr>
<td colspan="3">
<table width="1065" align="center" border="0" cellpadding="0" cellspacing="0">
<tr>
<td class="UyelikBilgilerimMenu"><a href="index.php?SK=50">Üyelik Bilgilerim</a></td>
<td> </td>
<td class="UyelikBilgilerimMenu"><a href="index.php?SK=58">Adresler</a></td>
<td> </td>
<td class="UyelikBilgilerimMenu"><a href="index.php?SK=59">Favoriler</a></td>
<td> </td>
<td class="UyelikBilgilerimMenu"><a href="index.php?SK=60">Yorumlar</a></td>
<td> </td>
<td class="UyelikBilgilerimMenu"><a href="index.php?SK=61">Siparişler</a></td>
</tr>
</table>
</td>
</tr>
<tr>
<td colspan="3">
<hr />
</td>
</tr>
<tr>
<td width="750" valign="top">
<table width="750" align="center" border="0" cellspacing="0" cellpadding="0">
<tr height="40">
<td style="color:#FF9900;">
<h3>Alışveriş Sepeti</h3>
</td>
</tr>
<tr height="30">
<td valign="top" style="border-bottom: 1px dashed #CCC">Sepetinizdeki ürünlere buradan ulaşabilirsiniz.
</td>
<?php
$sepettekiUrunlerSorgusu = $dbConnection->prepare("select * from sepet where UyeId = ? order by id desc ");
$sepettekiUrunlerSorgusu->execute([$kullaniciId]);
$sepettekiUrunSayisi = $sepettekiUrunlerSorgusu->rowCount();
$sepettekiKayitlar = $sepettekiUrunlerSorgusu->fetchAll(PDO::FETCH_ASSOC);
if ($sepettekiUrunSayisi > 0) {
$sepettekiToplamUrunSayisi = 0;
$sepettekiToplamFiyat = 0;
foreach ($sepettekiKayitlar as $sepetSatirlari) {
$sepetIdsi = $sepetSatirlari["id"];
$sepettekiUrununIdsi = $sepetSatirlari['UrunId'];
$urununVaryantIdsi = $sepetSatirlari['VaryantId'];
$sepettekiUrununAdedi = $sepetSatirlari['UrunAdedi'];
$urunBilgileriSorgusu = $dbConnection->prepare("select * from urunler where id = ? limit 1");
$urunBilgileriSorgusu->execute([$sepettekiUrununIdsi]);
$urunBilgisi = $urunBilgileriSorgusu->fetch(PDO::FETCH_ASSOC);
$urununTuru = $urunBilgisi['UrunTuru'];
$urununResmi = $urunBilgisi['UrunResmiBir'];
$urununAdi = $urunBilgisi['UrunAdi'];
$urununFiyati = $urunBilgisi['UrunFiyati'];
$urununParaBirimi = $urunBilgisi['ParaBirimi'];
$urununVaryantBasligi = $urunBilgisi['VaryantBasligi'];
$urunVaryantBilgileriSorgusu = $dbConnection->prepare("select * from urunvaryantlari where id = ? limit 1");
$urunVaryantBilgileriSorgusu->execute([$urununVaryantIdsi]);
$varyantBilgisi = $urunVaryantBilgileriSorgusu->fetch(PDO::FETCH_ASSOC);
$urununVaryantAdi = $varyantBilgisi['VaryantAdi'];
$urununStokAdedi = $varyantBilgisi['StokAdedi'];
if ($urununTuru == "Erkek Ayakkabısı") {
$resimKlasoru = "Erkek";
} elseif ($urununTuru == "Kadın Ayakkabısı") {
$resimKlasoru = "Kadin";
} else {
$resimKlasoru = "Cocuk";
}
if ($urununParaBirimi == "EUR") {
$urunFiyatiHesapla = $urununFiyati * $euroKuru * $sepettekiUrununAdedi;
$urunFiyatiniBicimlendir = fiyatBicimlendir($urunFiyatiHesapla);
} elseif ($urununParaBirimi == "USD") {
$urunFiyatiHesapla = $urununFiyati * $dolarKuru * $sepettekiUrununAdedi;
$urunFiyatiniBicimlendir = fiyatBicimlendir($urunFiyatiHesapla);
} else {
$urunFiyatiHesapla = $urununFiyati * $sepettekiUrununAdedi;
$urunFiyatiniBicimlendir = fiyatBicimlendir($urunFiyatiHesapla);
}
$sepettekiToplamUrunSayisi += $sepettekiUrununAdedi;
$sepettekiToplamFiyat += $urunFiyatiHesapla;
?>
<tr height="75">
<td align="left">
<table width="750" align="center" border="0" cellspadding="0" cellspacing="0">
<tr>
<td style="border-bottom:1px dashed #ccc;" width="80">
<img src="Resimler/UrunResimleri/<?php echo $resimKlasoru; ?>/<?php echo $urununResmi; ?>" border="0" width="60" height="80">
</td>
<td style="border-bottom:1px dashed #ccc;" width="40">
<a href="index.php?SK=95&ID=<?php echo donusumleriGeriDondur($sepetIdsi) ?>"><img src="Resimler/SilDaireli20x20.png"></a>
</td>
<td style="border-bottom:1px dashed #ccc;" width="390">
<?php echo donusumleriGeriDondur($urununAdi); ?>
<?php echo donusumleriGeriDondur($urununVaryantBasligi); ?> :
<?php echo donusumleriGeriDondur($urununVaryantAdi); ?>
<td style="border-bottom:1px dashed #ccc;" width="120">
<table width="90" align="center" border="0" cellspadding="0" cellspacing="0">
<tr>
<td width="30" align="center">
<?php if ($sepettekiUrununAdedi > 1) { ?>
<a href="index.php?SK=96&ID=<?php echo donusumleriGeriDondur($sepetIdsi) ?>">
<img src="Resimler/AzaltDaireli20x20.png">
</a>
<?php } ?>
</td>
<td width="30" align="center"><?php echo donusumleriGeriDondur($sepettekiUrununAdedi); ?></td>
<td width="30" align="center">
<a href="index.php?SK=97&ID=<?php echo donusumleriGeriDondur($sepetIdsi) ?>">
<img src="Resimler/ArttirDaireli20x20.png">
</a>
</td>
</tr>
</table>
</td>
<td align="right" style="border-bottom:1px dashed #ccc;" width="120">
<?php echo $urunFiyatiniBicimlendir; ?> TL
</td>
</tr>
</table>
</td>
</tr>
<?php } ?>
<?php } else { ?>
<tr height="75">
<td align="left">Sepetinizde ürün bulunmuyor.</td>
</tr>
<?php } ?>
</tr>
</table>
</td>
<td width="15"> </td>
<td width="300" valign="top">
<table width="300" align="center" border="0" cellspacing="0" cellpadding="0" style="padding:0px 20px;
text-align:justify;margin-bottom: 20px; ">
<tr height="40">
<td style="color: #FF9900;" align="right">
<h3>Sipariş Özeti</h3>
</td>
</tr>
<?php
if (isset($sepettekiToplamUrunSayisi)) { ?>
<tr height="30">
<td align="right" valign="top" style="border-bottom: 1px dashed #CCC">
Toplam <b> <?php echo $sepettekiToplamUrunSayisi; ?></b> adet ürün bulunmaktadır.
</td>
</tr>
<tr height="5">
<td> </td>
</tr>
<tr align="right">
<td>Ödenecek Toplam Tutar (KDV Dahil)</td>
</tr>
<tr align="right">
<td><?php echo fiyatBicimlendir($sepettekiToplamFiyat); ?></td>
</tr>
<tr height="5">
<td> </td>
</tr>
<tr align="center">
<td>
<div class="SepetIciDevamEt">
<a href="index.php?SK=98"><img src="Resimler/SepetBeyaz21x20.png"> DEVAM ET</a>
</div>
</td>
</tr>
<?php } else { ?>
<tr height="30">
<td align="right" valign="top" style="border-bottom: 1px dashed #CCC">
Sepete ürün eklemeniz gerekmektedir.
</td>
</tr>
<?php } ?>
</table>
</td>
</tr>
</table>
<?php
} else {
header("Location:index.php");
exit();
}
?>