Skip to content

Commit

Permalink
Main PHP file Pages for the customer's website -fixes #6
Browse files Browse the repository at this point in the history
  • Loading branch information
aya250 committed Apr 24, 2023
1 parent db7662e commit e3a271c
Show file tree
Hide file tree
Showing 14 changed files with 1,726 additions and 0 deletions.
187 changes: 187 additions & 0 deletions ecommerce-website/about.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,187 @@
<?php

include 'components/connect.php';

session_start();

if(isset($_SESSION['user_id'])){
$user_id = $_SESSION['user_id'];
}else{
$user_id = '';
};

?>

<!DOCTYPE html>
<html 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.0">
<title>About</title>

<link rel="stylesheet" href="https://unpkg.com/swiper@8/swiper-bundle.min.css" />

<!-- font awesome cdn link -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.1.1/css/all.min.css">

<!-- custom css file link -->
<link rel="stylesheet" href="css/style.css">

</head>
<body>

<?php include 'components/user_header.php'; ?>

<section class="about">

<div class="row">

<div class="image">
<img src="images/about-img.svg" alt="">
</div>

<div class="content">
<h3>The Warehouse Robot's Mini Shop</h3>
<p>Our Website Is For Our Graduation Project For 2023.</p>
<a href="contact.php" class="btn">contact us</a>
</div>

</div>

</section>

<section class="reviews">

<h1 class="heading">Graduation Project Team</h1>

<div class="swiper reviews-slider">

<div class="swiper-wrapper">

<div class="swiper-slide slide">
<img src="images/pic-1.png" alt="">
<p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Quia tempore distinctio hic, iusto adipisci a rerum nemo perspiciatis fugiat sapiente.</p>
<div class="stars">
<i class="fas fa-star"></i>
<i class="fas fa-star"></i>
<i class="fas fa-star"></i>
<i class="fas fa-star"></i>
<i class="fas fa-star-half-alt"></i>
</div>
<h3>john deo</h3>
</div>

<div class="swiper-slide slide">
<img src="images/pic-2.png" alt="">
<p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Quia tempore distinctio hic, iusto adipisci a rerum nemo perspiciatis fugiat sapiente.</p>
<div class="stars">
<i class="fas fa-star"></i>
<i class="fas fa-star"></i>
<i class="fas fa-star"></i>
<i class="fas fa-star"></i>
<i class="fas fa-star-half-alt"></i>
</div>
<h3>john deo</h3>
</div>

<div class="swiper-slide slide">
<img src="images/pic-3.png" alt="">
<p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Quia tempore distinctio hic, iusto adipisci a rerum nemo perspiciatis fugiat sapiente.</p>
<div class="stars">
<i class="fas fa-star"></i>
<i class="fas fa-star"></i>
<i class="fas fa-star"></i>
<i class="fas fa-star"></i>
<i class="fas fa-star-half-alt"></i>
</div>
<h3>john deo</h3>
</div>

<div class="swiper-slide slide">
<img src="images/pic-4.png" alt="">
<p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Quia tempore distinctio hic, iusto adipisci a rerum nemo perspiciatis fugiat sapiente.</p>
<div class="stars">
<i class="fas fa-star"></i>
<i class="fas fa-star"></i>
<i class="fas fa-star"></i>
<i class="fas fa-star"></i>
<i class="fas fa-star-half-alt"></i>
</div>
<h3>john deo</h3>
</div>

<div class="swiper-slide slide">
<img src="images/pic-5.png" alt="">
<p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Quia tempore distinctio hic, iusto adipisci a rerum nemo perspiciatis fugiat sapiente.</p>
<div class="stars">
<i class="fas fa-star"></i>
<i class="fas fa-star"></i>
<i class="fas fa-star"></i>
<i class="fas fa-star"></i>
<i class="fas fa-star-half-alt"></i>
</div>
<h3>john deo</h3>
</div>

<div class="swiper-slide slide">
<img src="images/pic-6.png" alt="">
<p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Quia tempore distinctio hic, iusto adipisci a rerum nemo perspiciatis fugiat sapiente.</p>
<div class="stars">
<i class="fas fa-star"></i>
<i class="fas fa-star"></i>
<i class="fas fa-star"></i>
<i class="fas fa-star"></i>
<i class="fas fa-star-half-alt"></i>
</div>
<h3>john deo</h3>
</div>

</div>

<div class="swiper-pagination"></div>

</div>

</section>









<?php include 'components/footer.php'; ?>

<script src="https://unpkg.com/swiper@8/swiper-bundle.min.js"></script>

<script src="js/script.js"></script>

<script>

var swiper = new Swiper(".reviews-slider", {
loop:true,
spaceBetween: 20,
pagination: {
el: ".swiper-pagination",
clickable:true,
},
breakpoints: {
0: {
slidesPerView:1,
},
768: {
slidesPerView: 2,
},
991: {
slidesPerView: 3,
},
},
});

</script>

</body>
</html>
117 changes: 117 additions & 0 deletions ecommerce-website/cart.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
<?php

include 'components/connect.php';

session_start();

if(isset($_SESSION['user_id'])){
$user_id = $_SESSION['user_id'];
}else{
$user_id = '';
header('location:user_login.php');
};

if(isset($_POST['delete'])){
$cart_id = $_POST['cart_id'];
$delete_cart_item = $conn->prepare("DELETE FROM `cart` WHERE id = ?");
$delete_cart_item->execute([$cart_id]);
}

if(isset($_GET['delete_all'])){
$delete_cart_item = $conn->prepare("DELETE FROM `cart` WHERE user_id = ?");
$delete_cart_item->execute([$user_id]);
header('location:cart.php');
}

if(isset($_POST['update_qty'])){
$cart_id = $_POST['cart_id'];
$qty = $_POST['qty'];
$qty = filter_var($qty, FILTER_SANITIZE_STRING);
$update_qty = $conn->prepare("UPDATE `cart` SET quantity = ? WHERE id = ?");
$update_qty->execute([$qty, $cart_id]);
$message[] = 'cart quantity updated';
}

?>

<!DOCTYPE html>
<html 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.0">
<title>shopping cart</title>

<!-- font awesome cdn link -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.1.1/css/all.min.css">

<!-- custom css file link -->
<link rel="stylesheet" href="css/style.css">

</head>
<body>

<?php include 'components/user_header.php'; ?>

<section class="products shopping-cart">

<h3 class="heading">shopping cart</h3>

<div class="box-container">

<?php
$grand_total = 0;
$select_cart = $conn->prepare("SELECT * FROM `cart` WHERE user_id = ?");
$select_cart->execute([$user_id]);
if($select_cart->rowCount() > 0){
while($fetch_cart = $select_cart->fetch(PDO::FETCH_ASSOC)){
?>
<form action="" method="post" class="box">
<input type="hidden" name="cart_id" value="<?= $fetch_cart['id']; ?>">
<a href="quick_view.php?pid=<?= $fetch_cart['pid']; ?>" class="fas fa-eye"></a>
<img src="uploaded_img/<?= $fetch_cart['image']; ?>" alt="">
<div class="name"><?= $fetch_cart['name']; ?></div>
<div class="flex">
<div class="price">$<?= $fetch_cart['price']; ?>/-</div>
<input type="number" name="qty" class="qty" min="1" max="99" onkeypress="if(this.value.length == 2) return false;" value="<?= $fetch_cart['quantity']; ?>">
<button type="submit" class="fas fa-edit" name="update_qty"></button>
</div>
<div class="sub-total"> sub total : <span>$<?= $sub_total = ($fetch_cart['price'] * $fetch_cart['quantity']); ?>/-</span> </div>
<input type="submit" value="delete item" onclick="return confirm('delete this from cart?');" class="delete-btn" name="delete">
</form>
<?php
$grand_total += $sub_total;
}
}else{
echo '<p class="empty">your cart is empty</p>';
}
?>
</div>

<div class="cart-total">
<p>grand total : <span>$<?= $grand_total; ?>/-</span></p>
<a href="shop.php" class="option-btn">continue shopping</a>
<a href="cart.php?delete_all" class="delete-btn <?= ($grand_total > 1)?'':'disabled'; ?>" onclick="return confirm('delete all from cart?');">delete all item</a>
<a href="checkout.php" class="btn <?= ($grand_total > 1)?'':'disabled'; ?>">proceed to checkout</a>
</div>

</section>













<?php include 'components/footer.php'; ?>

<script src="js/script.js"></script>

</body>
</html>
Loading

0 comments on commit e3a271c

Please sign in to comment.