Advertisement
akberhussain

Shopping cart page

Mar 5th, 2013
153
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 13.41 KB | None | 0 0
  1. shopping cart page
  2.  
  3. <?php
  4. session_start();
  5. include("cart/db.php");
  6. include("cart/functions.php");
  7. include('config.php');
  8. $email=$_SESSION['email'];
  9. $uid=$_SESSION['id'];
  10. echo $size=$_REQUEST['size'];
  11. $id=$_REQUEST['id'];
  12.  
  13.  
  14.  
  15. if($_REQUEST['command']=='delete' && $_REQUEST['id']>0){
  16. remove_product($_REQUEST['id']);
  17. }
  18. else if($_REQUEST['command']=='clear'){
  19. unset($_SESSION['cart']);
  20. }
  21. else if($_REQUEST['command']=='update'){
  22. $max=count($_SESSION['cart']);
  23. for($i=0;$i<$max;$i++){
  24. $id=$_SESSION['cart'][$i]['id'];
  25. $q=intval($_REQUEST['qty'.$id]);
  26. if($q>0 && $q<=999){
  27. $_SESSION['cart'][$i]['qty']=$q;
  28. }
  29. else{
  30. $msg='Some proudcts not updated!, quantity must be a number between 1 and 999';
  31. }
  32. }
  33. }
  34.  
  35. if(isset($_REQUEST['order']))
  36. {
  37.  
  38. $email=$_SESSION['email'];
  39. $uid=$_SESSION['id'];
  40. $size=$_POST['size'];
  41.  
  42. $total=$_POST['total'];
  43. $length = count($_POST['product']);
  44. for($i=0; $i<$length; $i++) {
  45. $queryproduct=mysql_query("INSERT INTO shoppingcart VALUES ('','','".$_POST['ids'][$i]."','$uid','$email','".$_POST['itemcode'][$i]."','".$_POST['product'][$i]."','".$_POST['image'][$i]."','".$_POST['price'][$i]."','$size','".$_POST['qty'][$i]."','".$_POST['amt'][$i]."','$total')") or die("Order Query Problem");
  46. }
  47. }
  48.  
  49. if($queryproduct)
  50. {
  51. header('Location:login.php');
  52. }
  53. else
  54. {
  55. //header('Location:shoppingcart.php');
  56. }
  57.  
  58.  
  59. ?>
  60. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  61. <html xmlns="http://www.w3.org/1999/xhtml"><head>
  62. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  63. <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE9" />
  64. <title>EDGE.PK</title>
  65.  
  66.  
  67. <script language="javascript">
  68. function del(id){
  69. if(confirm('Do you really mean to delete this item')){
  70. document.form1.id.value=id;
  71. document.form1.command.value='delete';
  72. document.form1.submit();
  73. }
  74. }
  75. function clear_cart(){
  76. if(confirm('This will empty your shopping cart, continue?')){
  77. document.form1.command.value='clear';
  78. document.form1.submit();
  79. }
  80. }
  81. function update_cart(){
  82. document.form1.command.value='update';
  83. document.form1.submit();
  84. }
  85.  
  86.  
  87. </script>
  88.  
  89.  
  90. <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
  91. <script type="text/javascript" src="topslider/lib/jquery.jcarousel.min.js"></script>
  92. <link rel="stylesheet" type="text/css" href="topslider/css/skin.css" />
  93. <link rel="stylesheet" type="text/css" href="topslider/css/product-slider-skin.css" />
  94. <script type="text/javascript">
  95. function redirectWithValues() {
  96. var sStr2 = "search.php?color="+ encodeURI(document.color1.color.value);
  97. window.location.href = sStr2;
  98. return false;
  99. }
  100. </script>
  101.  
  102.  
  103.  
  104. <style>
  105.  
  106. .button1{
  107. background-color:#000;
  108. color:#FFF;
  109. width: 150px;
  110. height: 35px;
  111. padding: 9px 10px 10px 0px;
  112. margin-left: -12px;
  113. font-family:Arial,Helvetica,sans-serif;
  114. font-size:12px;
  115. }
  116.  
  117.  
  118. .button2{
  119. background-color:#000;
  120. color:#FFF;
  121. width: 96px;
  122. height: 35px;
  123. padding: 9px 6px 10px 0px;
  124. margin-left: -12px;
  125. font-family:Arial,Helvetica,sans-serif;
  126. font-size:12px;
  127.  
  128. }
  129.  
  130. .button3{
  131. background-color:#000;
  132. color:#FFF;
  133. width: 111px;
  134. height: 35px;
  135. padding: 9px 10px 10px 0px;
  136. margin-left: -12px;
  137. font-family:Arial,Helvetica,sans-serif;
  138. font-size:12px;
  139.  
  140. }
  141.  
  142. .button4{
  143. background-color:#000;
  144. color:#FFF;
  145. width: 100px;
  146. height: 35px;
  147. padding: 9px 1px 10px 0px;
  148. margin-left: -12px;
  149. font-family:Arial,Helvetica,sans-serif;
  150. font-size:12px;
  151.  
  152. }
  153.  
  154. .button5{
  155. background-color:#000;
  156. color:#FFF;
  157. width: 100px;
  158. height: 35px;
  159. padding: 9px 1px 10px 0px;
  160. margin-left: -12px;
  161. font-family:Arial,Helvetica,sans-serif;
  162. font-size:12px;
  163.  
  164. }
  165.  
  166. </style>
  167.  
  168. <!-- CSS =====================================================================================-->
  169. <link href='http://fonts.googleapis.com/css?family=Telex' rel='stylesheet' type='text/css' />
  170. <link rel="stylesheet" type="text/css" href="products2/css/styles.css" media="all" />
  171. <link rel="stylesheet" type="text/css" href="products2/css/skin.css" media="all" />
  172. <link rel="stylesheet" type="text/css" href="products2/css/cloud-zoom.css" media="all" />
  173. <link rel="stylesheet" type="text/css" href="products2/css/light_box.css" media="all" />
  174. <link rel="stylesheet" type="text/css" href="products2/css/mix.css" media="all" />
  175. <link rel="stylesheet" type="text/css" href="products2/css/banner.css" media="all" />
  176. <link rel="stylesheet" type="text/css" href="products2/css/magicat.css" media="all" />
  177. <script type="text/javascript" src="products2/js/jquery.mix.js"></script>
  178. <link rel="stylesheet" href="products/css/main-stylesheet.css" type="text/css" />
  179. <!-- Scripts =====================================================================================-->
  180.  
  181. <link rel="stylesheet" type="text/css" href="tipuesearch/example.css">
  182. <link rel="stylesheet" type="text/css" href="tipuesearch/tipuesearch.css">
  183. <div id="fb-root"></div>
  184. <script>(function(d, s, id) {
  185. var js, fjs = d.getElementsByTagName(s)[0];
  186. if (d.getElementById(id)) return;
  187. js = d.createElement(s); js.id = id;
  188. js.src = "//connect.facebook.net/en_US/all.js#xfbml=1&appId=261350910648005";
  189. fjs.parentNode.insertBefore(js, fjs);
  190. }(document, 'script', 'facebook-jssdk'));</script>
  191. <link href="css/style.css" rel="stylesheet" type="text/css" />
  192. <link href="css/nav-menus.css" rel="stylesheet" type="text/css" />
  193. <link href="css/jqtransform.css" rel="stylesheet" type="text/css" />
  194.  
  195. <script type="text/javascript" src="js/stuHover.js"></script>
  196. <script type="text/javascript" src="js/jquery.flow.1.2.auto.js"></script>
  197. <script type="text/javascript">
  198. $(document).ready(function(){
  199. $("#myController").jFlow({
  200. slides: "#slides",
  201. controller: ".jFlowControl", // must be class, use . sign
  202. slideWrapper : "#jFlowSlide", // must be id, use # sign
  203. selectedWrapper: "jFlowSelected", // just pure text, no sign
  204. auto: true, //auto change slide, default true
  205. width: "575px",
  206. height: "530px",
  207. duration: 600,
  208. prev: ".jFlowPrev", // must be class, use . sign
  209. next: ".jFlowNext" // must be class, use . sign
  210. });
  211. });
  212. </script>
  213. <STYLE TYPE="text/css">
  214. <!--
  215. #dek {POSITION:absolute;VISIBILITY:hidden;Z-INDEX:200;}
  216. //-->
  217. </STYLE>
  218. <style>
  219. body {overflow-x:hidden;}
  220. #tabMenu {margin:0;padding:0 0 0 15px;list-style:none;}
  221. #tabMenu li {float:left;height:39px;;width:39px;cursor:pointer;cursor:hand;margin-top:16px;background-color: black;margin-left: -14px;}
  222. li.posts {background:url(images/home.png) no-repeat 0 -32px;}
  223. li.mouseover {background-position:0 0;}
  224. li.mouseout {background-position:0 -32px;}
  225. li.selected {background-position:0 0;}
  226. .box {width:545px}
  227. *html .boxTop {margin-bottom:-2px;}
  228. .boxBody {background-color:#282828;}
  229. .boxBody div {display:none;}
  230. .boxBody div.show {display:block;}
  231. .boxBody #category a {display:block;}
  232. *html .boxBody div ul {margin-left:10px;padding-left:15px;}
  233. .boxBody div li {border-bottom:1px dotted #8e8e8e; padding:4px 0;cursor:hand;cursor:pointer;}
  234. .boxBody div ul li.last {border-bottom:none}
  235. .boxBody div li span {font-size:8px;font-style:italic; color:#888;}
  236. #three_columns .content.clearfix .main_content div table tr td {
  237. font-family: Verdana, Geneva, sans-serif;
  238. }
  239. </style>
  240. </head>
  241. <body>
  242. <div class="wrap" id="three_columns" style="height:250px !important">
  243. <?php include('top-header.php');?>
  244. <?php include('menu.php'); ?>
  245. <div style="width:50px;"><img src="images/signup.png" style="margin-left:1px; margin-top:-19px;" />
  246. <div style="margin-left: 460px; margin-top: -36px;"> <div class="box newsletter_box">
  247. <form action="01-Red-01-Home-Page.html">
  248. <input name="email" type="text" tabindex="1" onblur="if (this.value==''){this.value='E-mail Address'};" onfocus="if(this.value=='E-mail Address'){this.value=''};" value="E-mail Address" style="margin-top: 5px;" />
  249. <div align="right">
  250. <input name="subscribe" type="submit" value="Subscribe" class="button" />
  251. </div>
  252. </form>
  253. </div></div></div>
  254. <div class="content clearfix">
  255. <?php include('left_column.php'); ?>
  256.  
  257. <form name="form1" method="post">
  258. <input type="hidden" name="id" />
  259. <input type="hidden" name="command" />
  260.  
  261.  
  262.  
  263.  
  264. <div class="main_content">
  265. <div align="center">
  266.  
  267.  
  268. <table style="background-color:#F0F0F0; border:solid 1px; width:800px;">
  269. <?php
  270. if(is_array($_SESSION['cart'])){
  271. echo '<tr bgcolor="#FFFFFF" style="font-weight:bold"><td align="center"><font style="font-family:Arial,Helvetica,sans-serif; font-size:14px; color:#000;">Product Name</font></td>
  272. <td align="center"><font style="font-family:Arial,Helvetica,sans-serif; font-size:14px; color:#000;">Product Image</font></td>
  273. <td><font style="font-family:Arial,Helvetica,sans-serif; font-size:14px; color:#000;">Price</font></td>
  274. <td><div style="margin-left:27px;"><font style="font-family:Arial,Helvetica,sans-serif; font-size:14px; color:#000;">Size</font></div></td>
  275. <td><font style="font-family:Arial,Helvetica,sans-serif; font-size:14px; color:#000;">Amount</font></td>
  276. <td><font style="font-family:Arial,Helvetica,sans-serif; font-size:14px; color:#000;">Options</font></td></tr>';
  277. $max=count($_SESSION['cart']);
  278. for($i=0;$i<$max;$i++){
  279. $id=$_SESSION['cart'][$i]['id'];
  280. $products=$_SESSION['cart'][$i]['product'];
  281. $q=$_SESSION['cart'][$i]['qty'];
  282. $product=get_product_name($id);
  283. $image=get_product_image($id);
  284. $ids=get_id($id);
  285. $itemcode=get_itemcode($id);
  286. if($q==0) continue;
  287.  
  288.  
  289. ?>
  290. <tr bgcolor="#FFFFFF"><td align="center"><font style="font-family:Arial,Helvetica,sans-serif; font-size:15px; color:#000;"><input type="hidden" name="itemcode[]" value="<?php echo $itemcode?>" /><input type="hidden" name="ids[]" value="<?php echo $ids?>" /><input type="hidden" name="product[]" value="<?php echo $product?>" /><?php echo $product?></font></td><td align="center"><input type="hidden" name="image[]" id="image" value="<?php echo $image?>" /><img name="image" id="image" src="admin/uploads/small0_<?php echo $image?>" width="150" height="150"></td>
  291. <td><font style="font-family:Arial,Helvetica,sans-serif; font-size:15px; color:#000;"><input type="hidden" name="price[]" id="price" value="<?php echo get_price($id)?>" />Rs.<?php echo get_price($id)?></font></td>
  292. <td><?php //echo $size ?><input type="hidden" name="size" value="<?php //echo $size?>" /></td>
  293. <td><font style="font-family:Arial,Helvetica,sans-serif; font-size:15px; color:#000;"><input type="hidden" name="amt[]" value="<?php echo get_price($id)*$q?>"/> Rs.<?php echo get_price($id)*$q?></font></td>
  294. <td><font style="font-family:Arial,Helvetica,sans-serif; font-size:15px; color:#000;"><a href="javascript:del(<?php echo $id?>)"><input type="button" class="button5" value="Remove" /></a></font></td></tr>
  295. <?php
  296. }
  297. ?>
  298.  
  299. <tr><td colspan="6" align="right"><b><font style="font-family:Arial,Helvetica,sans-serif; font-size:15px; color:#000;"><input type="hidden" name="total" id="total" value="<?php echo get_order_total()?>" />Order Total: Rs.<?php echo get_order_total()?></font></b></td></tr>
  300. <tr><td colspan="6" align="right"><font style="font-family:Arial,Helvetica,sans-serif; font-size:14px; color:#000; !important">Cash On Delivery & Free Shipping</font></td></tr>
  301. <tr><td colspan="6" align="right"><?php $query1=mysql_query("SELECT * FROM category ORDER BY id ") or die ('Product Query Problem');
  302. $row4=mysql_fetch_array($query1);$ids=$row4['id'];$cat_name=$row4['categories'];?><input type="button" class="button1" value="Continue Shopping" onclick="window.location='product.php'" /><input type="button" class="button2" value="Clear Cart" onclick="clear_cart()"><input type="button" class="button3" value="Update Cart" onclick="update_cart()"><input type="submit" class="button4" name="order" id="order" value="Place Order"></td></tr>
  303. <?php
  304. }
  305. else{
  306. echo "<tr bgColor='#FFFFFF'><td><font style='font-family:Arial,Helvetica,sans-serif; font-size:15px; color:#000;'>There are no items in your shopping cart!</font></td>";
  307. }
  308. ?>
  309. </table>
  310. </div>
  311.  
  312. </div></form>
  313.  
  314. </div>
  315. <div id="wrap">
  316. <div id="products" class="jcarousel-skin-tango">
  317. <div class="jcarousel-clip">
  318.  
  319. <?php
  320. $directory= "data/uploads/topslider/";
  321. echo '<ul class="jcarousel-list">';
  322. foreach(glob($directory . '*') as $filename) {
  323. echo '<li class="jcarousel-item"><img src="'.$filename.'" width="150" height="150" alt="" /></li>';
  324. }
  325. echo '</ul>';
  326. ?>
  327.  
  328.  
  329. </div>
  330. <div disabled="disabled" class="jcarousel-prev jcarousel-prev-disabled"></div>
  331. <div class="message"><div class="text">EDGE.PK<br/><span style="font-size:19px;letter-spacing: -1px; ">Top
  332.  
  333. Products</span><br/><span style="font-size:10px;letter-spacing: 4px; ">.............</span></div></div>
  334. <div class="jcarousel-next"></div>
  335. </div>
  336. </div>
  337. <?php include('footer.php'); ?>
  338. </div>
  339. <script type="text/javascript">
  340.  
  341. jQuery(document).ready(function() {
  342.  
  343. jQuery('#products').jcarousel({
  344. start: 1
  345. });
  346. });
  347.  
  348. </script>
  349.  
  350.  
  351. </body>
  352. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement