MMCT TEAM
Server IP : 103.53.40.154  /  Your IP : 18.189.186.247
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/emogli.com/../.wp-cli/../asifali.in/../deergham.com/

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : /home2/ppcad7no/emogli.com/../.wp-cli/../asifali.in/../deergham.com/add-to-cart.php
<?php 
    session_start();
    // include "admin/config.php";
    
    // if(!isset($_SESSION["user"]) OR $_SESSION["user"] == "" ){
        
    //     header('location:login.php');
    // }
?>
<!DOCTYPE html>
<html lang=en>

<head>
    <meta charset=UTF-8>
    <meta name=viewport content="width=device-width,initial-scale=1,minimum-scale=1">
    <meta http-equiv=X-UA-Compatible content="ie=edge">
    <title>Cart | Deergham</title>
    <meta name="description" content="Cart | Deergham">
    <?php include "top-links.php" ?>
    <link rel="stylesheet" href="<?php echo $wspath?>css/cart.min.css">
</head>

<body>
    <?php include "header.php" ?>
  
    <header class=page>
        <div class="page_main container-fluid">
            <div class=container>
                <h1 class=page_header>Cart page</h1>
            </div>
        </div>
        <div class=container>
            <ul class="page_breadcrumbs d-flex flex-wrap">
                <li class=page_breadcrumbs-item><a class=link href="<?php echo $wspath?>">Home</a></li>
                <li class="page_breadcrumbs-item current"><span>Cart page</span></li>
            </ul>
        </div>
    </header>
    <main>
        <section class="cart section">
            <div class="container d-md-flex justify-content-between align-content-start">
                <div class=cart_main>
                    <h3 class="cart_main-header d-flex align-items-center justify-content-between">Products <span> Items</span></h3>
                    <ul class=cart_main-list>
                    <?php if (isset($_SESSION['cart']) && !empty($_SESSION['cart'])) : ?>
                    <?php
                        $counter = 1;
                        $total = 0;
                        foreach ($_SESSION['cart'] as $key => $value) {
                            $subtotal = $value['price'] * $value['quantity'];
                            echo '<li class="cart_main-list_item">
                                    <div class="wrapper d-flex flex-wrap flex-xl-nowrap align-items-center justify-content-between">
                                        <div class="wrapper_item d-flex align-items-center">
                                            <div class="wrapper_item-media">
                                                <img width="60px" class="lazy" src="admin/images/property-image/' . $value['image'] . '" alt="media">
                                            </div>
                                            <div class="wrapper_item-info">
                                                <h5 class="title">' . $value['name'] . '</h5>
                                            </div>
                                        </div>
                                        <div class="price_wrapper d-flex flex-column">
                                            <span class="price price--new iprice">₹' . $value['price'] . '<input class="iprice" type="hidden" value="' . $value['price'] . '"></span>
                                        </div>
                                        <div class="qty d-flex align-items-center justify-content-between">
                                        <form action="add-cart.php" method="POST" class="d-flex">
                                            <input class="text-center iquantity" name="mod_quantity" onChange="this.form.submit();" type="number" value="' . $value['quantity'] . '" min="1" max="10">
                                            <input name="item_name" type="hidden" value="' . $value['name'] . '">
                                        </form>
                                        </div>
                                        <div class="price_wrapper price_wrapper--subtotal d-flex flex-column">
                                          <h5 class="title">Subtotal</h5>
                                          <span class="price price--total itotal">₹' . $subtotal . '</span>
                                        </div>
                                        <div class="remove-btn">
                                            <form action="add-cart.php" method="POST"> 
                                              <button name="remove_product" value="' . $key . '" class="btn"><i class="fa-solid fa-xmark"></i></button>
                                              <input name="item_name" type="hidden" value="' . $value['name'] . '">
                                            </form>
                                        </div>
                                        
                                    </div>
                                </li>';
                            $total += $subtotal;
                        }
                        ?>
                       <?php endif ?>
                    </ul>
                    <div class="cart_main-action d-flex flex-column flex-sm-row align-items-center justify-content-sm-between">
                        <a class="btn--underline" href="<?php echo $wspath;?>">Keep Shopping</a> 
                        <!--<a class="btn btn--green" href=#>Update cart</a>-->
                    </div>
                </div>
                <div class="cart_summary">
                    <form action="checkout.html" method="POST">
                        <h3 class="cart_summary-header">Order Summary</h3>
                        <div class="cart_summary-table">
                            <div class="cart_summary-table_row d-flex justify-content-between">
                                <span class="property">Shipping</span> <span class="value">Free</span>
                            </div>
                            <?php if (isset($_SESSION['cart']) && !empty($_SESSION['cart'])) : ?>
                                <?php
                                $counter = 1;
                                $total = 0;
                                $totalQuantity = 0;
                                $productNames = array();
                
                                foreach ($_SESSION['cart'] as $key => $value) {
                                    $total += $subtotal;
                                    $totalQuantity += $value['quantity'];
                                    $productQuantities[] = $value['quantity'];
                                    $productNames[] = $value['name'];
                                    }
                                ?>
                                    <input type="hidden" name="total_quantity" value="<?php echo $totalQuantity; ?>">
                                    <input type="hidden" name="product_quantities" value="<?php echo implode(',', $productQuantities); ?>">
                                    <input type="hidden" name="product_names" value="<?php echo implode(', ', $productNames); ?>">
                                    <input type="hidden" name="total_price" value="<?php echo $total; ?>">
                            <?php endif ?>
                            <div class="cart_summary-table_row cart_summary-table_row--total d-flex justify-content-between">
                                <span class="property">Total Products</span>
                                <?php
                                // $totalProductsCount = count($_SESSION['cart']);
                                echo '<span class="value">' . $totalQuantity . '</span>';
                                ?>
                            </div>
                            <div class="cart_summary-table_row cart_summary-table_row--total d-flex justify-content-between">
                                <span class="property">Total</span> <span class="value" id="g2total">₹<?php echo $total; ?></span>
                            </div>
                        </div>
                        <button class="cart_summary-btn btn" type="submit" name="check-btn">Checkout</button>
                    </form>
                </div>
            </div>
        </section>
    </main>
    <?php include "footer.php" ;?>
   
</body>
</html>

MMCT - 2023