<?php
include_once "includes/connectConfig.php";
$fndnm = gtAll("ktmmenu_name","", 'mname');
$chk_crt = getAll("my_cart"," session_rec = '$set_sess' ",' id ASC');
$post_url = (isset($_GET['kmt'])) ? $_GET['kmt'] : '';

$paginator_pg = (isset($_GET['pd'])) ? $_GET['pd'] : '';

$pdserch = (isset($_GET['sp'])) ? $_GET['sp'] : '';

$menu_url = (isset($_GET['kmm'])) ? $_GET['kmm'] : '';
$category_url = (isset($_GET['kcm'])) ? $_GET['kcm'] : '';
$sub_url = (isset($_GET['ksm'])) ? $_GET['ksm'] : '';
?>
<!DOCTYPE html>
<html class="no-js" lang="en">

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>K-Mart Groceries & More</title>
    <link href="https://fonts.googleapis.com/css?family=Cairo:400,600,700&amp;display=swap" rel="stylesheet">
    <link href="https://fonts.googleapis.com/css?family=Poppins:600&amp;display=swap" rel="stylesheet">
    <link href="https://fonts.googleapis.com/css?family=Playfair+Display:400i,700i" rel="stylesheet">
    <link href="https://fonts.googleapis.com/css?family=Ubuntu&amp;display=swap" rel="stylesheet">
    <link rel="shortcut icon" type="image/x-icon" href="img/kmart-icon.png"/>
    <link rel="stylesheet" type="text/css" href="css/bootstrap.min.css">
    <link rel="stylesheet" type="text/css" href="css/animate.min.css">
    <link rel="stylesheet" type="text/css" href="css/font-awesome.min.css">
    <link rel="stylesheet" type="text/css" href="css/nice-select.css">
    <link rel="stylesheet" type="text/css" href="css/slick.min.css">
    <link rel="stylesheet" type="text/css" href="css/style.css">
    <link rel="stylesheet" type="text/css" href="css/main-color.css">
	<link rel="stylesheet" type="text/css" href="css/styleset.css">
</head>


<body class="biolife-body">

    <!-- Preloader
    <div id="biof-loading">
        <div class="biof-loading-center">
            <div class="biof-loading-center-absolute">
                <div class="dot dot-one"></div>
                <div class="dot dot-two"></div>
                <div class="dot dot-three"></div>
            </div>
        </div>
    </div>
 -->
 
    <!-- HEADER -->
    <header id="header" class="header-area style-01 layout-03">
        <div class="header-top bg-main hidden-xs">
            <div class="container">
                <div class="top-bar left">
                    <ul class="horizontal-menu">
                        <li><a href="mailto:info@kmartgroceriesandmore.com"><i class="fa fa-envelope" aria-hidden="true"></i>info@kmartgroceriesandmore.com</a></li>
                        <li><a href="tel:+233530466020"><i class="fa fa-phone" aria-hidden="true"></i>0530466020</a></li>
                    </ul>
                </div>
                <div class="top-bar right">
                    <ul class="social-list">
                        <li><a href="https://www.instagram.com/kmartgroceries"  target="_blank"><i class="fa fa-instagram" aria-hidden="true"></i></a></li>
                        <li><a href="https://www.facebook.com/share/BYs8tm2o8e7951fR" target="_blank"><i class="fa fa-facebook" aria-hidden="true"></i></a></li>
                       
                    </ul>
                    <ul class="horizontal-menu">
                        
                        <li><a href="login" class="login-link"><i class="biolife-icon icon-login"></i>Login/Register</a></li>
                    </ul>
                </div>
            </div>
        </div>
        <div class="header-middle biolife-sticky-object ">
            <div class="container">
                <div class="row rowset">
                    <div class="col-lg-3 col-md-2 col-md-6 col-xs-6 text-lg-center text-md-left">
                        <a href="index" class="biolife-logo"><img src="img/kmart-logo.png" alt="K-Mart logo" ></a>
                    </div>
                    
					<div class="col-lg-7 col-md-7 padding-top-2px text-center hidden-sm hidden-xs">
                        <div class="header-search-bar layout-01 float-none">
                            <form action="shop" class="form-search" name="desktop-seacrh" autocomplete="" id="search_here" method="get">
                                <input type="text" name="sp" id="search_text" class="input-text" value="" placeholder="Search here...">
                                <button type="submit" class="btn-submit"><i class="biolife-icon icon-search"></i></button>
                            </form>
							
							<div class="dropserch">
								
								<div class="shwsrch">
								
								</div>
								<div class="sdcv cancel_search"><i class="fa fa-times "></i> Cancel Search</div>
							</div>
                        </div>
                       
                    </div>
					
                    <div class="col-lg-2 col-md-3 col-md-6 col-xs-6">
                        <div class="biolife-cart-info">
                            <div class="mobile-search">
                                <a href="javascript:void(0)" class="open-searchbox"><i class="biolife-icon icon-search"></i></a>
                                <div class="mobile-search-content">
                                    <form action="shop" class="form-search" autocomplete="" name="mobile-seacrh" id="searchhere" method="get">
                                        <a href="javascript:void(0);" class="btn-close"><span class="biolife-icon icon-close-menu"></span></a>
                                        <input type="text" name="sp"  id="searchtext" class="input-text" value="" placeholder="Search here...">
                                        
                                        <button type="submit" class="btn-submit">go</button>
                                    </form>
									
									<div class="mbsrchr shwsrch"></div>
                                </div>
                            </div>
                            
                            <div class="minicart-block <?= ((!empty($chk_crt)) && (cart_stk("tot_crt") > 0)) ? '' :'dntshwyet'; ?>" id="minicrt">
                                <div class="minicart-contain">
                                    <a href="javascript:void(0)" class="link-to">
                                            <span class="icon-qty-combine">
                                                <i class="icon-cart-mini biolife-icon"></i>
                                                <span class="qty" id="shcrcnt"><?= cart_stk("tot_crt"); ?></span>
                                            </span>
                                        <span class="title">Cart </span>
                                        <span class="sub-total" id="shcrtmt"><?= cart_stk("cart_amt"); ?></span>
                                    </a>
                                    <div class="cart-content">
                                        <div class="cart-inner">
                                            <ul class="products" id="minicrtdrp">
                                                <?php
												if((!empty($chk_crt)) && (cart_stk("tot_crt") > 0)){
													foreach($chk_crt as $dcv){
														$fdprp = $dcv['pqrcode'];
														
														
											$chk_prdz = $db_con->prepare("SELECT psell, purl, pdiscount,pqrcode,ksp_id, pname FROM kmartstockprds WHERE pqrcode = '$fdprp' ");
											$chk_prdz->execute(); $pdz = $chk_prdz->fetch();	
											
											$gt_imgs = gtOne("kprdw_imgs"," prd_rec = '$pdz[pqrcode]' ORDER BY kmg_id ASC","pjm_pic");
											
											$chk_mgi = $gt_imgs;     $chk_sl = $pdz['psell'];    $chk_ds = $pdz['pdiscount'];
											if($dcv['prd_attr'] == 'promo'){
											//FROM GENERAL FEATURED SPECIAL PROMO
											$chk_ftp = $db_con->prepare("SELECT * FROM kmt_ft_prds WHERE ksp_id = '$pdz[ksp_id]'  AND delete_status = 0");
											$chk_ftp->execute(); $fpd = $chk_ftp->fetch();
											
											$chk_mgi = (!empty($fpd) && !empty($fpd['prd_img'])) ?  $fpd['prd_img'] : $gt_imgs;
											$chk_sl = (!empty($fpd) && !empty($fpd['km_sell'])) ? $fpd['km_sell'] : $pdz['psell'];
											$chk_ds = (!empty($fpd) && !empty($fpd['km_discount'])) ? $fpd['km_discount'] : $pdz['pdiscount'];
											}
											
											$prd_img = (!empty($chk_mgi) && file_exists('prdimgs/'.$chk_mgi)) ? "prdimgs/".$chk_mgi : 'img/kmart-icon.png';
											
											$shw_pec = calcprcs($chk_sl,$chk_ds,'spc');
											$shw_ds = calcprcs($chk_sl,$chk_ds,'ssl');
											$shw_dsc = calcprcs($chk_sl,$chk_ds,'sds');
												?>
                                                <li>
                                                    <div class="minicart-item" data-cart="<?= $fdprp; ?>">
                                                        <div class="thumb">
                                                            <a href="product?kmt=<?= $pdz['purl']; ?>" target="_blank"><img src="<?= $prd_img; ?>" width="90" height="90" alt="Cart Icon"></a>
                                                        </div>
                                                        <div class="left-info">
                                                            <div class="product-title"><a href="product?kmt=<?= $pdz['purl']; ?>" target="_blank" class="product-name"><?= $pdz['pname']; ?></a></div>
                                                            <div class="price">
                                                                <ins><span class="price-amount"><span class="currencySymbol">GH₵</span><?= $shw_ds; ?></span></ins>
																
                                                            </div>
															<div class="qty">
                                                                <label>Qty:<?= $dcv['qty']; ?></label>
                                                            </div>
                                                        </div>
                                                        <div class="action">
                                                            <a href="javascript:void(0);" class="remove"><i class="fa fa-trash-o" aria-hidden="true"></i></a>
                                                        </div>
                                                    </div>
                                                </li>
                                                 <?php
													}
												}else{ echo '<p class="minicart-empty">No product in your cart</p>'; }
												?>
                                            </ul>
                                            <p class="btn-control">
                                                <a href="cart" class="btn view-cart">view cart</a>
                                                <a href="checkout" class="btn">checkout</a>
                                            </p>
                                        </div>
										
                                    </div>
                                </div>
                            </div>
                            <div class="mobile-menu-toggle">
                                <a class="btn-toggle" data-object="open-mobile-menu" href="javascript:void(0)">
                                    <span></span>
                                    <span></span>
                                    <span></span>
                                </a>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="header-bottom hidden-sm hidden-xs">
            <div class="container">
                <div class="row">
                    <div class="col-lg-3 col-md-4">
                        <div class="vertical-menu vertical-category-block">
                            <div class="block-title">
                                <span class="menu-icon">
                                    <span class="line-1"></span>
                                    <span class="line-2"></span>
                                    <span class="line-3"></span>
                                </span>
                                <span class="menu-title">All departments</span>
                                <span class="angle" data-tgleclass="fa fa-caret-down"><i class="fa fa-caret-up" aria-hidden="true"></i></span>
                            </div>
                            <div class="wrap-menu">
                                <ul class="menu clone-main-menu">
								<?php
								if(!empty($fndnm)){
									foreach($fndnm as $vf){
										$nmn = ucwords($vf['mname']);
										$nmd = $vf['mn_id'];
										
										$gtctt = gtAll("ktmmenu_category "," mn_id = '$nmd' ", 'cname ASC');
										$zicn = (!empty($vf['micon'])) ? $vf['micon'] : 'biolife-icon icon-fast-food';
										?>
										<li class="menu-item <?= (!empty($gtctt)) ? 'menu-item-has-children has-megamenu' : ''; ?>">
											<a href="shop?kmm=<?= $vf['murl']; ?>" class="<?= (!empty($gtctt)) ? 'menu-name' : 'menu-title'; ?>" <?= (!empty($gtctt)) ? 'data-title="$nmn"' :''; ?>><i class="<?= $zicn; ?>"></i><?= $nmn; ?></a>
											<?php 
												if(!empty($gtctt)){
													?>
												<div class="wrap-megamenu lg-width-900 md-width-640">
													<div class="mega-content">
														<div class="row">
														<?php
															foreach($gtctt as $fv){
																
																$nmxs = ucwords($fv['cname']);
																$nmx = $fv['mc_id'];
																
																$gtctx = gtAll("ktmmenu_subcategory "," mc_id = '$nmx' ", 'sname ASC');
														?>
															<div class="col-lg-3 col-md-4 col-sm-12 xs-margin-bottom-25 md-margin-bottom-0">
																<div class="wrap-custom-menu vertical-menu">
																	<h4 class="menu-title"><a href="shop?kcm=<?= $fv['curl']; ?>"><?= $nmxs; ?></a></h4>
																	
																	<?php
																	if(!empty($gtctx)){
																	?>
																	<ul class="menu">
																		<?php
																		foreach($gtctx  as $gf){
																			$nms = ucwords($gf['sname']);
																			$nmk = $gf['ms_id'];
																		?>
																		<li><a href="shop?ksm=<?= $gf['surl']; ?>"><?= $nms; ?></a></li>
																		<?php
																		}
																		?>
																	</ul>
																	<?php
																	}
																	?>
																	
																</div>
															</div>
															<?php
															}
															?>
														</div>
													</div>
												</div>
													<?php
												}
											?>
										</li>
										<?php
									}
								}
								?>
                                    <?php /*<li class="menu-item menu-item-has-children has-megamenu">
                                        <a href="javascript:void(0;" class="menu-name" data-title="Fruit & Nut Gifts"><i class="biolife-icon icon-fast-food"></i>Normal</a>
                                        <div class="wrap-megamenu lg-width-900 md-width-640">
                                            <div class="mega-content">
                                                <div class="row">
                                                    <div class="col-lg-3 col-md-4 col-sm-12 xs-margin-bottom-25 md-margin-bottom-0">
                                                        <div class="wrap-custom-menu vertical-menu">
                                                            <h4 class="menu-title">Fresh Fuits</h4>
                                                            <ul class="menu">
                                                                <li><a href="#">Fruit & Nut Gifts</a></li>
                                                                <li><a href="#">Mixed Fruits</a></li>
                                                                <li><a href="#">Oranges</a></li>
                                                                <li><a href="#">Bananas & Plantains</a></li>
                                                                <li><a href="#">Fresh Gala Apples</a></li>
                                                                <li><a href="#">Berries</a></li>
                                                                <li><a href="#">Pears</a></li>
                                                                <li><a href="#">Produce</a></li>
                                                                <li><a href="#">Snack Foods</a></li>
                                                            </ul>
                                                        </div>
                                                    </div>
                                                    <div class="col-lg-3 col-md-4 col-sm-12 lg-padding-left-23 xs-margin-bottom-25 md-margin-bottom-0">
                                                        <div class="wrap-custom-menu vertical-menu">
                                                            <h4 class="menu-title">Nut Gifts</h4>
                                                            <ul class="menu">
                                                                <li><a href="#">Non-Dairy Coffee Creamers</a></li>
                                                                <li><a href="#">Coffee Creamers</a></li>
                                                                <li><a href="#">Mayonnaise</a></li>
                                                                <li><a href="#">Almond Milk</a></li>
                                                                <li><a href="#">Ghee</a></li>
                                                                <li><a href="#">Beverages</a></li>
                                                                <li><a href="#">Ranch Salad Dressings</a></li>
                                                                <li><a href="#">Hemp Milk</a></li>
                                                                <li><a href="#">Nuts & Seeds</a></li>
                                                            </ul>
                                                        </div>
                                                    </div>
                                                    <div class="col-lg-6 col-md-4 col-sm-12 lg-padding-left-50 xs-margin-bottom-25 md-margin-bottom-0">
                                                        <div class="biolife-products-block max-width-270">
                                                            <h4 class="menu-title">Bestseller Products</h4>
                                                            <ul class="products-list default-product-style biolife-carousel nav-none-after-1k2 nav-center" data-slick='{"rows":1,"arrows":true,"dots":false,"infinite":false,"speed":400,"slidesMargin":30,"slidesToShow":1, "responsive":[{"breakpoint":767, "settings":{ "arrows": false}}]}' >
                                                                <li class="product-item">
                                                                    <div class="contain-product none-overlay">
                                                                        <div class="product-thumb">
                                                                            <a href="#" class="link-to-product">
                                                                                <img src="images/products/p-08.jpg" alt="dd" width="270" height="270" class="product-thumnail">
                                                                            </a>
                                                                        </div>
                                                                        <div class="info">
                                                                            <b class="categories">Fresh Fruit</b>
                                                                            <h4 class="product-title"><a href="#" class="pr-name">National Fresh Fruit</a></h4>
                                                                            <div class="price">
                                                                                <ins><span class="price-amount"><span class="currencySymbol">GH₵</span>85.00</span></ins>
                                                                                <del><span class="price-amount"><span class="currencySymbol">GH₵</span>95.00</span></del>
                                                                            </div>
                                                                        </div>
                                                                    </div>
                                                                </li>
                                                                <li class="product-item">
                                                                    <div class="contain-product none-overlay">
                                                                        <div class="product-thumb">
                                                                            <a href="#" class="link-to-product">
                                                                                <img src="images/products/p-11.jpg" alt="dd" width="270" height="270" class="product-thumnail">
                                                                            </a>
                                                                        </div>
                                                                        <div class="info">
                                                                            <b class="categories">Fresh Fruit</b>
                                                                            <h4 class="product-title"><a href="#" class="pr-name">National Fresh Fruit</a></h4>
                                                                            <div class="price">
                                                                                <ins><span class="price-amount"><span class="currencySymbol">GH₵</span>85.00</span></ins>
                                                                                <del><span class="price-amount"><span class="currencySymbol">GH₵</span>95.00</span></del>
                                                                            </div>
                                                                        </div>
                                                                    </div>
                                                                </li>
                                                                <li class="product-item">
                                                                    <div class="contain-product none-overlay">
                                                                        <div class="product-thumb">
                                                                            <a href="#" class="link-to-product">
                                                                                <img src="images/products/p-15.jpg" alt="dd" width="270" height="270" class="product-thumnail">
                                                                            </a>
                                                                        </div>
                                                                        <div class="info">
                                                                            <b class="categories">Fresh Fruit</b>
                                                                            <h4 class="product-title"><a href="#" class="pr-name">National Fresh Fruit</a></h4>
                                                                            <div class="price">
                                                                                <ins><span class="price-amount"><span class="currencySymbol">GH₵</span>85.00</span></ins>
                                                                                <del><span class="price-amount"><span class="currencySymbol">GH₵</span>95.00</span></del>
                                                                            </div>
                                                                        </div>
                                                                    </div>
                                                                </li>
                                                            </ul>
                                                        </div>
                                                    </div>
                                                </div>
                                                
                                            </div>
                                        </div>
                                    </li>*/ ?>
                                </ul>
                            </div>
                        </div>
                    </div>
					
					
                    
					
					
					<div class="col-lg-9 col-md-8 padding-top-2px hidden-sm hidden-xs">
                        <div class="primary-menu">
                        <ul class="menu biolife-menu d-flex justify-content-around" id="primary-menu" data-menuname="main menu">
                            <li class="menu-item"><a href="index">Home</a></li>
                            <li class="menu-item"><a href="shop">Shop</a></li>
                            
							<li class="menu-item"><a href="about">About Us</a></li>
							
							<?php /*<li class="menu-item"><a href="order">Order</a></li>    <li class="menu-item"><a href="blog">Blog</a></li>*/ ?>
							
							<li class="menu-item"><a href="contact">Contact Us</a></li>
							
                            
                        </ul>
                    </div>
                    </div>
					
                </div>
            </div>
        </div>
    </header>

