0){ $new_qty = $asc_check['qty'] + $qty; $new_price = $new_qty * $prodprice; $update = "update shop_cart set qty='$new_qty', totprice='$new_price' where productid = '$id' and session_id='".$browsessionid."'"; mysql_query($update); }else{ $totprice=$qty * $prodprice; $res=mysql_query("insert into shop_cart(`user_id`,`session_id`,`productid`, `qty`, `price`,`totprice`) values('".$_SESSION['id']."','$browsessionid','$id','1','".$_REQUEST['prodprice']."','".$totprice."')"); } }else{ $qty=1; // $Delete_Question = "DELETE FROM shop_cart WHERE productid='$id' and session_id='".$browsessionid."'"; // //$Result_Question = mysql_query($Delete_Question); // $totprice=$qty * $prodprice; // $res=mysql_query("insert into shop_cart(`user_id`,`session_id`,`productid`, `qty`, `price`,`totprice`) values('".$_SESSION['id']."','$browsessionid','$id','1','".$_REQUEST['prodprice']."','".$totprice."')"); $check_rows = "select qty from shop_cart where productid='$id' and session_id='".$browsessionid."'"; $mycheck = mysql_query($check_rows); $check_count = mysql_num_rows($mycheck); $asc_check = mysql_fetch_array($mycheck); if($check_count > 0){ $new_qty = $asc_check['qty'] - $qty; $new_price = $new_qty * $prodprice; if($new_qty == 0){ $delete = "delete from shop_cart where productid = '$id' and session_id='".$browsessionid."'"; mysql_query($delete); }else{ $update = "update shop_cart set qty='$new_qty', totprice='$new_price' where productid = '$id' and session_id='".$browsessionid."'"; mysql_query($update); } } } } $sql="select sum(qty) as qty from shop_cart where session_id='".$browsessionid."' "; $res=mysql_query($sql); $residue = mysql_fetch_array($res); $rows=mysql_num_rows($res); $objqrynewsubee = "SELECT SUM(totprice) AS amtTotal FROM shop_cart where session_id='$browsessionid'"; $objResultnewsubee = mysql_query($objqrynewsubee); $Fetchnewww = mysql_fetch_array($objResultnewsubee); $subtotal=$Fetchnewww['amtTotal']; ?>
0) { while($Fetitem = mysql_fetch_array($objitem)) { $menuid=$Fetitem['id']; $menuid_d_s=$Fetitem['productid']; $si=$si+1; $qty=$Fetitem['qty']; $objmenu=mysql_query("SELECT * from shop_product where product_id='$menuid_d_s'"); $resmenu=mysql_fetch_array($objmenu); $menuname=$resmenu['name']; $productprice=$resmenu['price']; $productprice_int=$resmenu['points']; $totprice=($qty*$resmenu['price']); $totprice_int=($qty*$resmenu['points']); $new_price +=$totprice; $country; $vstatus=$resmenu['vstatus']; $weight=$resmenu['stock_status_id']; $vid_type = $resmenu['v_s']; if($vid_type !=1){ if($weight=='' || $weight==0) { $weight=100; } } else{ $weight = 0; } if($new_status==1) { if($vstatus==1) { $v_qty=($qty/2); } if($vstatus==6) { $v_qty=($qty/2); } if($vstatus==7) { $v_qty=($qty/2); } if($vstatus==2) { $v_qty=($qty/4); } $x = (int)$v_qty; } else { $x=0; } $x; $new_qty=($weight*($qty+$x)); $new_kilo=($new_qty/1000); $new_kilo_1 = explode('.',$new_kilo); $new_kilo_2=$new_kilo_1[0]; // Before the Decimal point $new_kilo_3 +=$new_kilo_2; $totprice1 +=$totprice; $tot_weight_2 +=$new_qty; } } return $tot_weight_2; } ?>