Compare commits
No commits in common. "351acf87dd0abe78a4ca6a40fd3f14ab84012c11" and "09d777cb809bd1917eb33002cc0091b6bc988b7b" have entirely different histories.
351acf87dd
...
09d777cb80
149
wishlist.php
149
wishlist.php
|
@ -1,13 +1,9 @@
|
|||
|
||||
|
||||
<?php
|
||||
|
||||
|
||||
use Symfony\Component\VarDumper\VarDumper;
|
||||
|
||||
|
||||
include "functions.php";
|
||||
session_start();
|
||||
|
||||
$_SESSION["url"] = $_SERVER['REQUEST_URI'];
|
||||
if ($_SESSION["userId"] <> "") {
|
||||
$_SESSION["isLoggedIn"] = true;
|
||||
|
@ -19,29 +15,24 @@ if ($_SESSION["userId"] <> "") {
|
|||
<!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, minimum-scale=1.0">
|
||||
|
||||
|
||||
<title>oBanana B2B - Elevate Your Business</title>
|
||||
<meta name="keywords" content="apparel, catalog, clean, ecommerce, ecommerce HTML, electronics, fashion, html eCommerce, html store, minimal, multipurpose, multipurpose ecommerce, online store, responsive ecommerce template, shops" />
|
||||
<meta name="description" content="Best ecommerce html template for single and multi vendor store.">
|
||||
<meta name="author" content="ashishmaraviya">
|
||||
|
||||
|
||||
<!-- site Favicon -->
|
||||
<link rel="icon" href="assets/images/favicon/favicon.png" sizes="32x32" />
|
||||
<link rel="apple-touch-icon" href="assets/images/favicon/favicon.png" />
|
||||
<meta name="msapplication-TileImage" content="assets/images/favicon/favicon.png" />
|
||||
|
||||
|
||||
<!-- css Icon Font -->
|
||||
<link rel="stylesheet" href="assets/css/vendor/ecicons.min.css" />
|
||||
|
||||
|
||||
<!-- css All Plugins Files -->
|
||||
<link rel="stylesheet" href="assets/css/plugins/animate.css" />
|
||||
<link rel="stylesheet" href="assets/css/plugins/swiper-bundle.min.css" />
|
||||
|
@ -50,12 +41,10 @@ if ($_SESSION["userId"] <> "") {
|
|||
<link rel="stylesheet" href="assets/css/plugins/slick.min.css" />
|
||||
<link rel="stylesheet" href="assets/css/plugins/bootstrap.css" />
|
||||
|
||||
|
||||
<!-- Main Style -->
|
||||
<link rel="stylesheet" href="assets/css/style.css" />
|
||||
<link rel="stylesheet" href="assets/css/responsive.css" />
|
||||
|
||||
|
||||
<!-- Background css -->
|
||||
<link rel="stylesheet" id="bg-switcher-css" href="assets/css/backgrounds/bg-4.css">
|
||||
<script>
|
||||
|
@ -68,7 +57,6 @@ if ($_SESSION["userId"] <> "") {
|
|||
});
|
||||
}
|
||||
|
||||
|
||||
function updateWishItemCount() {
|
||||
$.get("wishlistitems.php?id=<?php echo $_SESSION['customerId']; ?>", function(data) {
|
||||
if (data != "") {
|
||||
|
@ -90,7 +78,6 @@ if ($_SESSION["userId"] <> "") {
|
|||
border-radius: 10px 10px 0 0;
|
||||
}
|
||||
|
||||
|
||||
.ec-product-inner .ec-pro-image .ec-pro-actions .wishlist {
|
||||
position: absolute;
|
||||
right: 15px;
|
||||
|
@ -100,7 +87,6 @@ if ($_SESSION["userId"] <> "") {
|
|||
</style>
|
||||
</head>
|
||||
|
||||
|
||||
<body onload="updateCartItemCount(); updateWishItemCount()">
|
||||
<div id="ec-overlay">
|
||||
<div class="ec-ellipsis">
|
||||
|
@ -111,18 +97,14 @@ if ($_SESSION["userId"] <> "") {
|
|||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<!-- Header start -->
|
||||
<?php include "header.php" ?>
|
||||
<!-- Header End -->
|
||||
|
||||
|
||||
<!-- ekka Cart Start -->
|
||||
|
||||
|
||||
<!-- ekka Cart End -->
|
||||
|
||||
|
||||
<!-- Ec breadcrumb start -->
|
||||
<div class="sticky-header-next-sec ec-breadcrumb section-space-mb">
|
||||
<div class="container">
|
||||
|
@ -156,30 +138,22 @@ if ($_SESSION["userId"] <> "") {
|
|||
<!-- Ec Wishlist page -->
|
||||
<section class="ec-page-content section-space-p">
|
||||
<div class="container">
|
||||
<div class="row ec_breadcrumb_inner">
|
||||
<div class="row">
|
||||
<!-- Compare Content Start -->
|
||||
<div class="ec-wish-rightside col-lg-12 col-md-12">
|
||||
<!-- Compare content Start -->
|
||||
<div class="ec-compare-content">
|
||||
<div class="ec-compare-inner">
|
||||
<!-- raymart added button for delete and checkbox for select all feb 19 2024 -->
|
||||
<div class="ec-breadcrumb-list" style="padding: 30px;">
|
||||
<a Id="delete-button"><i class="ecicon eci-trash" style="font-size: 40px;"></i></a>
|
||||
<input type="checkbox" Id="select-button" style="width: 30px; height: 30px; float: left; "><title>has</title>
|
||||
<!-- <button class="btn btn-primary" id="delete-button">Delete Selected</button> -->
|
||||
<!-- <button class="btn btn-primary" style="float: left;" id="select-button">Select all</button> -->
|
||||
</div>
|
||||
|
||||
<div class="row margin-minus-b-30">
|
||||
<div class="col-12">
|
||||
<button id="select-all-button">Select All</button>
|
||||
</div>
|
||||
<?php foreach ($customer['favorites']['products'] as $product) {
|
||||
// raymart added vendorproduct feb 14 2024
|
||||
$vendorOfProduct = getVendorbyId($product['vendor_api_id']);
|
||||
?>
|
||||
<div class="col-lg-3 col-md-4 col-sm-6 col-xs-6 mb-6 pro-gl-content">
|
||||
<div class="ec-product-inner">
|
||||
<!-- raymart added style for checkboxes feb 19 2024 -->
|
||||
<input type="checkbox" class="product-checkbox" style="width: 20px; height: 20px; "value="<?php echo $product["_id"]; ?>">
|
||||
<div class="ec-pro-image-outer">
|
||||
<div class="ec-pro-image">
|
||||
<a href="shop-left-sidebar-col-4.php" class="image">
|
||||
|
@ -234,36 +208,30 @@ if ($_SESSION["userId"] <> "") {
|
|||
$lowest_sale_price = null;
|
||||
$highest_sale_price = null;
|
||||
|
||||
|
||||
if (isset($variation_details) && is_array($variation_details)) {
|
||||
foreach ($variation_details as $index => $variation) {
|
||||
$regular_price = isset($variation['regular_price']) ? $variation['regular_price'] : 0;
|
||||
$sale_price = isset($variation['sale_price']) ? $variation['sale_price'] : 0;
|
||||
|
||||
|
||||
// Update the minimum and maximum prices only if they are not null
|
||||
if ($lowest_regular_price === null || $regular_price < $lowest_regular_price) {
|
||||
$lowest_regular_price = $regular_price;
|
||||
}
|
||||
|
||||
|
||||
if ($highest_regular_price === null || $regular_price > $highest_regular_price) {
|
||||
$highest_regular_price = $regular_price;
|
||||
}
|
||||
|
||||
|
||||
if ($lowest_sale_price === null || $sale_price < $lowest_sale_price) {
|
||||
$lowest_sale_price = $sale_price;
|
||||
}
|
||||
|
||||
|
||||
if ($highest_sale_price === null || $sale_price > $highest_sale_price) {
|
||||
$highest_sale_price = $sale_price;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Display the range of prices based on the presence of sale prices
|
||||
if ($lowest_sale_price !== null && $highest_sale_price !== null && $lowest_sale_price > 0 && $highest_sale_price > 0) {
|
||||
echo '<span id="productPrice" class="new-price">' . '₱' . $lowest_sale_price . ' - ₱' . $highest_sale_price . '</span>';
|
||||
|
@ -272,6 +240,24 @@ if ($_SESSION["userId"] <> "") {
|
|||
}
|
||||
}
|
||||
?>
|
||||
|
||||
<!-- <div class="ec-pro-option">
|
||||
<div class="ec-pro-color">
|
||||
<span class="ec-pro-opt-label">Color</span>
|
||||
<ul class="ec-opt-swatch ec-change-img">
|
||||
<li class="active"><a href="#" class="ec-opt-clr-img" data-src="assets/images/product-image/8_1.jpg" data-src-hover="assets/images/product-image/8_1.jpg" data-tooltip="Gray"><span style="background-color:#e2e2e2;"></span></a></li>
|
||||
<li><a href="#" class="ec-opt-clr-img" data-src="assets/images/product-image/8_3.jpg" data-src-hover="assets/images/product-image/8_3.jpg" data-tooltip="Orange"><span style="background-color:#ffcef7;"></span></a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="ec-pro-size">
|
||||
<span class="ec-pro-opt-label">Size</span>
|
||||
<ul class="ec-opt-size">
|
||||
<li class="active"><a href="#" class="ec-opt-sz" data-old="$12.00" data-new="$10.00" data-tooltip="Small">S</a></li>
|
||||
<li><a href="#" class="ec-opt-sz" data-old="$15.00" data-new="$12.00" data-tooltip="Medium">M</a></li>
|
||||
<li><a href="#" class="ec-opt-sz" data-old="$20.00" data-new="$17.00" data-tooltip="Extra Large">XL</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div> -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -286,32 +272,8 @@ if ($_SESSION["userId"] <> "") {
|
|||
removeProduct(productId);
|
||||
});
|
||||
});
|
||||
var deleteButton = document.getElementById('delete-button');
|
||||
deleteButton.addEventListener('click', function() {
|
||||
var selectedProducts = [];
|
||||
var checkboxes = document.querySelectorAll('.product-checkbox');
|
||||
checkboxes.forEach(function(checkbox) {
|
||||
if (checkbox.checked) {
|
||||
selectedProducts.push(checkbox.value);
|
||||
}
|
||||
});
|
||||
deleteProducts(selectedProducts);
|
||||
});
|
||||
});
|
||||
var selectAllButton = document.querySelector('#select-button');
|
||||
selectAllButton.addEventListener('click', function() {
|
||||
var selectedProducts = [];
|
||||
var checkboxes = document.querySelectorAll('.product-checkbox');
|
||||
// checkboxes.forEach(function(checkbox) {
|
||||
// }
|
||||
console.log('clicked')
|
||||
for (let i = 0; i < checkboxes.length; i++ ) {
|
||||
checkboxes[i].checked = selectAllButton.checked
|
||||
// checkboxes[i].checked = true
|
||||
}})
|
||||
|
||||
|
||||
|
||||
|
||||
// Function to remove product
|
||||
function removeProduct(productId) {
|
||||
// Get all product IDs except the one to remove
|
||||
|
@ -321,10 +283,9 @@ if ($_SESSION["userId"] <> "") {
|
|||
return id !== productId;
|
||||
});
|
||||
|
||||
|
||||
// Make an AJAX request to update the favorites with the remaining products
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.open('PATCH', 'https://api.obanana.shop/api/v1/customers/' + customerId, true);
|
||||
xhr.open('PATCH', 'https://<?php echo $_SESSION["data_endpoint"]; ?>/api/v1/customers/' + customerId, true);
|
||||
xhr.setRequestHeader('Content-Type', 'application/json');
|
||||
xhr.onreadystatechange = function() {
|
||||
if (xhr.readyState === XMLHttpRequest.DONE) {
|
||||
|
@ -347,7 +308,6 @@ if ($_SESSION["userId"] <> "") {
|
|||
return product['_id'] === id;
|
||||
});
|
||||
|
||||
|
||||
// Return the entire product object
|
||||
return remainingProduct;
|
||||
})
|
||||
|
@ -356,54 +316,19 @@ if ($_SESSION["userId"] <> "") {
|
|||
|
||||
xhr.send(data);
|
||||
}
|
||||
// Function to delete multiple products
|
||||
function deleteProducts(productIds) {
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.open('PATCH', 'https://api.obanana.shop/api/v1/customers/' + customerId, true);
|
||||
xhr.setRequestHeader('Content-Type', 'application/json');
|
||||
xhr.onreadystatechange = function() {
|
||||
if (xhr.readyState === XMLHttpRequest.DONE) {
|
||||
if (xhr.status === 200) {
|
||||
console.log('Products removed successfully');
|
||||
location.reload();
|
||||
} else {
|
||||
console.error('Error removing products:', xhr.responseText);
|
||||
}
|
||||
}
|
||||
};
|
||||
var remainingProductIds = Array.from(document.querySelectorAll('.remove-product')).map(function(button) {
|
||||
return button.getAttribute('data-product-id');
|
||||
}).filter(function(id) {
|
||||
return !productIds.includes(id);
|
||||
});
|
||||
var data = JSON.stringify({
|
||||
favorites: {
|
||||
products: remainingProductIds.map(function(id) {
|
||||
var remainingProduct = <?php echo json_encode($customer['favorites']['products']); ?>.find(function(product) {
|
||||
return product['_id'] === id;
|
||||
});
|
||||
return remainingProduct;
|
||||
})
|
||||
}
|
||||
});
|
||||
xhr.send(data);
|
||||
}
|
||||
|
||||
|
||||
</script>
|
||||
<?php } ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<!-- // compare content End -->
|
||||
<!--compare content End -->
|
||||
</div>
|
||||
<!-- Compare Content end -->
|
||||
</div>
|
||||
</div>
|
||||
<section>
|
||||
</section>
|
||||
<!-- Start Offer section -->
|
||||
<section class="labels section-space-p">
|
||||
<!-- <section class="labels section-space-p">
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-md-12 text-center">
|
||||
|
@ -471,7 +396,6 @@ if ($_SESSION["userId"] <> "") {
|
|||
</section> -->
|
||||
<!-- End Offer section -->
|
||||
|
||||
|
||||
<!-- Start Offer section -->
|
||||
<!-- <section class="labels section-space-p">
|
||||
<div class="container">
|
||||
|
@ -503,12 +427,10 @@ if ($_SESSION["userId"] <> "") {
|
|||
</section> -->
|
||||
<!-- End Offer section -->
|
||||
|
||||
|
||||
<!-- Footer Start -->
|
||||
<?php include "footer.php" ?>
|
||||
<!-- Footer Area End -->
|
||||
|
||||
|
||||
<!-- Footer navigation panel for responsive display -->
|
||||
<div class="ec-nav-toolbar">
|
||||
<div class="container">
|
||||
|
@ -529,13 +451,11 @@ if ($_SESSION["userId"] <> "") {
|
|||
<a href="login.php" class="ec-header-btn"><i class="fi-rr-user"></i></a>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Footer navigation panel for responsive display end -->
|
||||
|
||||
|
||||
<!-- Recent Purchase Popup -->
|
||||
<div class="recent-purchase">
|
||||
<img src="assets/images/product-image/1.jpg" alt="payment image">
|
||||
|
@ -548,7 +468,6 @@ if ($_SESSION["userId"] <> "") {
|
|||
</div>
|
||||
<!-- Recent Purchase Popup end -->
|
||||
|
||||
|
||||
<!-- Cart Floating Button -->
|
||||
<div class="ec-cart-float">
|
||||
<a href="#ec-side-cart" class="ec-header-btn ec-side-toggle">
|
||||
|
@ -559,7 +478,6 @@ if ($_SESSION["userId"] <> "") {
|
|||
</div>
|
||||
<!-- Cart Floating Button end -->
|
||||
|
||||
|
||||
<!-- Whatsapp -->
|
||||
<div class="ec-style ec-right-bottom">
|
||||
<!-- Start Floating Panel Container -->
|
||||
|
@ -676,7 +594,6 @@ if ($_SESSION["userId"] <> "") {
|
|||
</div>
|
||||
<!-- Whatsapp end -->
|
||||
|
||||
|
||||
<!-- Feature tools -->
|
||||
<div class="ec-tools-sidebar-overlay"></div>
|
||||
<div class="ec-tools-sidebar">
|
||||
|
@ -744,7 +661,6 @@ if ($_SESSION["userId"] <> "") {
|
|||
</div>
|
||||
<!-- Feature tools end -->
|
||||
|
||||
|
||||
<!-- Vendor JS -->
|
||||
<script src="assets/js/vendor/jquery-3.5.1.min.js"></script>
|
||||
<script src="assets/js/vendor/popper.min.js"></script>
|
||||
|
@ -752,7 +668,6 @@ if ($_SESSION["userId"] <> "") {
|
|||
<script src="assets/js/vendor/jquery-migrate-3.3.0.min.js"></script>
|
||||
<script src="assets/js/vendor/modernizr-3.11.2.min.js"></script>
|
||||
|
||||
|
||||
<!--Plugins JS-->
|
||||
<script src="assets/js/plugins/swiper-bundle.min.js"></script>
|
||||
<script src="assets/js/plugins/countdownTimer.min.js"></script>
|
||||
|
@ -763,12 +678,10 @@ if ($_SESSION["userId"] <> "") {
|
|||
<script src="assets/js/vendor/jquery.magnific-popup.min.js"></script>
|
||||
<script src="assets/js/plugins/jquery.sticky-sidebar.js"></script>
|
||||
|
||||
|
||||
<!-- Main Js -->
|
||||
<script src="assets/js/vendor/index.js"></script>
|
||||
<script src="assets/js/main.js"></script>
|
||||
<!-- raymart added link from js feb 14 2024 -->
|
||||
<!-- <script src="assets/js/tester3.js"></script> -->
|
||||
<?php
|
||||
if ($_SESSION["is_test"]==true) {
|
||||
echo '<script src="assets/js/tester3.js"></script>';
|
||||
|
@ -779,8 +692,4 @@ if ($_SESSION["userId"] <> "") {
|
|||
|
||||
</body>
|
||||
|
||||
|
||||
</html>
|
||||
|
||||
|
||||
|
||||
</html>
|
Loading…
Reference in New Issue