<?php include "common/user_log.php"; ?>
<?php 


$sql_price = "SELECT * FROM currency_rate";
$result_price = mysqli_query($conn, $sql_price);
$row_price = mysqli_fetch_assoc($result_price);

$price_d = $row_price['rate_hold'];

//$p_id = htmlspecialchars(trim($_GET['id']), ENT_QUOTES, 'UTF-8');

$records_per_page = 18;
require 'pagination/pagination.php';
$page_blog = new Zebra_Pagination();


$sqlb = "
SELECT
items.item_name,
items.id,
items.cat_id,
items.sub_cat_id,
items.item_code,
items.price,
items.discription,
items.tag_text,
items.description_more,
items.f_img,
items.`user`,
items.featue_pro,
items.new_pro
FROM
items
WHERE soled_out = 0
AND same_delivery = 1
ORDER BY 

id ASC
LIMIT
" . (($page_blog->get_page() - 1) * $records_per_page) . ', ' . $records_per_page . '
';

if (!($resultb = @mysqli_query($conn, $sqlb))) {
	die(mysqli_error($conn));
}

$rows = mysqli_fetch_assoc(mysqli_query($conn, 'SELECT FOUND_ROWS() AS rowsb'));
$page_blog->records($rows['rowsb']);
$page_blog->records_per_page($records_per_page);

$rowu = mysqli_fetch_array($resultb);

?>

<!DOCTYPE html>
<html lang="en">

<head>
	<!-- Meta -->
	<meta charset="utf-8">
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
	<meta name="description" content="">
	<meta name="author" content="">
	<meta name="keywords" content="MediaCenter, Template, eCommerce">
	<meta name="robots" content="all">

	<title>Sampathbay</title>
	<!-- Place favicon.ico in the root directory -->
   <link rel="shortcut icon" type="image/x-icon" href="../img/S_favicon.ico"> 
	<!-- <link rel=icon href="assets/images/favicon.ico" type="image/x-icon"/> -->
	<link rel="shortcut icon" href="assets/images/favicon.ico" type="image/x-icon"/>


	<!-- Bootstrap Core CSS -->
	<link rel="stylesheet" href="assets/css/bootstrap.min.css">

	<!-- Customizable CSS -->
	<link rel="stylesheet" href="assets/css/main.css">
	<link rel="stylesheet" href="assets/css/blue.css">
	<link rel="stylesheet" href="assets/css/owl.carousel.css">
	<link rel="stylesheet" href="assets/css/owl.transitions.css">
	<link rel="stylesheet" href="assets/css/animate.min.css">
	<link rel="stylesheet" href="assets/css/rateit.css">
	<link rel="stylesheet" href="assets/css/bootstrap-select.min.css">
	<link rel="stylesheet" href="pagination/public/css/zebra_pagination.css">




	<!-- Icons/Glyphs -->
	<link rel="stylesheet" href="assets/css/font-awesome.css">

	<!-- Fonts --> 
	<link href='http://fonts.googleapis.com/css?family=Roboto:300,400,500,700' rel='stylesheet' type='text/css'>
	<link href='https://fonts.googleapis.com/css?family=Open+Sans:400,300,400italic,600,600italic,700,700italic,800' rel='stylesheet' type='text/css'>
	<link href='https://fonts.googleapis.com/css?family=Montserrat:400,700' rel='stylesheet' type='text/css'>


	<script src="assets/js/jquery-1.11.1.min.js"></script>
	
	<script src="assets/js/bootstrap.min.js"></script>

	<script src="assets/js/bootstrap-hover-dropdown.min.js"></script>
	<script src="assets/js/owl.carousel.min.js"></script>

	<script src="assets/js/echo.min.js"></script>
	<script src="assets/js/jquery.easing-1.3.min.js"></script>
	<script src="assets/js/bootstrap-slider.min.js"></script>
	<script src="assets/js/jquery.rateit.min.js"></script>
	<script type="text/javascript" src="assets/js/lightbox.min.js"></script>
	<script src="assets/js/bootstrap-select.min.js"></script>
	<script src="assets/js/wow.min.js"></script>
	<script src="assets/js/scripts.js"></script>
	<script type="text/javascript" src="pagination/public/javascript/zebra_pagination.js"></script>

</head>
<body class="cnt-home">
	<style type="text/css">
		.cart_adding {
			width: 100%;
			height: 100%;
			top: 0;
			left: 0;
			position: fixed;
			display: block;
			opacity: 0.7;
			background-color: #fff;
			z-index: 9999;
			text-align: center;
		}
		.page_loader {
			width: 100%;
			height: 100%;
			top: 0;
			left: 0;
			position: fixed;
			display: block;
			opacity: 1;
			background-color: #fff;
			z-index: 9999;
			text-align: center;
		}

		.loading-image {
			display:block;
			margin:auto;
			margin-top: 250px;
			z-index: 100;
		}

	</style>
	<div class="page_loader">
		<div style="background: url(assets/images/loading_add_cart.gif) no-repeat center center; width: 100%; height: 100%; background-size: 115px;">
		</div>
	</div>
	<!-- ============================================== HEADER ============================================== -->
	<!-- Header -->
	<?php include 'common/header.php'; ?>
	<!-- End Header -->

	<!-- ============================================== HEADER : END ============================================== -->

	<!-- ============================================== HEADER : END ============================================== -->
	<div class="breadcrumb">
		<div class="container">
			<div class="breadcrumb-inner">
				<ul class="list-inline list-unstyled">
					<li><a href="#">Home</a></li>
					<li class='active'>Today Offers</li>
				</ul>
			</div><!-- /.breadcrumb-inner -->
		</div><!-- /.container -->
	</div><!-- /.breadcrumb -->
	<div class="body-content outer-top-xs">
		<div class='container'>
			<div class='row'>
				<!-- Side Bar -->
				<?php include 'common/side-bar.php'; ?>
				<!-- End Side Bar -->

				<div class='col-md-9'> 
								<div class="row">
									<div class="col-xs-12 col-sm-12 col-md-12 homebanner-holder outer-top-xs" style="margin-top: 0;">
										<div id="hero">
											<div id="owl-main" class="owl-carousel owl-inner-nav owl-ui-sm">
												<?php
												$sql="SELECT * FROM today_offers_banner DESE";
												$result=mysqli_query($conn, $sql);

												$xx=0;
												while ($row = mysqli_fetch_array($result)){ ?>
													<div class="item" style="background-image: url(backend/upload/today_offers_banner/<?php echo $row['img_name']; ?>);">
														<div class="container-fluid">
															<div class="caption bg-color vertical-center text-left">
																<div class="slider-header fadeInDown-1"><?php echo $row['sub_title']; ?> </div>
																<div class="big-text fadeInDown-1"> <?php echo $row['main_title']; ?> </div>
																<div class="excerpt fadeInDown-2 hidden-xs"> <span><?php echo $row['description']; ?></span> </div>
								                            <!-- <div class="button-holder fadeInDown-3">
								                      <a href="index6c11.html?page=single-product" class="btn-lg btn btn-uppercase btn-primary shop-now-button">Shop Now</a>
								                  </div> --> 
								              </div>
								              <!-- /.caption --> 
								          </div>
								          <!-- /.container-fluid --> 
								      </div>
								      <!-- /.item -->

								  <?php } ?>
								</div>
								<!-- /.owl-carousel --> 
							</div>
							<div class="info-boxes wow fadeInUp">
								<div class="info-boxes-inner">
									<div class="row">
										<div class="col-md-12 col-sm-12 col-lg-12">
											<div class="info-box">
												<h6 class="text">
													<?php

													$txt_same_file = 'backend/upload/page_content/txt_today.txt';
													$txt_same = '';

													if (file_exists($txt_same_file)) {
														$myfile = fopen($txt_same_file, "r");

														$itm_dis = fgets($myfile);

														echo $txt_same = $itm_dis;
													}

													?>
												</h6>
											</div>
										</div>
										<!-- .col --> 
									</div>
									<!-- /.row --> 
								</div>
								<!-- /.info-boxes-inner --> 

							</div>
						</div>
					</div>
					<div class="clearfix filters-container"> 
						<div class="row">
							<div class="col col-sm-6 col-md-2"> 
								<div class="filter-tabs"> 
									<ul id="filter-tabs" class="nav nav-tabs nav-tab-box nav-tab-fa-icon">
										<li class="active"> <a data-toggle="tab" href="#grid-container"><i class="icon fa fa-th-large"></i>Grid</a> 
										</li>
										<li><a data-toggle="tab" href="#list-container"><i class="icon fa fa-th-list"></i>List</a></li>
									</ul>
								</div>
								<!-- /.filter-tabs -->
							</div>
							<!-- /.col -->
							<div class="col col-sm-12 col-md-6"> 

							</div>
							<!-- /.col -->

							<!-- /.col -->
						</div>
						<!-- /.row -->
					</div>
					<div class="search-result-container "> 
						<div id="myTabContent" class="tab-content category-list"> 
							<div class="tab-pane active " id="grid-container"> 
								<div class="category-product"> 
									<div class="row"> 
										<?php
										$resultb = @mysqli_query($conn, $sqlb);
										while ($rowu = mysqli_fetch_array($resultb)) {


											?>
											<div class="col-sm-6 col-md-4 wow fadeInUp"> 
												<div class="products">
													<div class="product">		
														<div class="cart_adding" style="display: none; ">
															<!-- <img id="loading-image" src="img/loader.gif" alt="Loading..." /> -->
															<div style="background: url(assets/images/loading_add_cart.gif) no-repeat center center; width: 100%; height: 100%; background-size: 70px 70px;">
															</div>
														</div>
														<div class="product-image">
															<div class="image">
																<a href="detail.php?id=<?php echo $rowu['id'];?>&subcat=<?php echo $rowu['sub_cat_id'];?>"><img  src="backend/upload/item/<?php echo $rowu['item_code']; ?>/<?php echo $rowu['f_img']; ?>" alt=""></a>
															</div><!-- /.image -->			

															<?php if (!empty($rowu['tag_text'])) {?>
																<div class="tag new"><span><?php echo $rowu['tag_text']; ?></span></div>  
															<?php } ?>
														</div><!-- /.product-image -->


														<div class="product-info text-left">
															<h3 class="name"><a href="detail.php?id=<?php echo $rowu['id'];?>&subcat=<?php echo $rowu['sub_cat_id'];?>"><?php echo $rowu['item_name']; ?></a></h3>
															<?php

															$sql_ratings="SELECT * FROM avg_review_cal WHERE itm_id = '".$rowu['id']."'";
															$result_ratings=mysqli_fetch_array(mysqli_query($conn, $sql_ratings));

															$value = $result_ratings['avg_cont'];

															if (round($value) == 0) {
																echo "<img src='image/ratings/0.png' style='max-height: 15px;''>";
															}
															if (round($value) == 1) {
																echo "<img src='image/ratings/1.png' style='max-height: 15px;''>";
															}
															if (round($value) == 2) {
																echo "<img src='image/ratings/2.png' style='max-height: 15px;''>";
															}
															if (round($value) == 3) {
																echo "<img src='image/ratings/3.png' style='max-height: 15px;''>";
															}
															if (round($value) == 4) {
																echo "<img src='image/ratings/4.png' style='max-height: 15px;''>";
															}
															if (round($value) == 5) {
																echo "<img src='image/ratings/5.png' style='max-height: 15px;''>";
															}

															?>
															<div class="description"></div>

															<div class="product-price">	
																<span class="price">
																	Rs:<?php echo $rowu['price'];?>
																</span>
																<span class="price-before-discount">($<?php echo number_format($rowu['price']/$price_d,2); ?>)</span>
															</div><!-- /.product-price -->

														</div><!-- /.product-info -->
														<div class="cart clearfix animate-effect">
															<div class="action">
																<ul class="list-unstyled">
																	<li class="add-cart-button btn-group">
																		<?php if (isset($_SESSION['normal_user'])) { ?>

																			<button data-id-product="<?php echo $rowu['id']; ?>" data-toggle="tooltip" class="btn btn-primary icon btn-cart" type="button" title="Add Cart">
																				<i class="fa fa-shopping-cart"></i>
																			</button>

																		<?php }else{ ?>

																			<button data-id-product="<?php echo $rowu['id']; ?>" data-toggle="tooltip" class="btn btn-primary icon btn-cart-tmp" type="button" title="Add Cart">
																				<i class="fa fa-shopping-cart"></i>
																			</button>

																		<?php } ?>
																		<!-- <button class="btn btn-primary cart-btn" type="button">Add to cart</button> -->
																	</li>

																	<?php if (isset($_SESSION['normal_user'])) { ?>

																		<li class="lnk wishlist dialogMe" data-itm-id = "<?php echo $rowu['id']; ?>">
																			<a data-toggle="tooltip" class="add-to-cart " style="cursor: pointer;" title="Rating">
																				<i class="icon fa fa-heart"></i>
																			</a>
																		</li>

																	<?php }else{ ?>

																		<li class="lnk" data-itm-id = "<?php echo $rowu['id']; ?>">
																			<a data-toggle="tooltip" class="add-to-cart " style="cursor: pointer;" title="Wishlist">
																				<i class="icon fa fa-heart"></i>
																			</a>
																		</li>

																	<?php } ?>
																</ul>
															</div><!-- /.action -->
														</div><!-- /.cart -->
													</div><!-- /.product -->

												</div><!-- /.products -->
											</div>
											<!-- /.item -->
										<?php } ?>
										<div class="row">
											<div class="col-md-12">
		              	<?php // render the pagination links
		              	$page_blog->render();
		              	?>
		              </div>
		          </div>
		      </div>
		      <!-- /.row -->
		  </div>
		  <!-- /.category-product -->
		</div>
		<!-- /.tab-pane -->
		<div class="tab-pane "  id="list-container"> 
			<div class="category-product"> 


				<?php
				$resultb2 = @mysqli_query($conn, $sqlb);
				while ($rowu = mysqli_fetch_array($resultb2)) {
					?>

					<div class="category-product-inner wow fadeInUp"> 
						<div class="products"> 
							<div class="product-list product"> 
								<div class="row product-list-row"> 
									<div class="col col-sm-4 col-lg-4"> 
										<div class="product-image"> 
											<div class="image"> <img src="backend/upload/item/<?php echo $rowu['item_code']; ?>/<?php echo $rowu['f_img']; ?>" alt=""> 
											</div>
										</div>
										<!-- /.product-image -->
									</div>
									<!-- /.col -->
									<div class="col col-sm-8 col-lg-8"> 
										<div class="product-info"> 
											<h3 class="name"><a href="detail.php?id=<?php echo $rowu['id'];?>&subcat=<?php echo $rowu['sub_cat_id'];?>"><?php echo $rowu['item_name']; ?></a></h3>
											<?php

											$sql_ratings="SELECT * FROM avg_review_cal WHERE itm_id = '".$rowu['id']."'";
											$result_ratings=mysqli_fetch_array(mysqli_query($conn, $sql_ratings));

											$value = $result_ratings['avg_cont'];

											if (round($value) == 0) {
												echo "<img src='image/ratings/0.png' style='max-height: 15px;''>";
											}
											if (round($value) == 1) {
												echo "<img src='image/ratings/1.png' style='max-height: 15px;''>";
											}
											if (round($value) == 2) {
												echo "<img src='image/ratings/2.png' style='max-height: 15px;''>";
											}
											if (round($value) == 3) {
												echo "<img src='image/ratings/3.png' style='max-height: 15px;''>";
											}
											if (round($value) == 4) {
												echo "<img src='image/ratings/4.png' style='max-height: 15px;''>";
											}
											if (round($value) == 5) {
												echo "<img src='image/ratings/5.png' style='max-height: 15px;''>";
											}

											?>
											<div class="product-price"> <span class="price">Rs: <?php echo $rowu['price']; ?>
										</span> <span class="price-before-discount">($ <?php echo number_format($rowu['price']/$price_d,2); ?>)</span> 
									</div>
									<!-- /.product-price -->
									<div class="description m-t-10"><?php echo $rowu['discription']; ?></div>
									<div class="cart clearfix animate-effect"> 
										<div class="action"> 
											<ul class="list-unstyled">
												<li class="add-cart-button btn-group"> 
													<?php
													if (isset($_SESSION['normal_user'])) {
														?>
														<!-- <a type="button" data-id-product="<?php echo $p_id; ?>" class="btn btn-default btn_add_cart2 btn_cart_add" style="border-color: #62c11f; border-style: solid;border-width: 2px;">Add to Cart</a> -->

														<div class="col-sm-7"> <a data-id-product="<?php echo $rowu['id']; ?>" class="btn btn-primary btn_cart_add" id="btn_add_cart"><i class="fa fa-shopping-cart inner-right-vs"></i> 
														ADD TO CART</a> <span id="stocl_val_msg" style="display: none; "><font color="red">*Out of Stock</font></span></div>

														<?php
													}else{
														?>
														<!-- <a class="btn btn-default btn_add_tmp btn_add_cart2" data-id-product="<?php echo $p_id; ?>" style="border-color: #62c11f; border-style: solid;border-width: 2px;">Add to Cart</a> -->

														<div class="col-sm-7"> <a data-id-product="<?php echo $rowu['id']; ?>" class="btn btn-primary btn_add_tmp" id="btn_add_cart"><i class="fa fa-shopping-cart inner-right-vs btn_cart_add"></i> 
														ADD TO CART</a> <span id="stocl_val_msg" style="display: none; "><font color="red">*Out of Stock</font></span></div>
														<?php
													}
													?>
												</li>
												<li class="lnk"> 
													<a data-toggle="tooltip" class="add-to-cart " style="cursor: pointer;" title="Rate It">
														<i class="icon fa fa-heart"></i>
													</a>
												</li>

											</ul>
										</div>
										<!-- /.action -->
									</div>
									<!-- /.cart -->
								</div>
								<!-- /.product-info -->
							</div>
							<!-- /.col -->
						</div>
						<!-- /.product-list-row -->
						<?php if (!empty($rowu['tag_text'])) {?>
							<div class="tag new"><span><?php echo $rowu['tag_text']; ?></span></div>
						<?php } ?>
					</div>
					<!-- /.product-list -->
				</div>
				<!-- /.products -->
			</div>
			<!-- /.category-product-inner -->

		<?php } ?>
		<div class="row">
			<div class="col-md-12">
	              	<?php // render the pagination links
	              	$page_blog->render();
	              	?>
	              </div>
	          </div>
	      </div>
	      <!-- /.category-product -->
	  </div>
	  <!-- /.tab-pane #list-container -->
	</div>
	<!-- /.tab-content -->
          <!-- <div class="clearfix filters-container"> 
            <div class="text-right"> 
              <div class="pagination-container"> 
                <ul class="list-inline list-unstyled">
                  <li class="prev"><a href="#"><i class="fa fa-angle-left"></i></a></li>
                  <li><a href="#">1</a></li>
                  <li class="active"><a href="#">2</a></li>
                  <li><a href="#">3</a></li>
                  <li><a href="#">4</a></li>
                  <li class="next"><a href="#"><i class="fa fa-angle-right"></i></a></li>
                </ul>
              </div>
            </div>
        </div> -->
    </div>
    <!-- /.search-result-container -->
</div>
<!-- /.col -->
</div><!-- /.row -->
<!-- ============================================== BRANDS CAROUSEL ============================================== -->
<div id="brands-carousel" class="logo-slider wow fadeInUp">


	<div class="logo-slider-inner">	
		<div id="brand-slider" class="owl-carousel brand-slider custom-carousel owl-theme">
			<div class="item m-t-15">
				<a href="#" class="image">
					<img data-echo="assets/images/brands/brand1.png" src="assets/images/blank.gif" alt="">
				</a>	
			</div><!--/.item-->

			<div class="item m-t-10">
				<a href="#" class="image">
					<img data-echo="assets/images/brands/brand2.png" src="assets/images/blank.gif" alt="">
				</a>	
			</div><!--/.item-->

			<div class="item">
				<a href="#" class="image">
					<img data-echo="assets/images/brands/brand3.png" src="assets/images/blank.gif" alt="">
				</a>	
			</div><!--/.item-->

			<div class="item">
				<a href="#" class="image">
					<img data-echo="assets/images/brands/brand4.png" src="assets/images/blank.gif" alt="">
				</a>	
			</div><!--/.item-->

			<div class="item">
				<a href="#" class="image">
					<img data-echo="assets/images/brands/brand5.png" src="assets/images/blank.gif" alt="">
				</a>	
			</div><!--/.item-->

			<div class="item">
				<a href="#" class="image">
					<img data-echo="assets/images/brands/brand6.png" src="assets/images/blank.gif" alt="">
				</a>	
			</div><!--/.item-->

			<div class="item">
				<a href="#" class="image">
					<img data-echo="assets/images/brands/brand2.png" src="assets/images/blank.gif" alt="">
				</a>	
			</div><!--/.item-->

			<div class="item">
				<a href="#" class="image">
					<img data-echo="assets/images/brands/brand4.png" src="assets/images/blank.gif" alt="">
				</a>	
			</div><!--/.item-->

			<div class="item">
				<a href="#" class="image">
					<img data-echo="assets/images/brands/brand1.png" src="assets/images/blank.gif" alt="">
				</a>	
			</div><!--/.item-->

			<div class="item">
				<a href="#" class="image">
					<img data-echo="assets/images/brands/brand5.png" src="assets/images/blank.gif" alt="">
				</a>	
			</div><!--/.item-->
		</div><!-- /.owl-carousel #logo-slider -->
	</div><!-- /.logo-slider-inner -->
	
</div><!-- /.logo-slider -->
<!-- ============================================== BRANDS CAROUSEL : END ============================================== -->	</div><!-- /.container -->

</div><!-- /.body-content -->
<!-- ============================================================= FOOTER ============================================================= -->
<!-- Footer -->
<?php include 'common/footer.php'; ?>
<!-- End Footer -->
<!-- ============================================================= FOOTER : END============================================================= -->


<!-- For demo purposes – can be removed on production -->



<!-- For demo purposes – can be removed on production : End -->

<!-- JavaScripts placed at the end of the document so the pages load faster -->
<script src="assets/js/js_msgbox.js"></script>

<script type="text/javascript">

	$(document).ready(function () {
		$(".btn_cart_add").click(function () {
			var qty = $("#qty_val").val();
			add_to_cart($(this).attr('data-id-product'),qty);

			$.post('connection/index.php', {'cart_no': 'data'}, function (data) {
				$(".ajax_cart_quantity").text(data);
			});
			setTimeout(
				function() 
				{
					cart_data_load();
				}, 500);
			$(this).replaceWith( "<a class='btn btn-primary' style='background-color:#CF1275;' id='btn_add_cart'><i class='fa fa-shopping-cart inner-right-vs btn_cart_add'></i>ADDED TO CART</a>" );
			/*<a href = 'shopping-cart' style = 'margin:5px 0 0 10px'>View Cart</a>*/
		});
		$(".btn_add_tmp").click(function () {

			$.post('connection/tmp_cart.php', {'tmp_cat_add': 'data'}, function (data) {
                //$(".ajax_cart_quantity").text(data);
            });
			var qty = $("#qty_val").val();
			add_to_cart_temp($(this).attr('data-id-product'),qty);

			$.post('connection/index.php', {'cart_no': 'data'}, function (data) {
				$(".ajax_cart_quantity").text(data);
			});
			setTimeout(
				function() 
				{
					cart_data_load();
				}, 500);

            //$(this).css("background-color","red");
            $(this).replaceWith( "<a class='btn btn-primary' style='background-color:#CF1275;' id='btn_add_cart'><i class='fa fa-shopping-cart inner-right-vs btn_cart_add'></i>ADDED TO CART</a>" );
            /*<a href = 'shopping-cart' style = 'margin:5px 0 0 10px'>View Cart</a>*/
        });

	});

	function add_to_cart_temp(id,qty) {
		var data = [];
		var id_holder = $("#row_num_holder").val();
		for (i = 1; i <= id_holder ; i++) { 
			var col_name = $('#opp_'+i).attr('data-col-name');
            //alert(col_name);
            //data[col_name]= $('#opp_'+i).val();
            data.push({name:col_name,data:$('#opp_'+i).val()});
        }
        //console.log(data);
        $.post('connection/details_fun.php', {'add_to_cart_temp': 'data', id: id , qty:qty , arr : data }, function (data) {

        });
    }

    function add_to_cart(id,qty) {
    	var data = [];
    	var id_holder = $("#row_num_holder").val();
    	for (i = 1; i <= id_holder ; i++) { 
    		var col_name = $('#opp_'+i).attr('data-col-name');
            //alert(col_name);
            //data[col_name]= $('#opp_'+i).val();
            data.push({name:col_name,data:$('#opp_'+i).val()});
        }
        //console.log(data);
        $.post('connection/details_fun.php', {'add_to_cart': 'data', id: id , qty:qty , arr:data}, function (data) {

        });
    }

</script>

<script type="text/javascript">
	$(document).ready(function () {

		$(".btn-cart").click(function () {

			$(this).parents(".product").find(".cart_adding").css("display","block");

			add_to_cart($(this).attr('data-id-product'));

			$.post('connection/index.php', {'cart_no': 'data'}, function (data) {
				$(".count").text(data);
			});
			setTimeout(
				function() 
				{
					cart_data_load();
				}, 500);
			$(this).replaceWith( '<button data-toggle="tooltip" class="btn btn-primary icon" type="button" title="Added Cart"><i class="fa fa-cart-plus"></i></button>' );

			$(".cart_adding").fadeOut();

		});

		$(".btn-cart-tmp").click(function () {

			$(this).parents(".product").find(".cart_adding").css("display","block");

			$.post('connection/tmp_cart.php', {'tmp_cat_add': 'data'}, function (data) {
	                //$(".ajax_cart_quantity").text(data);
	            });

			add_to_cart_temp($(this).attr('data-id-product'));

			$.post('connection/index.php', {'cart_no': 'data'}, function (data) {
				$(".count").text(data);

			});
			setTimeout(
				function() 
				{
					cart_data_load();
				}, 500);

	            //$(this).css("background-color","red");
	            $(this).replaceWith( '<button data-toggle="tooltip" class="btn btn-primary icon" type="button" title="Added Cart"><i class="fa fa-cart-plus"></i></button>' );

	            $(".cart_adding").fadeOut();
	        });

	});

	$.post('connection/tmp_cart.php', {'tmp_cat_add': 'data'}, function (data) {
	        //$(".ajax_cart_quantity").text(data);
	    });

	function add_to_cart_temp(id) {
		$.post('connection/index.php', {'add_to_cart_temp': 'data', id: id}, function (data) {

		});
	}


	function add_to_cart(id) {
		$.post('connection/index.php', {'add_to_cart': 'data', id: id}, function (data) {

		});
	}


	$(window).load(function() {
		$(".page_loader").fadeOut("slow");;
	});

</script>



</body>

</html>