Compare commits
6 Commits
bf27328ec3
...
3a513218c5
Author | SHA1 | Date |
---|---|---|
MarkHipe | 3a513218c5 | |
gelonspr | f2adac3fbc | |
gelonspr | d0f51e2a03 | |
gelonspr | 6efdc5f4dd | |
gelonspr | 9e5694145a | |
gelonspr | 2ef5f188d7 |
|
@ -140,10 +140,10 @@
|
|||
<div class="footer-bottom-social">
|
||||
<span class="social-text text-upper">Follow us on:</span>
|
||||
<ul class="mb-0">
|
||||
<li class="list-inline-item"><a class="hdr-facebook" href="#"><i class="ecicon eci-facebook"></i></a></li>
|
||||
<li class="list-inline-item"><a class="hdr-twitter" href="#"><i class="ecicon eci-twitter"></i></a></li>
|
||||
<li class="list-inline-item"><a class="hdr-instagram" href="#"><i class="ecicon eci-instagram"></i></a></li>
|
||||
<li class="list-inline-item"><a class="hdr-linkedin" href="#"><i class="ecicon eci-linkedin"></i></a></li>
|
||||
<li class="list-inline-item"><a class="hdr-facebook" href="https://www.facebook.com/ObananaPH/"><i class="ecicon eci-facebook"></i></a></li>
|
||||
<li class="list-inline-item"><a class="hdr-twitter" href="https://twitter.com/obananac?lang=en"><i class="ecicon eci-twitter"></i></a></li>
|
||||
<li class="list-inline-item"><a class="hdr-instagram" href="https://www.instagram.com/obananaph/"><i class="ecicon eci-instagram"></i></a></li>
|
||||
<li class="list-inline-item"><a class="hdr-linkedin" href="https://ph.linkedin.com/company/obananaph"><i class="ecicon eci-linkedin"></i></a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
|
13
header.php
13
header.php
|
@ -379,7 +379,6 @@ if ($_SESSION["userId"] <> "") {
|
|||
} else {
|
||||
?>
|
||||
<li><a class="dropdown-item" href="register.php">Register</a></li>
|
||||
<li><a class="dropdown-item" href="checkout.html">Checkout</a></li>
|
||||
<li><a class="dropdown-item" href="login.php">Login</a></li>
|
||||
<?php
|
||||
}
|
||||
|
@ -923,9 +922,15 @@ if ($_SESSION["userId"] <> "") {
|
|||
<div class="row">
|
||||
<div class="col-md-12 align-self-center">
|
||||
<div class="ec-main-menu">
|
||||
<a href="javascript:void(0)" class="ec-header-btn ec-sidebar-toggle">
|
||||
<i class="fi fi-rr-apps"></i>
|
||||
</a>
|
||||
<?php
|
||||
$currentFile = basename($_SERVER['PHP_SELF']);
|
||||
if ($currentFile != 'login.php' && !isset($_SESSION["isVendor"])) { ?>
|
||||
<a href="javascript:void(0)" class="ec-header-btn ec-sidebar-toggle">
|
||||
<i class="fi fi-rr-apps"></i>
|
||||
</a>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<ul>
|
||||
<li><a href="index.php">Home</a></li>
|
||||
<!-- <li class="dropdown position-static"><a href="javascript:void(0)">Categories</a>
|
||||
|
|
16
index.php
16
index.php
|
@ -191,13 +191,13 @@ if ($_SESSION["userId"] <> "") {
|
|||
<!-- Tab Start -->
|
||||
<div class="col-md-12 text-center">
|
||||
<ul class="ec-pro-tab-nav nav justify-content-center">
|
||||
<li class="nav-item"><a class="nav-link active" data-bs-toggle="tab" href="#tab-pro-for-all">For
|
||||
<li class="nav-item"><a class="nav-link active" data-bs-toggle="tab" href="#all-top-products">For
|
||||
All</a></li>
|
||||
<li class="nav-item"><a class="nav-link" data-bs-toggle="tab" href="#tab-pro-for-men">For
|
||||
<li class="nav-item"><a class="nav-link" data-bs-toggle="tab" href="#electronics">For
|
||||
Electronics</a></li>
|
||||
<li class="nav-item"><a class="nav-link" data-bs-toggle="tab" href="#tab-pro-for-women">For
|
||||
<li class="nav-item"><a class="nav-link" data-bs-toggle="tab" href="#smart-home">For
|
||||
Smart Home</a></li>
|
||||
<li class="nav-item"><a class="nav-link" data-bs-toggle="tab" href="#tab-pro-for-child">For
|
||||
<li class="nav-item"><a class="nav-link" data-bs-toggle="tab" href="#e-vehicle">For
|
||||
E-Vehicle</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
@ -207,7 +207,7 @@ if ($_SESSION["userId"] <> "") {
|
|||
<div class="col">
|
||||
<div class="tab-content">
|
||||
<!-- 1st Product tab start -->
|
||||
<div class="tab-pane fade show active" id="tab-pro-for-all">
|
||||
<div class="tab-pane fade show active" id="all-top-products">
|
||||
<div class="row">
|
||||
<!-- Product Content -->
|
||||
<?php
|
||||
|
@ -331,7 +331,7 @@ if ($_SESSION["userId"] <> "") {
|
|||
</div>
|
||||
<!-- ec 1st Product tab end -->
|
||||
<!-- ec 2nd Product tab start -->
|
||||
<div class="tab-pane fade" id="tab-pro-for-men">
|
||||
<div class="tab-pane fade" id="electronics">
|
||||
<div class="row">
|
||||
<!-- Product Content -->
|
||||
<?php
|
||||
|
@ -453,7 +453,7 @@ if ($_SESSION["userId"] <> "") {
|
|||
</div>
|
||||
<!-- ec 2nd Product tab end -->
|
||||
<!-- ec 3rd Product tab start -->
|
||||
<div class="tab-pane fade" id="tab-pro-for-women">
|
||||
<div class="tab-pane fade" id="smart-home">
|
||||
<div class="row">
|
||||
<!-- Product Content -->
|
||||
<?php
|
||||
|
@ -573,7 +573,7 @@ if ($_SESSION["userId"] <> "") {
|
|||
</div>
|
||||
<!-- ec 3rd Product tab end -->
|
||||
<!-- ec 4th Product tab start -->
|
||||
<div class="tab-pane fade" id="tab-pro-for-child">
|
||||
<div class="tab-pane fade" id="e-vehicle">
|
||||
<div class="row">
|
||||
<!-- Product Content -->
|
||||
<?php
|
||||
|
|
|
@ -436,7 +436,7 @@ xhrVendors.onreadystatechange = function() {
|
|||
</div>
|
||||
<div class="card text-center" style="margin-left: auto; margin-right: 5px;">
|
||||
<div class="card-body">
|
||||
<h6>Seller Productsss</h6>
|
||||
<h6>Seller Products</h6>
|
||||
<p>${productCount}</p>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -783,49 +783,58 @@ maxPriceInput.addEventListener('input', function() {
|
|||
<ul>
|
||||
<li>
|
||||
<div class="ec-sidebar-block-item">
|
||||
<input type="checkbox" name="category[]" value="Electronics" <?php echo (isset($_POST['category']) && in_array('Electronics', $_POST['category'])) || (isset($_GET['category']) && in_array('Electronics', $_GET['category'])) ? 'checked' : ''; ?> /> <a>Electronics</a><span class="checked"></span>
|
||||
<input type="checkbox" name="category[]" id="electronics_category" value="Electronics" <?php echo (isset($_POST['category']) && in_array('Electronics', $_POST['category'])) || (isset($_GET['category']) && in_array('Electronics', $_GET['category'])) ? 'checked' : ''; ?> />
|
||||
<a><label for="electronics_category" style="cursor: pointer; margin: 0px;">Electronics</label></a><span class="checked"></span>
|
||||
</div>
|
||||
</li>
|
||||
<li>
|
||||
<div class="ec-sidebar-block-item">
|
||||
<input type="checkbox" name="category[]" value="Solar" <?php echo (isset($_POST['category']) && in_array('Solar', $_POST['category'])) || (isset($_GET['category']) && in_array('Solar', $_GET['category'])) ? 'checked' : ''; ?> /> <a>Solar</a><span class="checked"></span>
|
||||
<input type="checkbox" name="category[]" id="solar_category" value="Solar" <?php echo (isset($_POST['category']) && in_array('Solar', $_POST['category'])) || (isset($_GET['category']) && in_array('Solar', $_GET['category'])) ? 'checked' : ''; ?> />
|
||||
<a><label for="solar_category" style="cursor: pointer; margin: 0px;">Solar</a></label><span class="checked"></span>
|
||||
</div>
|
||||
</li>
|
||||
<li>
|
||||
<div class="ec-sidebar-block-item">
|
||||
<input type="checkbox" name="category[]" value="E-bike" <?php echo (isset($_POST['category']) && in_array('E-bike', $_POST['category'])) || (isset($_GET['category']) && in_array('E-bike', $_GET['category'])) ? 'checked' : ''; ?> /> <a>E-bike</a><span class="checked"></span>
|
||||
<input type="checkbox" name="category[]" id="e-bike_category" value="E-bike" <?php echo (isset($_POST['category']) && in_array('E-bike', $_POST['category'])) || (isset($_GET['category']) && in_array('E-bike', $_GET['category'])) ? 'checked' : ''; ?> />
|
||||
<a><label for="e-bike_category" style="cursor: pointer; margin: 0px;">E-bike</a></label><span class="checked"></span>
|
||||
</div>
|
||||
</li>
|
||||
<li>
|
||||
<div class="ec-sidebar-block-item">
|
||||
<input type="checkbox" name="category[]" value="E-vehicle" <?php echo (isset($_POST['category']) && in_array('E-vehicle', $_POST['category'])) || (isset($_GET['category']) && in_array('E-vehicle', $_GET['category'])) ? 'checked' : ''; ?> /> <a>E-vehicle</a><span class="checked"></span>
|
||||
<input type="checkbox" name="category[]" id="e-vehicle_category" value="E-vehicle" <?php echo (isset($_POST['category']) && in_array('E-vehicle', $_POST['category'])) || (isset($_GET['category']) && in_array('E-vehicle', $_GET['category'])) ? 'checked' : ''; ?> />
|
||||
<a><label for="e-vehicle_category" style="cursor: pointer; margin: 0px;">E-vehicle</a></label><span class="checked"></span>
|
||||
|
||||
</div>
|
||||
</li>
|
||||
<li>
|
||||
<div class="ec-sidebar-block-item">
|
||||
<input type="checkbox" name="category[]" value="Appliance" <?php echo (isset($_POST['category']) && in_array('Appliance', $_POST['category'])) || (isset($_GET['category']) && in_array('Appliance', $_GET['category'])) ? 'checked' : ''; ?> /> <a>Appliance</a><span class="checked"></span>
|
||||
<input type="checkbox" name="category[]" id="appliance_category" value="Appliance" <?php echo (isset($_POST['category']) && in_array('Appliance', $_POST['category'])) || (isset($_GET['category']) && in_array('Appliance', $_GET['category'])) ? 'checked' : ''; ?> />
|
||||
<a><label for="appliance_category" style="cursor: pointer; margin: 0px;">Appliance</a></label><span class="checked"></span>
|
||||
|
||||
</div>
|
||||
</li>
|
||||
<li>
|
||||
<div class="ec-sidebar-block-item">
|
||||
<input type="checkbox" name="category[]" value="Smart Home" <?php echo (isset($_POST['category']) && in_array('Smart Home', $_POST['category'])) || (isset($_GET['category']) && in_array('Smart Home', $_GET['category'])) ? 'checked' : ''; ?> /> <a>Smart Home</a><span class="checked"></span>
|
||||
<input type="checkbox" name="category[]" id="smart-home_category" value="Smart Home" <?php echo (isset($_POST['category']) && in_array('Smart Home', $_POST['category'])) || (isset($_GET['category']) && in_array('Smart Home', $_GET['category'])) ? 'checked' : ''; ?> />
|
||||
<a><label for="smart-home_category" style="cursor: pointer; margin: 0px;">Smart Home</a></label><span class="checked"></span>
|
||||
</div>
|
||||
</li>
|
||||
<li>
|
||||
<div class="ec-sidebar-block-item">
|
||||
<input type="checkbox" name="category[]" value="Home" <?php echo (isset($_POST['category']) && in_array('Home', $_POST['category'])) || (isset($_GET['category']) && in_array('Home', $_GET['category'])) ? 'checked' : ''; ?> /> <a>Home</a><span class="checked"></span>
|
||||
<input type="checkbox" name="category[]" id="home_category" value="Home" <?php echo (isset($_POST['category']) && in_array('Home', $_POST['category'])) || (isset($_GET['category']) && in_array('Home', $_GET['category'])) ? 'checked' : ''; ?> />
|
||||
<a><label for="home_category" style="cursor: pointer; margin: 0px;">Home</a></label><span class="checked"></span>
|
||||
</div>
|
||||
</li>
|
||||
<li>
|
||||
<div class="ec-sidebar-block-item">
|
||||
<input type="checkbox" name="category[]" value="Apparel" <?php echo (isset($_POST['category']) && in_array('Apparel', $_POST['category'])) || (isset($_GET['category']) && in_array('Apparel', $_GET['category'])) ? 'checked' : ''; ?> /> <a>Apparel</a><span class="checked"></span>
|
||||
<input type="checkbox" name="category[]" id="apparel_category" value="Apparel" <?php echo (isset($_POST['category']) && in_array('Apparel', $_POST['category'])) || (isset($_GET['category']) && in_array('Apparel', $_GET['category'])) ? 'checked' : ''; ?> />
|
||||
<a><label for="apparel_category" style="cursor: pointer; margin: 0px;">Apparel</a></label><span class="checked"></span>
|
||||
</div>
|
||||
</li>
|
||||
<li>
|
||||
<div class="ec-sidebar-block-item">
|
||||
<input type="checkbox" name="category[]" value="Heavy Equipment" <?php echo (isset($_POST['category']) && in_array('Heavy Equipment', $_POST['category'])) || (isset($_GET['category']) && in_array('Heavy Equipment', $_GET['category'])) ? 'checked' : ''; ?> /> <a>Heavy Equipment</a><span class="checked"></span>
|
||||
<input type="checkbox" name="category[]" id="heavy-equipment_category" value="Heavy Equipment" <?php echo (isset($_POST['category']) && in_array('Heavy Equipment', $_POST['category'])) || (isset($_GET['category']) && in_array('Heavy Equipment', $_GET['category'])) ? 'checked' : ''; ?> />
|
||||
<a><label for="heavy-equipment_category" style="cursor: pointer; margin: 0px;">Heavy Equipment</a></label><span class="checked"></span>
|
||||
</div>
|
||||
</li>
|
||||
<li>
|
||||
|
|
|
@ -1297,7 +1297,7 @@ if ($_SESSION["isVendor"] == true) {
|
|||
aria-label="Close">Close</a>
|
||||
</div> -->
|
||||
</form>
|
||||
<button type="button" class="btn btn-primary btn-pill mt-3" onclick="editUser()">Upload</button>
|
||||
<button type="button" class="btn btn-primary btn-pill mt-3" onclick="editUser()">Submit</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -7,7 +7,7 @@ $current_page = basename($_SERVER['PHP_SELF']);
|
|||
<ul>
|
||||
<li <?php if ($current_page == 'vendor-dashboard.php') echo 'class="active"'; ?>><a href="vendor-dashboard.php" id="vendor-dashboard-link">Dashboards</a></li>
|
||||
<li <?php if ($current_page == 'vendor-uploads.php') echo 'class="active"'; ?>><a onclick="addProduct();" id="vendor-uploads-link">Uploads</a></li>
|
||||
<li <?php if ($current_page == 'vendor-settings.php') echo 'class="active"'; ?>><a href="vendor-settings.php" id="vendor-settings-link">Settings (edit)</a></li>
|
||||
<li <?php if ($current_page == 'vendor-settings.php') echo 'class="active"'; ?>><a href="vendor-settings.php" id="vendor-settings-link">Vendor Profile</a></li>
|
||||
<li <?php if ($current_page == 'vendor-refund-history.php') echo 'class="active"'; ?>><a href="vendor-refund-history.php" id="vendor-refund-history-link">Vendor Refund History</a></li>
|
||||
<li <?php if ($current_page == 'vendor-payments.php') echo 'class="active"'; ?>><a href="vendor-payments.php" id="vendor-payments-link">Payments</a></li>
|
||||
<li <?php if ($current_page == 'vendor-payouts.php') echo 'class="active"'; ?>><a href="vendor-payouts.php" id="vendor-payouts-link">Payouts</a></li>
|
||||
|
|
402
wishlist.php
402
wishlist.php
|
@ -174,240 +174,244 @@ if ($_SESSION["isVendor"] == true) {
|
|||
</div>
|
||||
|
||||
<div class="row margin-minus-b-30">
|
||||
<?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" style="max-width: 290px; height: 350px;">
|
||||
<div class="ec-pro-image">
|
||||
<a href="product-left-sidebar.php?id=<?php echo $product["_id"]; ?>" class="image">
|
||||
<!-- <a href="shop-left-sidebar-col-4.php" class="image"> -->
|
||||
|
||||
<img loading="lazy" class="main-image" src="<?php echo $product["images"]; ?>" alt="Product" style="border: 1px solid #eeeeee; height: 330px; object-fit: cover;"/>
|
||||
<!-- <img loading="lazy" class="hover-image" src="<?php echo $product["images"]; ?>" alt="Product" /> -->
|
||||
</a>
|
||||
<span class="ec-com-remove ec-remove-wishlist">
|
||||
<a href="javascript:void(0)" class="remove-product" data-product-id="<?php echo $product["_id"]; ?>" id="removeItem<?php echo $product["_id"]; ?>">×</a>
|
||||
</span>
|
||||
<!-- raymart edit action feb 14 2024 -->
|
||||
<div class="ec-pro-actions" style="bottom: -70px;">
|
||||
<!-- <button title="Add To Cart" onclick="popupAddToCart(`<?php echo htmlspecialchars(json_encode($product), ENT_QUOTES, 'UTF-8'); ?>`,`<?php echo htmlspecialchars($vendorOfProduct, ENT_QUOTES, 'UTF-8'); ?>`, `<?php echo isset($_SESSION['token']) ? $_SESSION['token'] : ''; ?>` , `<?php echo isset($_SESSION['email']) ? $_SESSION['email'] : ''; ?>` , `<?php echo isset($_SESSION['password']) ? $_SESSION['password'] : ''; ?>` , `<?php echo htmlspecialchars(json_encode($customer_data), ENT_QUOTES, 'UTF-8'); ?>`);" class="add-to-cart"><i class="fi-rr-shopping-basket"></i> Add To Cart</button> -->
|
||||
<!-- <a class="ec-btn-group wishlist" title="Wishlist" onclick="popupWishlist('<?php echo htmlspecialchars(json_encode($product), ENT_QUOTES, 'UTF-8'); ?>', '<?php echo htmlspecialchars(json_encode($customer_data), ENT_QUOTES, 'UTF-8'); ?>');"><i class="fi-rr-heart"></i></a> -->
|
||||
<?php if (isset($product["sale_price"]) && $product["sale_price"] > 0) : ?>
|
||||
<?php
|
||||
if (empty($customer['favorites']['products'])) {
|
||||
echo '<div class="col-12 text-center fs-2"><p>No wishlist</p></div>'; // Display "No wishlist" message if wishlist is empty
|
||||
} else {
|
||||
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" style="max-width: 290px; height: 350px;">
|
||||
<div class="ec-pro-image">
|
||||
<a href="product-left-sidebar.php?id=<?php echo $product["_id"]; ?>" class="image">
|
||||
<!-- <a href="shop-left-sidebar-col-4.php" class="image"> -->
|
||||
|
||||
<img loading="lazy" class="main-image" src="<?php echo $product["images"]; ?>" alt="Product" style="border: 1px solid #eeeeee; height: 330px; object-fit: cover;"/>
|
||||
<!-- <img loading="lazy" class="hover-image" src="<?php echo $product["images"]; ?>" alt="Product" /> -->
|
||||
</a>
|
||||
<span class="ec-com-remove ec-remove-wishlist">
|
||||
<a href="javascript:void(0)" class="remove-product" data-product-id="<?php echo $product["_id"]; ?>" id="removeItem<?php echo $product["_id"]; ?>">×</a>
|
||||
</span>
|
||||
<!-- raymart edit action feb 14 2024 -->
|
||||
<div class="ec-pro-actions" style="bottom: -70px;">
|
||||
<!-- <button title="Add To Cart" onclick="popupAddToCart(`<?php echo htmlspecialchars(json_encode($product), ENT_QUOTES, 'UTF-8'); ?>`,`<?php echo htmlspecialchars($vendorOfProduct, ENT_QUOTES, 'UTF-8'); ?>`, `<?php echo isset($_SESSION['token']) ? $_SESSION['token'] : ''; ?>` , `<?php echo isset($_SESSION['email']) ? $_SESSION['email'] : ''; ?>` , `<?php echo isset($_SESSION['password']) ? $_SESSION['password'] : ''; ?>` , `<?php echo htmlspecialchars(json_encode($customer_data), ENT_QUOTES, 'UTF-8'); ?>`);" class="add-to-cart"><i class="fi-rr-shopping-basket"></i> Add To Cart</button> -->
|
||||
<!-- <a class="ec-btn-group wishlist" title="Wishlist" onclick="popupWishlist('<?php echo htmlspecialchars(json_encode($product), ENT_QUOTES, 'UTF-8'); ?>', '<?php echo htmlspecialchars(json_encode($customer_data), ENT_QUOTES, 'UTF-8'); ?>');"><i class="fi-rr-heart"></i></a> -->
|
||||
<?php if (isset($product["sale_price"]) && $product["sale_price"] > 0) : ?>
|
||||
<button title="Add To Cart" onclick="popupAddToCart(`<?php echo htmlspecialchars(json_encode($product), ENT_QUOTES, 'UTF-8'); ?>`,`<?php echo htmlspecialchars($vendorOfProduct, ENT_QUOTES, 'UTF-8'); ?>`, `<?php echo isset($_SESSION['token']) ? $_SESSION['token'] : ''; ?>` , `<?php echo isset($_SESSION['email']) ? $_SESSION['email'] : ''; ?>` , `<?php echo isset($_SESSION['password']) ? $_SESSION['password'] : ''; ?>` , `<?php echo htmlspecialchars(json_encode($customer_data), ENT_QUOTES, 'UTF-8'); ?>`);" class="add-to-cart"><i class="fi-rr-shopping-basket"></i> Add To Cart</button>
|
||||
|
||||
<?php elseif (isset($product["regular_price"]) && $product["regular_price"] != "") : ?>
|
||||
<button title="Add To Cart" onclick="popupAddToCart(`<?php echo htmlspecialchars(json_encode($product), ENT_QUOTES, 'UTF-8'); ?>`,`<?php echo htmlspecialchars($vendorOfProduct, ENT_QUOTES, 'UTF-8'); ?>`, `<?php echo isset($_SESSION['token']) ? $_SESSION['token'] : ''; ?>` , `<?php echo isset($_SESSION['email']) ? $_SESSION['email'] : ''; ?>` , `<?php echo isset($_SESSION['password']) ? $_SESSION['password'] : ''; ?>` , `<?php echo htmlspecialchars(json_encode($customer_data), ENT_QUOTES, 'UTF-8'); ?>`);" class="add-to-cart"><i class="fi-rr-shopping-basket"></i> Add To Cart</button>
|
||||
|
||||
<?php elseif (isset($product["regular_price"]) && $product["regular_price"] != "") : ?>
|
||||
<button title="Add To Cart" onclick="popupAddToCart(`<?php echo htmlspecialchars(json_encode($product), ENT_QUOTES, 'UTF-8'); ?>`,`<?php echo htmlspecialchars($vendorOfProduct, ENT_QUOTES, 'UTF-8'); ?>`, `<?php echo isset($_SESSION['token']) ? $_SESSION['token'] : ''; ?>` , `<?php echo isset($_SESSION['email']) ? $_SESSION['email'] : ''; ?>` , `<?php echo isset($_SESSION['password']) ? $_SESSION['password'] : ''; ?>` , `<?php echo htmlspecialchars(json_encode($customer_data), ENT_QUOTES, 'UTF-8'); ?>`);" class="add-to-cart"><i class="fi-rr-shopping-basket"></i> Add To Cart</button>
|
||||
<?php else : ($product["regular_price"] == "" || $product["regular_price"] == null) ?>
|
||||
|
||||
<?php else : ($product["regular_price"] == "" || $product["regular_price"] == null) ?>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php endif; ?>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="ec-pro-content">
|
||||
<h5 class="ec-pro-title"><a href="product-left-sidebar.php?id=<?php echo $product["_id"]; ?>"><?php echo $product["product_name"]; ?></a></h5>
|
||||
<!-- <div class="ec-pro-rating">
|
||||
<i class="ecicon eci-star fill"></i>
|
||||
<i class="ecicon eci-star fill"></i>
|
||||
<i class="ecicon eci-star fill"></i>
|
||||
<i class="ecicon eci-star fill"></i>
|
||||
<i class="ecicon eci-star"></i>
|
||||
</div> -->
|
||||
<!-- <div class="ec-pro-list-desc">Lorem Ipsum is simply dummy text of the
|
||||
printing and typesetting industry. Lorem Ipsum is simply dutmmy text
|
||||
ever since the 1500s, when an unknown printer took a galley.</div> -->
|
||||
<?php if ($product['product_type'] === 'variable') {
|
||||
$variation_products = getProductVariations($product['_id']);
|
||||
if ($variation_products) {
|
||||
$variation_details = json_decode($variation_products, true);
|
||||
}
|
||||
} ?>
|
||||
<!-- <span class="ec-price">
|
||||
<span class="old-price">$12.00 <?php echo $product["regular_price"]; ?></span>
|
||||
<span class="new-price">$10.00</span>
|
||||
</span> -->
|
||||
<?php
|
||||
if ($product['product_type'] === "simple") {
|
||||
if (isset($product['sale_price']) && $product['sale_price'] > 0) {
|
||||
echo '<span class="ec-price">';
|
||||
echo '<span class="old-price">' . $product['regular_price'] . '</span>';
|
||||
echo '<span class="new-price">' . $product['sale_price'] . '</span>';
|
||||
echo '</span>';
|
||||
} else {
|
||||
echo '<span class="new-price">' . $product['regular_price'] . '</span>';
|
||||
}
|
||||
} elseif ($product['product_type'] === "variable") {
|
||||
$lowest_regular_price = null;
|
||||
$highest_regular_price = null;
|
||||
$lowest_sale_price = null;
|
||||
$highest_sale_price = null;
|
||||
<div class="ec-pro-content">
|
||||
<h5 class="ec-pro-title"><a href="product-left-sidebar.php?id=<?php echo $product["_id"]; ?>"><?php echo $product["product_name"]; ?></a></h5>
|
||||
<!-- <div class="ec-pro-rating">
|
||||
<i class="ecicon eci-star fill"></i>
|
||||
<i class="ecicon eci-star fill"></i>
|
||||
<i class="ecicon eci-star fill"></i>
|
||||
<i class="ecicon eci-star fill"></i>
|
||||
<i class="ecicon eci-star"></i>
|
||||
</div> -->
|
||||
<!-- <div class="ec-pro-list-desc">Lorem Ipsum is simply dummy text of the
|
||||
printing and typesetting industry. Lorem Ipsum is simply dutmmy text
|
||||
ever since the 1500s, when an unknown printer took a galley.</div> -->
|
||||
<?php if ($product['product_type'] === 'variable') {
|
||||
$variation_products = getProductVariations($product['_id']);
|
||||
if ($variation_products) {
|
||||
$variation_details = json_decode($variation_products, true);
|
||||
}
|
||||
} ?>
|
||||
<!-- <span class="ec-price">
|
||||
<span class="old-price">$12.00 <?php echo $product["regular_price"]; ?></span>
|
||||
<span class="new-price">$10.00</span>
|
||||
</span> -->
|
||||
<?php
|
||||
if ($product['product_type'] === "simple") {
|
||||
if (isset($product['sale_price']) && $product['sale_price'] > 0) {
|
||||
echo '<span class="ec-price">';
|
||||
echo '<span class="old-price">' . $product['regular_price'] . '</span>';
|
||||
echo '<span class="new-price">' . $product['sale_price'] . '</span>';
|
||||
echo '</span>';
|
||||
} else {
|
||||
echo '<span class="new-price">' . $product['regular_price'] . '</span>';
|
||||
}
|
||||
} elseif ($product['product_type'] === "variable") {
|
||||
$lowest_regular_price = null;
|
||||
$highest_regular_price = null;
|
||||
$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;
|
||||
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;
|
||||
}
|
||||
// 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 ($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 ($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;
|
||||
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>';
|
||||
} elseif ($lowest_regular_price !== null && $highest_regular_price !== null) {
|
||||
echo '<span id="productPrice" class="new-price">' . '₱' . $lowest_regular_price . ' - ₱' . $highest_regular_price . '</span>';
|
||||
// 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>';
|
||||
} elseif ($lowest_regular_price !== null && $highest_regular_price !== null) {
|
||||
echo '<span id="productPrice" class="new-price">' . '₱' . $lowest_regular_price . ' - ₱' . $highest_regular_price . '</span>';
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
customerId = '<?php echo $_SESSION['customerId']; ?>'
|
||||
// Add event listener to remove button
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
var removeButtons = document.querySelectorAll('.remove-product');
|
||||
removeButtons.forEach(function(removeButton) {
|
||||
removeButton.addEventListener('click', function() {
|
||||
var productId = removeButton.getAttribute('data-product-id');
|
||||
removeProduct(productId);
|
||||
<script>
|
||||
customerId = '<?php echo $_SESSION['customerId']; ?>'
|
||||
// Add event listener to remove button
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
var removeButtons = document.querySelectorAll('.remove-product');
|
||||
removeButtons.forEach(function(removeButton) {
|
||||
removeButton.addEventListener('click', function() {
|
||||
var productId = removeButton.getAttribute('data-product-id');
|
||||
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 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);
|
||||
}
|
||||
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
|
||||
var remainingProductIds = Array.from(document.querySelectorAll('.remove-product')).map(function(button) {
|
||||
return button.getAttribute('data-product-id');
|
||||
}).filter(function(id) {
|
||||
return id !== productId;
|
||||
});
|
||||
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
|
||||
var remainingProductIds = Array.from(document.querySelectorAll('.remove-product')).map(function(button) {
|
||||
return button.getAttribute('data-product-id');
|
||||
}).filter(function(id) {
|
||||
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) {
|
||||
if (xhr.status === 200) {
|
||||
// Product removed successfully, you can handle the UI update here if needed
|
||||
console.log('Product removed successfully');
|
||||
location.reload(); // Refresh the page after removing the product
|
||||
} else {
|
||||
// Handle error response
|
||||
console.error('Error removing product:', xhr.responseText);
|
||||
// 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) {
|
||||
if (xhr.status === 200) {
|
||||
// Product removed successfully, you can handle the UI update here if needed
|
||||
console.log('Product removed successfully');
|
||||
location.reload(); // Refresh the page after removing the product
|
||||
} else {
|
||||
// Handle error response
|
||||
console.error('Error removing product:', xhr.responseText);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
// Construct data object with the remaining product IDs
|
||||
var data = JSON.stringify({
|
||||
favorites: {
|
||||
products: remainingProductIds.map(function(id) {
|
||||
// Find the product object with the corresponding ID
|
||||
var remainingProduct = <?php echo json_encode($customer['favorites']['products']); ?>.find(function(product) {
|
||||
return product['_id'] === id;
|
||||
});
|
||||
};
|
||||
// Construct data object with the remaining product IDs
|
||||
var data = JSON.stringify({
|
||||
favorites: {
|
||||
products: remainingProductIds.map(function(id) {
|
||||
// Find the product object with the corresponding ID
|
||||
var remainingProduct = <?php echo json_encode($customer['favorites']['products']); ?>.find(function(product) {
|
||||
return product['_id'] === id;
|
||||
});
|
||||
|
||||
|
||||
// Return the entire product object
|
||||
return remainingProduct;
|
||||
})
|
||||
}
|
||||
});
|
||||
|
||||
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.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) {
|
||||
if (xhr.status === 200) {
|
||||
console.log('Products removed successfully');
|
||||
location.reload();
|
||||
} else {
|
||||
console.error('Error removing products:', xhr.responseText);
|
||||
// Return the entire product object
|
||||
return remainingProduct;
|
||||
})
|
||||
}
|
||||
}
|
||||
};
|
||||
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);
|
||||
}
|
||||
});
|
||||
|
||||
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.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) {
|
||||
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 } ?>
|
||||
<?php } }?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
Loading…
Reference in New Issue