Compare commits

...

14 Commits

Author SHA1 Message Date
raymart fd712f1ad9 Merge branch 'main' of https://code.obanana.io/Obanana.Corporation/obanana_b2b_test into raymart_branch 2024-02-14 02:16:10 -08:00
raymart 3652cc560e mak 2024-02-14 02:03:59 -08:00
MarkHipe 97c6a51083 Merge pull request 'Vendor User Tabs' (#6) from jun-branch into main
Reviewed-on: #6
2024-02-14 17:55:21 +08:00
Jun Barroga a004d1e7d5 Vendor User Tabs 2024-02-14 17:47:28 +08:00
erwin 61d9aaf104 Merge pull request 'include parent in selection list for variable product' (#5) from jun-branch into main
Reviewed-on: #5
2024-02-14 11:02:21 +08:00
erwin ac3de653e4 Merge pull request 'revert d1cb60d90878ce4df748fa7c93d8f93f0e72c0b5' (#4) from erwin-patch-1 into main
Reviewed-on: #4
2024-02-14 10:33:10 +08:00
erwin 13f24b47d2 revert d1cb60d908
revert Merge pull request 'first commit for highlighting active tab' (#3) from stacy_branch into main

Reviewed-on: #3
2024-02-14 10:32:33 +08:00
erwin d1cb60d908 Merge pull request 'first commit for highlighting active tab' (#3) from stacy_branch into main
Reviewed-on: #3
2024-02-14 10:13:12 +08:00
erwin b8cb888883 Merge pull request 'raymart_branch' (#2) from raymart_branch into main
Reviewed-on: #2
2024-02-14 09:09:25 +08:00
erwin 37e3b8da2a Merge branch 'main' into raymart_branch 2024-02-14 09:08:29 +08:00
raymart 44a3232c79 edit admin/vendor weight, height, length, width 2024-02-13 02:29:15 -08:00
raymart 2f20bc4f9b edit admin/vendor for weight, height, length, width 2024-02-13 02:12:34 -08:00
Jun Barroga 959f2e6258 First Commit 2024-02-13 17:54:24 +08:00
Staycie 6567276f11 first commit for highlighting active tab 2024-02-12 21:41:31 +08:00
14 changed files with 319 additions and 152 deletions

View File

@ -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">

View File

@ -65,6 +65,26 @@ if ($_SESSION["userId"] <> "") {
});
}
</script>
<!-- raymart added css feb 14 2024 -->
<style>
.ec-product-inner .ec-pro-image .ec-pro-actions .add-to-cart {
width: 35px;
position: absolute;
right: 15px;
bottom: 36px;
margin: 0;
padding: 0;
font-size: 0;
border-radius: 10px 10px 0 0;
}
.ec-product-inner .ec-pro-image .ec-pro-actions .wishlist {
position: absolute;
right: 15px;
bottom: 0;
border-radius: 0 0 10px 10px;
}
</style>
</head>
<body onload="updateCartItemCount(); updateWishItemCount()" class="shop_page">
@ -284,6 +304,8 @@ if ($_SESSION["userId"] <> "") {
<?php
//var_dump($products);
foreach ($products as $product) {
// raymart added vendorproduct feb 14 2024
$vendorOfProduct = getVendorbyId($product['vendor_api_id']);
?>
<div class="col-lg-4 col-md-6 col-sm-6 col-xs-6 mb-6 pro-gl-content">
<div class="ec-product-inner">
@ -304,13 +326,18 @@ if ($_SESSION["userId"] <> "") {
}
?>
</a>
<span class="percentage">20%</span>
<!-- raymart edit action feb 14 2024 -->
<div class="ec-pro-actions">
<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>
</div>
<!-- <span class="percentage">20%</span>
<a href="#" class="quickview" data-link-action="quickview" title="Quick view" data-bs-toggle="modal" data-bs-target="#ec_quickview_modal"><i class="fi-rr-eye"></i></a>
<div class="ec-pro-actions">
<a href="compare.html" class="ec-btn-group compare" title="Compare"><i class="fi fi-rr-arrows-repeat"></i></a>
<button title="Add To Cart" class="add-to-cart"><i class="fi-rr-shopping-basket"></i> Add To Cart</button>
<a class="ec-btn-group wishlist" title="Wishlist"><i class="fi-rr-heart"></i></a>
</div>
</div> -->
</div>
</div>
<div class="ec-pro-content">
@ -1062,6 +1089,8 @@ if ($_SESSION["userId"] <> "") {
<!-- Main Js -->
<script src="assets/js/vendor/index.js"></script>
<script src="assets/js/main.js"></script>
<!-- raymart added js link feb 14 2024 -->
<script src="assets/js/tester3.js"></script>
</body>

View File

@ -1363,7 +1363,7 @@ function addVendor(
$country,
$email,
$phone,
$dateRegistered,
$dateRegistered
) {
$curl = curl_init();

View File

@ -573,10 +573,15 @@ if ($_SESSION["userId"] <> "") {
<img class="hover-image" src="<?php echo $forAll[$pid]["product_image"] ?>" alt="Product" />
</a>
<!-- <span class="percentage">20%</span> -->
<!-- raymart edit action -->
<div class="ec-pro-actions">
<button title="Add To Cart" onclick="popupAddToCart(`<?php echo htmlspecialchars(json_encode($forAll[$pid]), 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($forAll[$pid]), ENT_QUOTES, 'UTF-8'); ?>', '<?php echo htmlspecialchars(json_encode($customer_data), ENT_QUOTES, 'UTF-8'); ?>');"><i class="fi-rr-heart"></i></a>
</div>
<!-- <div class="ec-pro-actions">
<button title="Add To Cart" onclick="popupAddToCart('<?php echo htmlspecialchars(json_encode($forAll[$pid]), 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" onclick="popupWishlist('<?php echo htmlspecialchars(json_encode($forAll[$pid]), ENT_QUOTES, 'UTF-8'); ?>', '<?php echo htmlspecialchars(json_encode($customer_data), ENT_QUOTES, 'UTF-8'); ?>');" title="Wishlist"><i class="fi-rr-heart"></i></a>
</div>
</div> -->
</div>
</div>
<div class="ec-pro-content">
@ -639,6 +644,8 @@ if ($_SESSION["userId"] <> "") {
} else {
for ($x = 0; $x <= 7; $x++) {
$pid = rand(0, count($electronics) - 1);
// raymart added vendorproduct feb 14 2024
$vendorOfProduct = getVendorbyId($electronics[$pid]['vendor_api_id']);
?>
<div class="col-lg-3 col-md-6 col-sm-6 col-xs-6 mb-6 ec-product-content" data-animation="fadeIn">
<div class="ec-product-inner">
@ -649,10 +656,16 @@ if ($_SESSION["userId"] <> "") {
<img class="hover-image" src="<?php echo $electronics[$pid]["product_image"] ?>" alt="Product" />
</a>
<!-- <span class="percentage">20%</span> -->
<!-- raymart edit action feb 14 2024-->
<div class="ec-pro-actions">
<button title="Add To Cart" onclick="popupAddToCart(`<?php echo htmlspecialchars(json_encode($electronics[$pid]), 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($electronics[$pid]), ENT_QUOTES, 'UTF-8'); ?>', '<?php echo htmlspecialchars(json_encode($customer_data), ENT_QUOTES, 'UTF-8'); ?>');"><i class="fi-rr-heart"></i></a>
</div>
<!-- <div class="ec-pro-actions">
<button title="Add To Cart" class="add-to-cart"><i class="fi-rr-shopping-basket"></i> Add To Cart</button>
<a class="ec-btn-group wishlist" title="Wishlist"><i class="fi-rr-heart"></i></a>
</div>
</div> -->
</div>
</div>
<div class="ec-pro-content">
@ -716,6 +729,8 @@ if ($_SESSION["userId"] <> "") {
} else {
for ($x = 0; $x <= 7; $x++) {
$pid = rand(0, count($smartHome) - 1);
// raymart added vendorproduct feb 14 2024
$vendorOfProduct = getVendorbyId($smartHome[$pid]['vendor_api_id']);
?>
<div class="col-lg-3 col-md-6 col-sm-6 col-xs-6 mb-6 ec-product-content" data-animation="fadeIn">
<div class="ec-product-inner">
@ -726,10 +741,15 @@ if ($_SESSION["userId"] <> "") {
<img class="hover-image" src="<?php echo $smartHome[$pid]["product_image"] ?>" alt="Product" />
</a>
<!-- <span class="percentage">20%</span> -->
<!-- raymart edit action feb 14 2024-->
<div class="ec-pro-actions">
<button title="Add To Cart" onclick="popupAddToCart(`<?php echo htmlspecialchars(json_encode($smartHome[$pid]), 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($smartHome[$pid]), ENT_QUOTES, 'UTF-8'); ?>', '<?php echo htmlspecialchars(json_encode($customer_data), ENT_QUOTES, 'UTF-8'); ?>');"><i class="fi-rr-heart"></i></a>
</div>
<!-- <div class="ec-pro-actions">
<button title="Add To Cart" class="add-to-cart"><i class="fi-rr-shopping-basket"></i> Add To Cart</button>
<a class="ec-btn-group wishlist" title="Wishlist"><i class="fi-rr-heart"></i></a>
</div>
</div> -->
</div>
</div>
<div class="ec-pro-content">
@ -792,6 +812,8 @@ if ($_SESSION["userId"] <> "") {
} else {
for ($x = 0; $x <= 7; $x++) {
$pid = rand(0, count($home) - 1);
// raymart added vendorproduct feb 14 2024
$vendorOfProduct = getVendorbyId($forVehicle[$pid]['vendor_api_id']);
?>
<div class="col-lg-3 col-md-6 col-sm-6 col-xs-6 mb-6 ec-product-content" data-animation="fadeIn">
<div class="ec-product-inner">
@ -802,11 +824,15 @@ if ($_SESSION["userId"] <> "") {
<img class="hover-image" src="<?php echo $forVehicle[$pid]["product_image"] ?>" alt="Product" />
</a>
<!-- <span class="percentage">20%</span> -->
<!-- raymart added action feb 14 2024-->
<div class="ec-pro-actions">
<button title="Add To Cart" onclick="popupAddToCart(`<?php echo htmlspecialchars(json_encode($forVehicle[$pid]), 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($forVehicle[$pid]), ENT_QUOTES, 'UTF-8'); ?>', '<?php echo htmlspecialchars(json_encode($customer_data), ENT_QUOTES, 'UTF-8'); ?>');"><i class="fi-rr-heart"></i></a>
</div>
<!-- <div class="ec-pro-actions">
<button title="Add To Cart" class="add-to-cart"><i class="fi-rr-shopping-basket"></i> Add To Cart</button>
<a class="ec-btn-group wishlist" title="Wishlist"><i class="fi-rr-heart"></i></a>
</div>
</div> -->
</div>
</div>
<div class="ec-pro-content">
@ -1371,6 +1397,8 @@ if ($_SESSION["userId"] <> "") {
} else {
for ($x = 0; $x <= 3; $x++) {
$pid = rand(0, count($newArrival) - 1);
// raymart added vendorproduct feb 14 2024
$vendorOfProduct = getVendorbyId($newArrival[$pid]['vendor_api_id']);
?>
<div class="col-lg-3 col-md-6 col-sm-6 col-xs-6 mb-6 ec-product-content" data-animation="flipInY">
<div class="ec-product-inner">
@ -1380,10 +1408,15 @@ if ($_SESSION["userId"] <> "") {
<img class="main-image" src="<?php echo $newArrival[$pid]["product_image"] ?>" alt="Product" />
<img class="hover-image" src="<?php echo $newArrival[$pid]["product_image"] ?>" alt="Product" />
</a>
<!-- raymart edit action feb 14 2024 -->
<div class="ec-pro-actions">
<button title="Add To Cart" onclick="popupAddToCart(`<?php echo htmlspecialchars(json_encode($newArrival[$pid]), 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($newArrival[$pid]), ENT_QUOTES, 'UTF-8'); ?>', '<?php echo htmlspecialchars(json_encode($customer_data), ENT_QUOTES, 'UTF-8'); ?>');"><i class="fi-rr-heart"></i></a>
</div>
<!-- <div class="ec-pro-actions">
<button title="Add To Cart" class="add-to-cart"><i class="fi-rr-shopping-basket"></i> Add To Cart</button>
<a class="ec-btn-group wishlist" title="Wishlist"><i class="fi-rr-heart"></i></a>
</div>
</div> -->
</div>
</div>
<div class="ec-pro-content">
@ -2023,7 +2056,9 @@ if ($_SESSION["userId"] <> "") {
<!-- Main Js -->
<script src="assets/js/vendor/index.js"></script>
<script src="assets/js/main.js"></script>
<script src="assets/js/texts2.js"></script>
<!-- <script src="assets/js/texts2.js"></script> -->
<!-- raymart added js feb 14, 2024-->
<script src="assets/js/tester3.js"></script>
</body>
</html>

View File

@ -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">' . '&#8369;' . $lowest_sale_price . ' - &#8369;' . $highest_sale_price . '</span>';
} elseif ($lowest_regular_price !== null && $highest_regular_price !== null) {
echo '<span id="productPrice" class="new-price">' . '&#8369;' . $lowest_regular_price . ' - &#8369;' . $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>

13
selected_variation.php Normal file
View File

@ -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]);

View File

@ -68,6 +68,26 @@ if ($_SESSION["userId"] <> "") {
});
}
</script>
<!-- raymart added css feb 14 2024 -->
<style>
.ec-product-inner .ec-pro-image .ec-pro-actions .add-to-cart {
width: 35px;
position: absolute;
right: 15px;
bottom: 36px;
margin: 0;
padding: 0;
font-size: 0;
border-radius: 10px 10px 0 0;
}
.ec-product-inner .ec-pro-image .ec-pro-actions .wishlist {
position: absolute;
right: 15px;
bottom: 0;
border-radius: 0 0 10px 10px;
}
</style>
</head>
<body class="shop_page" onload="updateCartItemCount(); updateWishItemCount()">
@ -150,7 +170,10 @@ if ($_SESSION["userId"] <> "") {
$endIndex = $startIndex + $productsPerPage - 1;
$endIndex = min($endIndex, count($simpleProducts) - 1);
for ($i = $startIndex; $i <= $endIndex; $i++) {
// $vendorOfProduct = getVendorbyId($product['vendor_api_id']);
$pid = $i;
$vendorOfProduct = getVendorbyId($simpleProducts[$pid]['vendor_api_id']);
?>
<div class="col-lg-4 col-md-6 col-sm-6 col-xs-6 mb-6 pro-gl-content width-100">
<div class="ec-product-inner">
@ -161,13 +184,18 @@ if ($_SESSION["userId"] <> "") {
<img class="main-image" src="<?php echo $simpleProducts[$pid]["product_image"] ?>" alt="Product" />
<img class="hover-image" src="<?php echo $simpleProducts[$pid]["product_image"] ?>" alt="Product" />
</a>
<span class="percentage">20%</span>
<div class="ec-pro-actions">
<button title="Add To Cart" onclick="popupAddToCart(`<?php echo htmlspecialchars(json_encode($simpleProducts[$pid]), 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($simpleProducts[$pid]), ENT_QUOTES, 'UTF-8'); ?>', '<?php echo htmlspecialchars(json_encode($customer_data), ENT_QUOTES, 'UTF-8'); ?>');"><i class="fi-rr-heart"></i></a>
</div>
<!-- <span class="percentage">20%</span>
<a href="#" class="quickview" data-link-action="quickview" title="Quick view" data-bs-toggle="modal" data-bs-target="#ec_quickview_modal"><i class="fi-rr-eye"></i></a>
<div class="ec-pro-actions">
<a href="compare.html" class="ec-btn-group compare" title="Compare"><i class="fi fi-rr-arrows-repeat"></i></a>
<button title="Add To Cart" class="add-to-cart"><i class="fi-rr-shopping-basket"></i> Add To Cart</button>
<a class="ec-btn-group wishlist" title="Wishlist"><i class="fi-rr-heart"></i></a>
</div>
</div> -->
</div>
</div>
<div class="ec-pro-content">
@ -815,6 +843,8 @@ if ($_SESSION["userId"] <> "") {
<script src="assets/js/vendor/index.js"></script>
<script src="assets/js/main.js"></script>
<script src="assets/js/newjs.js"></script>
<!-- raymart added js link feb 14 2024 -->
<script src="assets/js/tester3.js"></script>
</body>

View File

@ -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 */

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -47,4 +47,3 @@ $response = addProduct(
$array = json_decode($response,true);
$_SESSION['newProductId'] = $array['_id'];
header("location: vendor-uploads.php");
?>

22
vendor-user-tabs.php Normal file
View File

@ -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 -->

View File

@ -65,6 +65,26 @@ if ($_SESSION["userId"] <> "") {
});
}
</script>
<!-- raymart added css feb 14 2024 -->
<style>
.ec-product-inner .ec-pro-image .ec-pro-actions .add-to-cart {
width: 35px;
position: absolute;
right: 15px;
bottom: 36px;
margin: 0;
padding: 0;
font-size: 0;
border-radius: 10px 10px 0 0;
}
.ec-product-inner .ec-pro-image .ec-pro-actions .wishlist {
position: absolute;
right: 15px;
bottom: 0;
border-radius: 0 0 10px 10px;
}
</style>
</head>
<body onload="updateCartItemCount(); updateWishItemCount()">
@ -125,7 +145,10 @@ if ($_SESSION["userId"] <> "") {
<div class="ec-compare-content">
<div class="ec-compare-inner">
<div class="row margin-minus-b-30">
<?php foreach ($customer['favorites']['products'] as $product) { ?>
<?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">
<div class="ec-pro-image-outer">
@ -137,12 +160,10 @@ if ($_SESSION["userId"] <> "") {
<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>
<span class="percentage">20%</span>
<a href="#" class="quickview" data-link-action="quickview" title="Quick view" data-bs-toggle="modal" data-bs-target="#ec_quickview_modal"><i class="fi-rr-eye"></i></a>
<!-- raymart edit action feb 14 2024 -->
<div class="ec-pro-actions">
<a href="compare.html" class="ec-btn-group compare" title="Compare"><i class="fi fi-rr-arrows-repeat"></i></a>
<button title="Add To Cart" class="add-to-cart"><i class="fi-rr-shopping-basket"></i> Add To Cart</button>
<a class="ec-btn-group wishlist" title="Wishlist"><i class="fi-rr-heart"></i></a>
<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>
</div>
</div>
</div>
@ -657,6 +678,8 @@ if ($_SESSION["userId"] <> "") {
<!-- 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>
</body>