Merge branch 'main' of https://code.obanana.io/Obanana.Corporation/obanana_b2b_test into raymart_branch
This commit is contained in:
commit
fd712f1ad9
|
@ -858,21 +858,15 @@ $vendorId = $_SESSION["vendorId"];
|
|||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<!-- <label for="weight" class="form-label">Weight</label> -->
|
||||
<!-- raymart edit weight -->
|
||||
<label for="weight" class="form-label">Weight(grams)</label>
|
||||
<label for="weight" class="form-label">Weight</label>
|
||||
<input type="number" class="form-control slug-title" id="width" name="weight" value="<?php echo $array['weight']; ?>">
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<!-- <label for="length" class="form-label">Length</label> -->
|
||||
<!-- raymart edit length -->
|
||||
<label for="length" class="form-label">Length(cm)</label>
|
||||
<label for="length" class="form-label">Length</label>
|
||||
<input type="number" class="form-control slug-title" id="width" name="length" value="<?php echo $array['length']; ?>">
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<!-- <label for="width" class="form-label">Width</label> -->
|
||||
<!-- raymart edit width -->
|
||||
<label for="width" class="form-label">Width(cm)</label>
|
||||
<label for="width" class="form-label">Width</label>
|
||||
<input type="number" class="form-control slug-title" id="width" name="width" value="<?php echo $array['width']; ?>">
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
|
|
|
@ -1363,7 +1363,7 @@ function addVendor(
|
|||
$country,
|
||||
$email,
|
||||
$phone,
|
||||
$dateRegistered,
|
||||
$dateRegistered
|
||||
) {
|
||||
$curl = curl_init();
|
||||
|
||||
|
|
|
@ -334,54 +334,17 @@ if (isset($_GET['id'])) {
|
|||
<div class="ec-single-price">
|
||||
<span class="ec-single-ps-title">As low as</span>
|
||||
<?php
|
||||
if ($product_details['product_type'] === "simple") {
|
||||
if (isset($product_details['sale_price']) && $product_details['sale_price'] > 0) {
|
||||
echo '<span id="productPrice" class="old-price">' . $product_details['regular_price'] . '</span>';
|
||||
echo '<span id="productNewPrice" class="new-price">' . $product_details['sale_price'] . '</span>';
|
||||
} else {
|
||||
echo '<span id="productPrice" class="new-price">' . $product_details['regular_price'] . '</span>';
|
||||
}
|
||||
} elseif ($product_details['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;
|
||||
|
||||
// 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>';
|
||||
} elseif ($lowest_regular_price !== null && $highest_regular_price !== null) {
|
||||
echo '<span id="productPrice" class="new-price">' . '₱' . $lowest_regular_price . ' - ₱' . $highest_regular_price . '</span>';
|
||||
}
|
||||
}
|
||||
// 02-13-24 Jun Jihad Removed Logic to DIsplay Price Range of Variable Products
|
||||
if (isset($product_details['sale_price']) && $product_details['sale_price'] > 0) {
|
||||
echo '<span id="productPrice" class="old-price">' . $product_details['regular_price'] . '</span>';
|
||||
echo '<span id="productNewPrice" class="new-price">' . $product_details['sale_price'] . '</span>';
|
||||
} elseif (!isset($product_details['regular_price']) || $product_details['regular_price'] <= 0) {
|
||||
echo '<span id="productPrice" class="new-price">Contact Seller for Price</span>';
|
||||
} else {
|
||||
echo '<span id="productPrice" class="new-price">' . $product_details['regular_price'] . '</span>';
|
||||
}
|
||||
// 02-13-24 Jun Jihad Removed Logic to DIsplay Price Range of Variable Products
|
||||
?>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
<div class="ec-single-stoke">
|
||||
<span class="ec-single-ps-title">Stocks Available</span>
|
||||
|
@ -389,68 +352,83 @@ if (isset($_GET['id'])) {
|
|||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 20240212 Jun Jihad Include Parent Product in the Variation Selection -->
|
||||
<?php
|
||||
if (isset($variation_details) && is_array($variation_details)) {
|
||||
if (isset($variation_details) && is_array($variation_details)) {
|
||||
?>
|
||||
<div class="ec-pro-variation">
|
||||
<div class="ec-pro-variation-inner ec-pro-variation-size">
|
||||
<span>VARIATION</span>
|
||||
<div class="ec-pro-variation-content">
|
||||
<ul class="eccart-pro-items">
|
||||
<?php
|
||||
$main_product_image = isset($product_details["product_image"]) ? $product_details["product_image"] : 'https://upload.wikimedia.org/wikipedia/commons/6/65/No-Image-Placeholder.svg';
|
||||
?>
|
||||
<div class="ec-pro-variation">
|
||||
<div class="ec-pro-variation-inner ec-pro-variation-size">
|
||||
<span>VARIATION</span>
|
||||
<div class="ec-pro-variation-content">
|
||||
<ul class="eccart-pro-items">
|
||||
<?php
|
||||
foreach ($variation_details as $index => $variation) {
|
||||
$variationImage = isset($variation["product_image"]) ? $variation["product_image"] : 'https://upload.wikimedia.org/wikipedia/commons/6/65/No-Image-Placeholder.svg';
|
||||
?>
|
||||
<a href="javascript:void(0);" onclick="selectVariation(<?php echo htmlspecialchars(json_encode($variation), ENT_QUOTES, 'UTF-8'); ?>)">
|
||||
<li style="width: 100px; height: 100px">
|
||||
<img src="<?php echo $variationImage; ?>" alt="product">
|
||||
</li>
|
||||
</a>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
function selectVariation(variation) {
|
||||
console.log("Variation selected: ", variation);
|
||||
|
||||
document.getElementById("productDescription").innerHTML = variation.specifications;
|
||||
document.getElementById("shortDescription").innerHTML = variation.product_description;
|
||||
document.getElementById("productTitle").innerText = variation.product_name;
|
||||
document.getElementById("product_Id").value = variation._id;
|
||||
var productImage = variation.product_image || 'https://upload.wikimedia.org/wikipedia/commons/6/65/No-Image-Placeholder.svg';
|
||||
|
||||
document.getElementById('mainProductImage').src = productImage;
|
||||
|
||||
document.getElementById("productTitlemodal").innerText = variation.product_name;
|
||||
document.getElementById('mainProductImagemodal').src = productImage;
|
||||
|
||||
if (variation.regular_price || variation.sale_price) {
|
||||
// Variation has a price, show "Add to Cart" button
|
||||
document.getElementById("productPrice").innerText = variation.sale_price ? variation.sale_price : variation.regular_price;
|
||||
document.getElementById("productStock").innerText = variation.stock;
|
||||
document.getElementById('addToCartButton').disabled = false;
|
||||
document.getElementById("addToCartButton").style.display = "block";
|
||||
document.getElementById("contactSellerButton").style.display = "none";
|
||||
} else {
|
||||
// Variation doesn't have a price, show "Contact seller" button
|
||||
document.getElementById("productPrice").innerText = "Contact seller for price";
|
||||
document.getElementById("productStock").innerText = "Available";
|
||||
document.getElementById('addToCartButton').disabled = true;
|
||||
document.getElementById("addToCartButton").style.display = "none";
|
||||
document.getElementById("contactSellerButton").style.display = "block";
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<a href="javascript:void(0);" onclick="selectVariation(<?php echo htmlspecialchars(json_encode($product_details), ENT_QUOTES, 'UTF-8'); ?>)">
|
||||
<li style="width: 100px; height: 100px">
|
||||
<img src="<?php echo $main_product_image; ?>" alt="product">
|
||||
<?php foreach ($product_details['variables'] as $variable) { ?>
|
||||
<p><?php echo $variable['name'] . ': ' . $variable['value']; ?></p>
|
||||
<?php } ?>
|
||||
</li>
|
||||
</a>
|
||||
|
||||
<?php
|
||||
foreach ($variation_details as $index => $variation) {
|
||||
$variationImage = isset($variation["product_image"]) ? $variation["product_image"] : 'https://upload.wikimedia.org/wikipedia/commons/6/65/No-Image-Placeholder.svg';
|
||||
?>
|
||||
<a href="javascript:void(0);" onclick="selectVariation(<?php echo htmlspecialchars(json_encode($variation), ENT_QUOTES, 'UTF-8'); ?>)">
|
||||
<li style="width: 100px; height: 100px">
|
||||
<img src="<?php echo $variationImage; ?>" alt="product">
|
||||
<?php foreach ($variation['variables'] as $variable) { ?>
|
||||
<p><?php echo $variable['name'] . ': ' . $variable['value']; ?></p>
|
||||
<?php } ?>
|
||||
</li>
|
||||
</a>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
function selectVariation(variation) {
|
||||
console.log("Variation selected: ", variation);
|
||||
|
||||
document.getElementById("productDescription").innerHTML = variation.specifications;
|
||||
document.getElementById("shortDescription").innerHTML = variation.product_description;
|
||||
document.getElementById("productTitle").innerText = variation.product_name;
|
||||
document.getElementById("product_Id").value = variation._id;
|
||||
var productImage = variation.product_image || 'https://upload.wikimedia.org/wikipedia/commons/6/65/No-Image-Placeholder.svg';
|
||||
|
||||
document.getElementById('mainProductImage').src = productImage;
|
||||
|
||||
document.getElementById("productTitlemodal").innerText = variation.product_name;
|
||||
document.getElementById('mainProductImagemodal').src = productImage;
|
||||
|
||||
if (variation.regular_price || variation.sale_price) {
|
||||
document.getElementById("productPrice").innerText = variation.sale_price ? variation.sale_price : variation.regular_price;
|
||||
document.getElementById("productStock").innerText = variation.stock;
|
||||
document.getElementById('addToCartButton').disabled = false;
|
||||
document.getElementById("addToCartButton").style.display = "block";
|
||||
document.getElementById("contactSellerButton").style.display = "none";
|
||||
} else {
|
||||
document.getElementById("productPrice").innerText = "Contact seller for price";
|
||||
document.getElementById("productStock").innerText = "Available";
|
||||
document.getElementById('addToCartButton').disabled = true;
|
||||
document.getElementById("addToCartButton").style.display = "none";
|
||||
document.getElementById("contactSellerButton").style.display = "block";
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<!-- 20240212 Jun Jihad Include Parent Product in the Variation Selection -->
|
||||
|
||||
<div class="ec-single-qty">
|
||||
|
||||
<div class="qty-plus-minuses">
|
||||
|
@ -460,25 +438,43 @@ if (isset($variation_details) && is_array($variation_details)) {
|
|||
</div>
|
||||
|
||||
<div class="ec-single-cart">
|
||||
<?php
|
||||
if ($_SESSION["isLoggedIn"]) {
|
||||
if ($product_details['product_type'] === "variable") {
|
||||
echo '<button class="btn btn-primary" id="addToCartButton" disabled>Add To Cart</button>';
|
||||
echo '<button type="button" class="btn btn-primary" id="contactSellerButton" style="display:none" data-bs-toggle="modal" data-bs-target="#priceModal">Contact seller</button>';
|
||||
} elseif ($product_details['regular_price'] && $product_details['regular_price'] !== "") {
|
||||
// For non-variable products with a regular price, show "Add to Cart" button
|
||||
<!-- 02-13-24 Jun Jihad Contact Seller will appear to Variable products with no price -->
|
||||
<?php
|
||||
if ($_SESSION["isLoggedIn"]) {
|
||||
if ($product_details['product_type'] === "variable") {
|
||||
echo '<button class="btn btn-primary" id="addToCartButton" style="display:none">Add To Cart</button>';
|
||||
echo '<button type="button" class="btn btn-primary" id="contactSellerButton" data-bs-toggle="modal" data-bs-target="#priceModal">Contact seller</button>';
|
||||
} else {
|
||||
if (!empty($product_details['regular_price']) || !empty($product_details['sale_price'])) {
|
||||
echo '<div id="addToCartMessage"></div>';
|
||||
echo '<button class="btn btn-primary" id="addToCartButton">Add To Cart</button>';
|
||||
} else {
|
||||
// For non-variable products without a regular price, show "Contact seller" button
|
||||
echo '<button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#priceModal">Contact seller</button>';
|
||||
}
|
||||
} else {
|
||||
// If user is not logged in, prompt to log in
|
||||
echo '<p>Please log in to add to cart.</p>';
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
} else {
|
||||
echo '<p>Please log in to add to cart.</p>';
|
||||
}
|
||||
?>
|
||||
<!-- 02-13-24 Jun Jihad Contact Seller will appear to Variable products with no price -->
|
||||
|
||||
|
||||
<!-- <?php
|
||||
// if ($_SESSION["isLoggedIn"]) {
|
||||
// if ($product_details['product_type'] === "variable") {
|
||||
// echo '<button class="btn btn-primary" id="addToCartButton" disabled>Add To Cart</button>';
|
||||
// echo '<button type="button" class="btn btn-primary" id="contactSellerButton" style="display:none" data-bs-toggle="modal" data-bs-target="#priceModal">Contact seller</button>';
|
||||
// } elseif ($product_details['regular_price'] && $product_details['regular_price'] !== "") {
|
||||
// echo '<div id="addToCartMessage"></div>';
|
||||
// echo '<button class="btn btn-primary" id="addToCartButton">Add To Cart</button>';
|
||||
// } else {
|
||||
// echo '<button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#priceModal">Contact seller</button>';
|
||||
// }
|
||||
// } else {
|
||||
// echo '<p>Please log in to add to cart.</p>';
|
||||
// }
|
||||
?> -->
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
<?php
|
||||
// update_selected_variation.php
|
||||
|
||||
// Retrieve the JSON data sent via AJAX
|
||||
$data = json_decode(file_get_contents('php://input'), true);
|
||||
|
||||
// You can process the $data as needed, for example, store it in session
|
||||
session_start();
|
||||
$_SESSION['selected_variation'] = $data;
|
||||
|
||||
var_dump($_SESSION['selected_variation']);
|
||||
// You can also return a response if needed
|
||||
// echo json_encode(['success' => true]);
|
|
@ -1,4 +1,4 @@
|
|||
<div class="ec-vendor-block-items">
|
||||
<!-- <div class="ec-vendor-block-items">
|
||||
<ul>
|
||||
<li <?php if ($_SERVER['REQUEST_URI'] == '/user-profile.php') echo 'class="active"'; ?>><a href="user-profile.php" id="user-profile-link">User Profile</a></li>
|
||||
<li <?php if ($_SERVER['REQUEST_URI'] == '/user-history.php') echo 'class="active"'; ?>><a href="user-history.php" id="purchase-history-link">Purchase History</a></li>
|
||||
|
@ -8,6 +8,28 @@
|
|||
</div>
|
||||
|
||||
|
||||
<style>.ec-vendor-block-items ul li.active a {
|
||||
color: white !important; /* Change the text color */
|
||||
background-color: #3474d4; /* Change the background color */
|
||||
padding: 10px;
|
||||
border-radius: 10px;
|
||||
}
|
||||
</style> -->
|
||||
|
||||
<?php
|
||||
$current_page = basename($_SERVER['PHP_SELF']);
|
||||
?>
|
||||
|
||||
<div class="ec-vendor-block-items">
|
||||
<ul>
|
||||
<li <?php if ($current_page == 'user-profile.php') echo 'class="active"'; ?>><a href="user-profile.php" id="user-profile-link">User Profile</a></li>
|
||||
<li <?php if ($current_page == 'user-history.php') echo 'class="active"'; ?>><a href="user-history.php" id="purchase-history-link">Purchase History</a></li>
|
||||
<li <?php if ($current_page == 'user-refund-history.php') echo 'class="active"'; ?>><a href="user-refund-history.php" id="refund-history-link">User Refund History</a></li>
|
||||
<li <?php if ($current_page == 'wishlist.php') echo 'class="active"'; ?>><a href="wishlist.php" id="wishlist-link">Wishlist</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
|
||||
<style>.ec-vendor-block-items ul li.active a {
|
||||
color: white !important; /* Change the text color */
|
||||
background-color: #3474d4; /* Change the background color */
|
||||
|
|
|
@ -119,13 +119,14 @@ $products = productList();
|
|||
<img class="v-img" src=<?php echo $vendorData['vendor_image'] ?> alt="vendor image">
|
||||
<h5 class="name"><?php echo $vendorData['user_login'] ?></h5>
|
||||
</div>
|
||||
<div class="ec-vendor-block-items">
|
||||
<!-- <div class="ec-vendor-block-items">
|
||||
<ul>
|
||||
<li><a href="vendor-dashboard.php">Dashboard</a></li>
|
||||
<li><a href="vendor-uploads-add-product-action.php">Upload Product</a></li>
|
||||
<li><a href="vendor-settings.php">Settings (Edit)</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div> -->
|
||||
<?php include "vendor-user-tabs.php" ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -127,13 +127,15 @@ if (is_array($vendorOrderss)) {
|
|||
<img class="v-img" src=<?php echo $vendorData['vendor_image'] ?> alt="vendor image">
|
||||
<h5 class="name"><?php echo $vendorData['user_login'] ?></h5>
|
||||
</div>
|
||||
<div class="ec-vendor-block-items">
|
||||
<!-- <div class="ec-vendor-block-items">
|
||||
|
||||
<ul>
|
||||
<li><a href="vendor-dashboard.php">Dashboard</a></li>
|
||||
<li><a onclick="addProduct();" href="">Upload Product</a></li>
|
||||
<li><a href="vendor-settings.php">Settings (Edit)</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div> -->
|
||||
<?php include "vendor-user-tabs.php" ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -115,19 +115,20 @@ if ($_SESSION["userId"] <> "") {
|
|||
<!-- Sidebar Category Block -->
|
||||
<div class="ec-sidebar-block">
|
||||
<div class="ec-vendor-block">
|
||||
<div class="ec-vendor-block-items">
|
||||
<!-- <div class="ec-vendor-block-items">
|
||||
<ul>
|
||||
<!-- <li><a href="vendor-dashboard.php">Dashboard</a></li>
|
||||
<li><a href="vendor-dashboard.php">Dashboard</a></li>
|
||||
<li><a href="vendor-profile.html">Public Profile</a></li>
|
||||
<li><a href="vendor-uploads.html">Uploads</a></li>
|
||||
<li><a href="vendor-uploads.php">Uploads</a></li>
|
||||
<li><a href="#">Track Shipping</a></li>
|
||||
<li><a href="vendor-settings.php">Settings (Edit)</a></li> -->
|
||||
<li><a href="vendor-settings.php">Settings (Edit)</a></li>
|
||||
<li><a href="vendor-dashboard.php">Dashboard</a></li>
|
||||
<li><a href="vendor-uploads-add-product-action.php">Upload Product</a></li>
|
||||
<li><a href="vendor-settings.php">Settings (Edit)</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div> -->
|
||||
<?php include "vendor-user-tabs.php" ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -47,4 +47,3 @@ $response = addProduct(
|
|||
$array = json_decode($response,true);
|
||||
$_SESSION['newProductId'] = $array['_id'];
|
||||
header("location: vendor-uploads.php");
|
||||
?>
|
|
@ -0,0 +1,22 @@
|
|||
<!-- 2024-02-12 Stacy created this file -->
|
||||
<?php
|
||||
$current_page = basename($_SERVER['PHP_SELF']);
|
||||
?>
|
||||
|
||||
<div class="ec-vendor-block-items">
|
||||
<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>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
|
||||
<style>.ec-vendor-block-items ul li.active a {
|
||||
color: white !important; /* Change the text color */
|
||||
background-color: #3474d4; /* Change the background color */
|
||||
padding: 10px;
|
||||
border-radius: 10px;
|
||||
}
|
||||
</style>
|
||||
<!-- 2024-02-12 Stacy created this file -->
|
Loading…
Reference in New Issue