mark_4 #88
|
@ -1056,6 +1056,9 @@ $allSignups = array_merge($all_customers, $all_vendors);
|
|||
<div class="card card-table-border-none card-default recent-orders" id="recent-orders">
|
||||
<div class="card-header justify-content-between">
|
||||
<h2>Recent Orders</h2>
|
||||
<!-- <div class="date-range-report">
|
||||
<span></span>
|
||||
</div> -->
|
||||
</div>
|
||||
<div class="card-body pt-0 pb-5">
|
||||
<table class="table card-table table-responsive table-responsive-large"
|
||||
|
|
|
@ -93,7 +93,7 @@ $vendorSearchResult = $_SESSION["vendorSearchResult"];
|
|||
<!-- Sidebar toggle button -->
|
||||
<button id="sidebar-toggler" class="sidebar-toggle"></button>
|
||||
<!-- search form -->
|
||||
|
||||
|
||||
<!-- 03-07-2024 Stacy & Raymart modified this block of code -->
|
||||
<div class="search-form d-lg-inline-block">
|
||||
<form action="vendor-product-search-action.php">
|
||||
|
@ -648,22 +648,22 @@ $vendorSearchResult = $_SESSION["vendorSearchResult"];
|
|||
</header>
|
||||
|
||||
|
||||
<!-- 3-19-24 raymart added vendor search -->
|
||||
<?php if (!empty($vendorSearchResult['results'])) : ?>
|
||||
<div class="shop-pro-content" style="margin-bottom:40px; margin-right: 2%; margin-left: 2%;">
|
||||
<div class="ec-product-inner">
|
||||
<h5 class="ec-pro-title" style="margin-top: 25px; margin-left: 5%; font-size: 25px;">Vendor Search Results</h5>
|
||||
<div class="row mt-4">
|
||||
<?php
|
||||
$count = 0;
|
||||
foreach ($vendorSearchResult['results'] as $vendor) {
|
||||
if ($count < 2) {
|
||||
?>
|
||||
<div class="col-md-12">
|
||||
<div class="card" style="margin:5px">
|
||||
<div class="card-body">
|
||||
<div class="vendor-info" style="display: flex; align-items: center;">
|
||||
<div class="ec-catalog-vendor" style="display: inline-block;">
|
||||
<!-- 3-19-24 raymart added vendor search -->
|
||||
<?php if (!empty($vendorSearchResult['results'])) : ?>
|
||||
<div class="shop-pro-content" style="margin-bottom:40px; margin-right: 2%; margin-left: 2%;">
|
||||
<div class="ec-product-inner">
|
||||
<h5 class="ec-pro-title" style="margin-top: 25px; margin-left: 5%; font-size: 25px;">Vendor Search Results</h5>
|
||||
<div class="row mt-4">
|
||||
<?php
|
||||
$count = 0;
|
||||
foreach ($vendorSearchResult['results'] as $vendor) {
|
||||
if ($count < 2) {
|
||||
?>
|
||||
<div class="col-md-12">
|
||||
<div class="card" style="margin:5px">
|
||||
<div class="card-body">
|
||||
<div class="vendor-info" style="display: flex; align-items: center;">
|
||||
<div class="ec-catalog-vendor" style="display: inline-block;">
|
||||
<a href="vendor-profile.php?id=<?php echo $vendor["_id"] ?>">
|
||||
<?php if (isset($vendor['vendor_image'])) : ?>
|
||||
<img loading="lazy" src="<?php echo $vendor['vendor_image']; ?>" alt="<?php echo $vendor['user_login']; ?>" class="vendor-image" style="max-width: 100px; max-height: 100px;">
|
||||
|
@ -671,117 +671,124 @@ $vendorSearchResult = $_SESSION["vendorSearchResult"];
|
|||
<img loading="lazy" src="https://api.obanana.com/images/storage/web_images/1708588564876-viber_image_2024-02-22_15-54-42-498.png" class="vendor-image-placeholder" style="max-width: 100px; max-height: 100px;">
|
||||
<?php endif; ?>
|
||||
</a>
|
||||
</div>
|
||||
<div class="vendor-details" style="display:inline-block;">
|
||||
<h6 class="ec-pro-title" style="padding:0 30px;font-family: Poppins, sans-serif; text-decoration: none; color: #777;white-space: nowrap;text-overflow: ellipsis;display: block;font-size: 16px;font-weight: 400;">
|
||||
<a href="vendor-profile.php?id=<?php echo $vendor["_id"] ?>">
|
||||
<?php echo $vendor['user_login']; ?>
|
||||
</a>
|
||||
</h6>
|
||||
</div>
|
||||
<div class="card text-center" style="margin-left: auto; margin-right: 5px;">
|
||||
<div class="card-body">
|
||||
<h6>Seller Products</h6>
|
||||
<?php
|
||||
$products = productList();
|
||||
$vendorId = $vendor['_id'];
|
||||
$product = array_filter($products, function ($var) use ($vendorId) {
|
||||
return ($var['vendor_api_id'] == $vendorId);
|
||||
});
|
||||
?>
|
||||
<p><?php echo count($product); ?></p>
|
||||
</div>
|
||||
<div class="vendor-details" style="display:inline-block;">
|
||||
<h6 class="ec-pro-title" style="padding:0 30px;font-family: Poppins, sans-serif; text-decoration: none; color: #777;white-space: nowrap;text-overflow: ellipsis;display: block;font-size: 16px;font-weight: 400;">
|
||||
<a href="vendor-profile.php?id=<?php echo $vendor["_id"] ?>">
|
||||
<?php echo $vendor['user_login']; ?>
|
||||
</a>
|
||||
</h6>
|
||||
</div>
|
||||
<div class="card text-center" style="margin-left: auto; margin-right: 5px;">
|
||||
<div class="card-body">
|
||||
<h6>Seller Products</h6>
|
||||
</div>
|
||||
<div class="card text-center" style="margin-left: 5px; margin-right: 5px;">
|
||||
<div class="card-body">
|
||||
<h6>Seller since</h6>
|
||||
<p>
|
||||
<?php
|
||||
$products = productList();
|
||||
$vendorId = $vendor['_id'];
|
||||
$product = array_filter($products, function ($var) use ($vendorId) {
|
||||
return ($var['vendor_api_id'] == $vendorId);
|
||||
});
|
||||
if (!empty($vendor['date_registered'])) {
|
||||
echo $vendor['date_registered'];
|
||||
} else {
|
||||
echo "Not yet registered";
|
||||
}
|
||||
?>
|
||||
<p><?php echo count($product); ?></p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card text-center" style="margin-left: 5px; margin-right: 5px;">
|
||||
<div class="card-body">
|
||||
<h6>Seller since</h6>
|
||||
<p><?php echo $vendor['date_registered']; ?></p>
|
||||
</div>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
$count++;
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<!-- vendor search end -->
|
||||
|
||||
<!-- 3-19-24 raymart added Shop content Start -->
|
||||
<div class="shop-pro-content" style="margin-right: 2%; margin-left: 2%;">
|
||||
<div class="shop-pro-inner list-view">
|
||||
<div class="row">
|
||||
<?php
|
||||
// $productSearchResult = [];
|
||||
// foreach ($productSearchResult['results'] as $product => $productListVendor) {
|
||||
// echo "$product .":" . $productListVendor";
|
||||
// $vendorOfProduct = getVendorbyId($product['vendor_api_id']);
|
||||
|
||||
$products = productListVendor($vendorId);
|
||||
$totalProducts = count($products);
|
||||
|
||||
|
||||
for ($i = 0; $i <= $totalProducts - 1; $i++) {
|
||||
$product = $products[$i];
|
||||
?>
|
||||
<div class="col-lg-3 col-md-4 col-sm-6">
|
||||
<div class="card-wrapper">
|
||||
<div class="card-container">
|
||||
<div class="card-top">
|
||||
<div class="image-container" style="height: 300px;"> <!-- Adjust the height as needed -->
|
||||
<?php
|
||||
if (isset($product['images'])) {
|
||||
$image_urls = explode(',', $product['images']);
|
||||
if (!empty($image_urls)) {
|
||||
$first_image_url = trim($image_urls[0]);
|
||||
?>
|
||||
<img loading="lazy" class="img-fluid" src="<?php echo $first_image_url; ?>" alt="edit" style="object-fit: cover; width: 100%; height: 100%;"/>
|
||||
<?php
|
||||
}
|
||||
} else {
|
||||
?>
|
||||
<img loading="lazy" class="img-fluid rounded-circle" src="https://api.obanana.com/images/storage/web_images/1710214273217-no_image.png" alt="edit" />
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-bottom">
|
||||
<h3><?php echo $product['product_name']; ?></h3>
|
||||
<p>₱<?php echo $product['regular_price']; ?></p>
|
||||
</div>
|
||||
<div class="card-action">
|
||||
<div class="card-edit" onclick="editProduct('<?php echo $product['_id'] ?>');"><i class="mdi mdi-circle-edit-outline"></i></div>
|
||||
<div class="card-preview"><i class="mdi mdi-eye-outline"></i></div>
|
||||
<div class="card-remove" onclick="deleteProd('<?php echo $product['_id'] ?>');"><i class="mdi mdi mdi-delete-outline"></i></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
$count++;
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!--Shop content End -->
|
||||
|
||||
<!-- 3-19-24 raymart added function for delete & edit -->
|
||||
<script>
|
||||
<?php endif; ?>
|
||||
<!-- vendor search end -->
|
||||
|
||||
var sessionToken = '<?php echo isset($_SESSION["token"]) ? $_SESSION["token"] : ""; ?>';
|
||||
var email = '<?php echo isset($_SESSION["email"]) ? $_SESSION["email"] : ""; ?>';
|
||||
var password = '<?php echo isset($_SESSION["password"]) ? $_SESSION["password"] : ""; ?>';
|
||||
<!-- 3-19-24 raymart added Shop content Start -->
|
||||
<div class="shop-pro-content" style="margin-right: 2%; margin-left: 2%;">
|
||||
<div class="shop-pro-inner list-view">
|
||||
<div class="row">
|
||||
<?php
|
||||
// $productSearchResult = [];
|
||||
// foreach ($productSearchResult['results'] as $product => $productListVendor) {
|
||||
// echo "$product .":" . $productListVendor";
|
||||
// $vendorOfProduct = getVendorbyId($product['vendor_api_id']);
|
||||
|
||||
function editProduct(productId) {
|
||||
$products = productListVendor($vendorId);
|
||||
$totalProducts = count($products);
|
||||
|
||||
|
||||
for ($i = 0; $i <= $totalProducts - 1; $i++) {
|
||||
$product = $products[$i];
|
||||
?>
|
||||
<div class="col-lg-3 col-md-4 col-sm-6">
|
||||
<div class="card-wrapper">
|
||||
<div class="card-container">
|
||||
<div class="card-top">
|
||||
<div class="image-container" style="height: 300px;"> <!-- Adjust the height as needed -->
|
||||
<?php
|
||||
if (isset($product['images'])) {
|
||||
$image_urls = explode(',', $product['images']);
|
||||
if (!empty($image_urls)) {
|
||||
$first_image_url = trim($image_urls[0]);
|
||||
?>
|
||||
<img loading="lazy" class="img-fluid" src="<?php echo $first_image_url; ?>" alt="edit" style="object-fit: cover; width: 100%; height: 100%;" />
|
||||
<?php
|
||||
}
|
||||
} else {
|
||||
?>
|
||||
<img loading="lazy" class="img-fluid rounded-circle" src="https://api.obanana.com/images/storage/web_images/1710214273217-no_image.png" alt="edit" />
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-bottom">
|
||||
<h3><?php echo $product['product_name']; ?></h3>
|
||||
<p>₱<?php echo $product['regular_price']; ?></p>
|
||||
</div>
|
||||
<div class="card-action">
|
||||
<div class="card-edit" onclick="editProduct('<?php echo $product['_id'] ?>');"><i class="mdi mdi-circle-edit-outline"></i></div>
|
||||
<div class="card-preview"><i class="mdi mdi-eye-outline"></i></div>
|
||||
<div class="card-remove" onclick="deleteProd('<?php echo $product['_id'] ?>');"><i class="mdi mdi mdi-delete-outline"></i></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!--Shop content End -->
|
||||
|
||||
<!-- 3-19-24 raymart added function for delete & edit -->
|
||||
<script>
|
||||
var sessionToken = '<?php echo isset($_SESSION["token"]) ? $_SESSION["token"] : ""; ?>';
|
||||
var email = '<?php echo isset($_SESSION["email"]) ? $_SESSION["email"] : ""; ?>';
|
||||
var password = '<?php echo isset($_SESSION["password"]) ? $_SESSION["password"] : ""; ?>';
|
||||
|
||||
function editProduct(productId) {
|
||||
console.log("Session Token:", sessionToken);
|
||||
login(email, password, function() {
|
||||
// Removed the call to updateSessionToken
|
||||
|
@ -818,36 +825,35 @@ $vendorSearchResult = $_SESSION["vendorSearchResult"];
|
|||
.then(data => {
|
||||
// Update the session token on the server side
|
||||
fetch("update-token-session.php", {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/json"
|
||||
},
|
||||
body: JSON.stringify({
|
||||
token: data.token
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/json"
|
||||
},
|
||||
body: JSON.stringify({
|
||||
token: data.token
|
||||
})
|
||||
})
|
||||
})
|
||||
.then(response => response.json())
|
||||
.then(result => {
|
||||
if (result.status === 'success') {
|
||||
// Update the session token in the client-side variable
|
||||
sessionToken = data.token;
|
||||
console.log("New Token:", sessionToken);
|
||||
callback();
|
||||
} else {
|
||||
throw new Error("Unable to update session token");
|
||||
}
|
||||
});
|
||||
.then(response => response.json())
|
||||
.then(result => {
|
||||
if (result.status === 'success') {
|
||||
// Update the session token in the client-side variable
|
||||
sessionToken = data.token;
|
||||
console.log("New Token:", sessionToken);
|
||||
callback();
|
||||
} else {
|
||||
throw new Error("Unable to update session token");
|
||||
}
|
||||
});
|
||||
})
|
||||
.catch(error => {
|
||||
console.error("Error:", error.message);
|
||||
});
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<!-- 3-19-24 raymart added function for delete & edit -->
|
||||
|
||||
</script>
|
||||
<!-- 3-19-24 raymart added function for delete & edit -->
|
||||
|
||||
|
||||
<!-- Common Javascript -->
|
||||
<!-- Common Javascript -->
|
||||
<script src="assets/plugins/jquery/jquery-3.5.1.min.js"></script>
|
||||
<script src="assets/js/bootstrap.bundle.min.js"></script>
|
||||
<script src="assets/plugins/simplebar/simplebar.min.js"></script>
|
||||
|
@ -860,6 +866,6 @@ $vendorSearchResult = $_SESSION["vendorSearchResult"];
|
|||
<!-- Ekka Custom -->
|
||||
<script src="assets/js/ekka.js"></script>
|
||||
|
||||
</body>
|
||||
</body>
|
||||
|
||||
</html>
|
File diff suppressed because it is too large
Load Diff
|
@ -345,7 +345,6 @@ if (!empty($_GET['minPrice']) || !empty($_GET['maxPrice']) || !empty($_GET['cate
|
|||
<p>Level : 9 out of 10</p>
|
||||
</div> -->
|
||||
<div class="col-lg-3 col-md-6 ec-catalog-pro-count pad-15">
|
||||
|
||||
<h6>Seller Products</h6>
|
||||
<?php
|
||||
?>
|
||||
|
@ -353,12 +352,16 @@ if (!empty($_GET['minPrice']) || !empty($_GET['maxPrice']) || !empty($_GET['cate
|
|||
<p><?php echo count($products) ?> Products</p>
|
||||
</div>
|
||||
<div class="col-lg-3 col-md-6 ec-catalog-since pad-15">
|
||||
|
||||
<h6>Seller since</h6>
|
||||
<!-- <p><?php echo $vendor["date_registered"] ?></p> -->
|
||||
<p><?php echo date('F j, Y', strtotime($vendor['date_registered'])); ?></p>
|
||||
|
||||
|
||||
<p>
|
||||
<?php
|
||||
if (!empty($vendor['date_registered'])){
|
||||
echo date('F j, Y', strtotime($vendor['date_registered']));
|
||||
} else {
|
||||
echo "Not Yet Registered";
|
||||
}
|
||||
?>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -28,10 +28,6 @@
|
|||
<div class="ec-footer-links">
|
||||
<ul class="align-items-center">
|
||||
<li class="ec-footer-link">16F PMI Tower,Makati, Makati, Philippines</li>
|
||||
<li class="ec-footer-link"><span>Call Us:</span><a
|
||||
href="Mobile:+63 917 722 6002">+63 (2) 8807-6379</a></li>
|
||||
<li class="ec-footer-link"><span>Email:</span><a
|
||||
href="mailto:sales@obanana.com">sales@obanana.com</a></li>
|
||||
<li class="ec-footer-link"><span>Call Us:</span><a
|
||||
href="Mobile:+63 (2) 8807-6379">+63 (2) 8807-6379</a></li>
|
||||
<li class="ec-footer-link"><span>Email:</span><a
|
||||
|
|
|
@ -1802,7 +1802,7 @@ if ($_SESSION["userId"] <> "") {
|
|||
<div class="header-top-download">
|
||||
<!-- 04-01-2024 Stacy modified this block of code -->
|
||||
<!-- <button class="text-upper" onclick="displayPopup()">Download App <i aria-hidden="true"></i></button> -->
|
||||
<?php if(isset($customer_data)) { ?>
|
||||
<?php if(!empty($customer_data)) { ?>
|
||||
<button style="cursor:default;">Hi <span
|
||||
class="text-upper"><?php echo $customer_data[0]['first_name'] ?>!</span></button>
|
||||
<?php } else if (isset($vendorData)) {?>
|
||||
|
|
|
@ -298,142 +298,165 @@ $filteredProducts = [];
|
|||
<script>
|
||||
// JavaScript
|
||||
document.addEventListener("DOMContentLoaded", function() {
|
||||
const productsPerPage = 30;
|
||||
let currentPage = 1;
|
||||
let page = currentPage;
|
||||
loadVendors(page); // Initial load of vendor products
|
||||
loadProducts(page); // Initial load of products
|
||||
// JavaScript
|
||||
function filterFunction(checkedCategories, minPrice, maxPrice, products) {
|
||||
var filteredProducts = [];
|
||||
// Filter by category
|
||||
if (checkedCategories.length > 0) {
|
||||
let filteredProduct = products?.filter((product) => {
|
||||
let categoryF = product?.product?.product_category?.toLowerCase();
|
||||
// console.log('Category (lowercase):', categoryF);
|
||||
let result = checkedCategories.includes(categoryF)
|
||||
// console.log('Checked Categories:', result);
|
||||
return result; // Return a boolean value indicating whether the category is included
|
||||
});
|
||||
filteredProducts = filteredProduct
|
||||
console.log(filteredProducts);
|
||||
const productsPerPage = 30;
|
||||
let currentPage = 1;
|
||||
let page = currentPage;
|
||||
loadVendors(page); // Initial load of vendor products
|
||||
loadProducts(page); // Initial load of products
|
||||
// JavaScript
|
||||
function filterFunction(checkedCategories, minPrice, maxPrice, products) {
|
||||
var filteredProducts = [];
|
||||
// Filter by category
|
||||
if (checkedCategories.length > 0) {
|
||||
let filteredProduct = products?.filter((product) => {
|
||||
let categoryF = product?.product?.product_category?.toLowerCase();
|
||||
// console.log('Category (lowercase):', categoryF);
|
||||
let result = checkedCategories.includes(categoryF)
|
||||
// console.log('Checked Categories:', result);
|
||||
return result; // Return a boolean value indicating whether the category is included
|
||||
});
|
||||
filteredProducts = filteredProduct
|
||||
console.log(filteredProducts);
|
||||
|
||||
} else {
|
||||
// If no categories are selected, keep all products
|
||||
filteredProducts = products;
|
||||
}
|
||||
} else {
|
||||
// If no categories are selected, keep all products
|
||||
filteredProducts = products;
|
||||
}
|
||||
|
||||
// If minPrice or maxPrice is not provided, set them to default values
|
||||
minPriceFinal = minPrice !== '' ? parseInt(minPrice) : 0;
|
||||
maxPriceFinal = maxPrice !== '' ? parseInt(maxPrice) : Number.MAX_VALUE;
|
||||
console.log(checkedCategories, minPrice, products)
|
||||
// If minPrice or maxPrice is not provided, set them to default values
|
||||
minPriceFinal = minPrice !== '' ? parseInt(minPrice) : 0;
|
||||
maxPriceFinal = maxPrice !== '' ? parseInt(maxPrice) : Number.MAX_VALUE;
|
||||
console.log(checkedCategories, minPrice, products)
|
||||
|
||||
// Filter by price range
|
||||
// Filter by price range
|
||||
if (minPrice !== '' || maxPrice !== '') {
|
||||
// Filter by price range
|
||||
// Filter by price range
|
||||
if (minPrice !== '' || maxPrice !== '') {
|
||||
|
||||
filteredProducts = filteredProducts.filter(function(product) {
|
||||
// Check if product has a sale price
|
||||
var salePrice = parseInt(product.product.sale_price);
|
||||
var regularPrice = parseInt(product.product.regular_price);
|
||||
filteredProducts = filteredProducts.filter(function(product) {
|
||||
// Check if product has a sale price
|
||||
var salePrice = parseInt(product.product.sale_price);
|
||||
var regularPrice = parseInt(product.product.regular_price);
|
||||
|
||||
// Check if salePrice and regularPrice are valid numbers
|
||||
// Check if salePrice and regularPrice are valid numbers
|
||||
|
||||
// if (isNaN(salePrice) || isNaN(regularPrice)) {
|
||||
// // One of the prices is not a valid number, use 0 instead
|
||||
// salePrice = salePrice || 0;
|
||||
// regularPrice = regularPrice || 0;
|
||||
// }
|
||||
var priceToCheck = salePrice > 0 ? salePrice : regularPrice;
|
||||
// console.log(priceToCheck);
|
||||
return priceToCheck >= minPriceFinal && priceToCheck <= maxPriceFinal;
|
||||
});
|
||||
}
|
||||
console.log({
|
||||
results: filteredProducts
|
||||
});
|
||||
// if (isNaN(salePrice) || isNaN(regularPrice)) {
|
||||
// // One of the prices is not a valid number, use 0 instead
|
||||
// salePrice = salePrice || 0;
|
||||
// regularPrice = regularPrice || 0;
|
||||
// }
|
||||
var priceToCheck = salePrice > 0 ? salePrice : regularPrice;
|
||||
// console.log(priceToCheck);
|
||||
return priceToCheck >= minPriceFinal && priceToCheck <= maxPriceFinal;
|
||||
});
|
||||
}
|
||||
console.log({
|
||||
results: filteredProducts
|
||||
});
|
||||
|
||||
// Final filtered products
|
||||
// console.log({results:filteredProducts});
|
||||
let final = filteredProducts
|
||||
return final;
|
||||
}
|
||||
// Final filtered products
|
||||
// console.log({results:filteredProducts});
|
||||
let final = filteredProducts
|
||||
return final;
|
||||
}
|
||||
|
||||
function loadVendors(page, isFilter) {
|
||||
document.querySelector(".vendor-list").innerHTML = "";
|
||||
function loadVendors(page, isFilter) {
|
||||
document.querySelector(".vendor-list").innerHTML = "";
|
||||
|
||||
// Create a new XMLHttpRequest object for fetching vendors
|
||||
let xhrVendors = new XMLHttpRequest();
|
||||
// Create a new XMLHttpRequest object for fetching vendors
|
||||
let xhrVendors = new XMLHttpRequest();
|
||||
|
||||
// Define the endpoint URL for fetching vendors
|
||||
let vendorsEndpointURL =
|
||||
`https://<?php echo htmlspecialchars($_SESSION["data_endpoint"]); ?>/api/v1/vendors/search?q=<?php echo $_GET['search'] ?>`;
|
||||
// Define the endpoint URL for fetching vendors
|
||||
let vendorsEndpointURL =
|
||||
`https://<?php echo htmlspecialchars($_SESSION["data_endpoint"]); ?>/api/v1/vendors/search?q=<?php echo $_GET['search'] ?>`;
|
||||
|
||||
// Open a GET request to fetch vendors
|
||||
xhrVendors.open("GET", vendorsEndpointURL, true);
|
||||
// Open a GET request to fetch vendors
|
||||
xhrVendors.open("GET", vendorsEndpointURL, true);
|
||||
|
||||
// Set up a callback function to handle the vendors response
|
||||
xhrVendors.onreadystatechange = function() {
|
||||
if (xhrVendors.readyState === 4 && xhrVendors.status === 200) {
|
||||
// Parse the response JSON for vendors
|
||||
let vendorsResponse = JSON.parse(xhrVendors.responseText);
|
||||
// Set up a callback function to handle the vendors response
|
||||
xhrVendors.onreadystatechange = function() {
|
||||
if (xhrVendors.readyState === 4 && xhrVendors.status === 200) {
|
||||
// Parse the response JSON for vendors
|
||||
let vendorsResponse = JSON.parse(xhrVendors.responseText);
|
||||
|
||||
// Create an array to store vendor IDs
|
||||
let vendorIds = vendorsResponse.results.map(vendor => vendor._id);
|
||||
// Create an array to store vendor IDs
|
||||
let vendorIds = vendorsResponse.results.map(vendor => vendor._id);
|
||||
|
||||
// Create a new XMLHttpRequest object for fetching products
|
||||
let xhrProducts = new XMLHttpRequest();
|
||||
// Create a new XMLHttpRequest object for fetching products
|
||||
let xhrProducts = new XMLHttpRequest();
|
||||
|
||||
// Define the endpoint URL for fetching products
|
||||
let productsEndpointURL =
|
||||
`https://<?php echo htmlspecialchars($_SESSION["data_endpoint"]); ?>/api/v1/products`;
|
||||
// Define the endpoint URL for fetching products
|
||||
let productsEndpointURL =
|
||||
`https://<?php echo htmlspecialchars($_SESSION["data_endpoint"]); ?>/api/v1/products`;
|
||||
|
||||
// Open a GET request to fetch products
|
||||
xhrProducts.open("GET", productsEndpointURL, true);
|
||||
// Open a GET request to fetch products
|
||||
xhrProducts.open("GET", productsEndpointURL, true);
|
||||
|
||||
// Set up a callback function to handle the products response
|
||||
xhrProducts.onreadystatechange = function() {
|
||||
if (xhrProducts.readyState === 4 && xhrProducts.status === 200) {
|
||||
// Parse the response JSON for products
|
||||
let productsResponse = JSON.parse(xhrProducts.responseText);
|
||||
console.log(productsResponse)
|
||||
// Create an object to store vendor-wise product counts
|
||||
let vendorProductCounts = {};
|
||||
// Set up a callback function to handle the products response
|
||||
xhrProducts.onreadystatechange = function() {
|
||||
if (xhrProducts.readyState === 4 && xhrProducts.status === 200) {
|
||||
// Parse the response JSON for products
|
||||
let productsResponse = JSON.parse(xhrProducts.responseText);
|
||||
console.log(productsResponse)
|
||||
// Create an object to store vendor-wise product counts
|
||||
let vendorProductCounts = {};
|
||||
|
||||
// Iterate through each product and count the products associated with each vendor
|
||||
productsResponse.forEach(function(product) {
|
||||
// Increment product count for the vendor
|
||||
if (!vendorProductCounts[product.vendor_api_id]) {
|
||||
vendorProductCounts[product.vendor_api_id] = 1;
|
||||
} else {
|
||||
vendorProductCounts[product.vendor_api_id]++;
|
||||
}
|
||||
});
|
||||
// Iterate through each product and count the products associated with each vendor
|
||||
productsResponse.forEach(function(product) {
|
||||
// Increment product count for the vendor
|
||||
if (!vendorProductCounts[product.vendor_api_id]) {
|
||||
vendorProductCounts[product.vendor_api_id] = 1;
|
||||
} else {
|
||||
vendorProductCounts[product.vendor_api_id]++;
|
||||
}
|
||||
});
|
||||
|
||||
// Now, we have vendor-wise product counts, we can use it to display the counts for each vendor
|
||||
if (vendorsResponse.results.length > 0) {
|
||||
// Now, we have vendor-wise product counts, we can use it to display the counts for each vendor
|
||||
if (vendorsResponse.results.length > 0) {
|
||||
|
||||
vendorsResponse.results.slice(0, 6).forEach(function(
|
||||
vendor) {
|
||||
let vendorId = vendor._id;
|
||||
let productCount = vendorProductCounts[
|
||||
vendorId] || 0;
|
||||
let vendorDateRegistered = new Date(vendor
|
||||
.date_registered);
|
||||
vendorsResponse.results.slice(0, 6).forEach(function(
|
||||
vendor) {
|
||||
let vendorId = vendor._id;
|
||||
let productCount = vendorProductCounts[
|
||||
vendorId] || 0;
|
||||
let vendorDateRegistered = new Date(vendor
|
||||
.date_registered);
|
||||
vendorsResponse.results.slice(0, 6).forEach(
|
||||
function(vendor) {
|
||||
let vendorDateRegistered = "";
|
||||
let vendorId = vendor._id;
|
||||
let productCount =
|
||||
vendorProductCounts[vendorId] ||
|
||||
0;
|
||||
if (vendor.date_registered) {
|
||||
vendorDateRegistered = new Date(
|
||||
vendor.date_registered);
|
||||
} else {
|
||||
vendorDateRegistered =
|
||||
"Not yet registered";
|
||||
}
|
||||
|
||||
// Format the date as "Month DD, YYYY"
|
||||
let options = {
|
||||
month: 'long',
|
||||
day: '2-digit',
|
||||
year: 'numeric'
|
||||
};
|
||||
let formattedDate = vendorDateRegistered
|
||||
.toLocaleDateString('en-US', options);
|
||||
|
||||
// Create a product card element
|
||||
let card = document.createElement("div");
|
||||
card.classList.add("col-md-12");
|
||||
card.innerHTML = `
|
||||
// Format the date as "Month DD, YYYY"
|
||||
let options = {
|
||||
month: 'long',
|
||||
day: '2-digit',
|
||||
year: 'numeric'
|
||||
};
|
||||
let formattedDate = "";
|
||||
if (vendorDateRegistered !==
|
||||
"Not yet registered") {
|
||||
formattedDate =
|
||||
vendorDateRegistered
|
||||
.toLocaleDateString('en-US',
|
||||
options);
|
||||
} else {
|
||||
formattedDate =
|
||||
"Not yet registered";
|
||||
}
|
||||
// Create a product card element
|
||||
let card = document.createElement(
|
||||
"div");
|
||||
card.classList.add("col-md-12");
|
||||
card.innerHTML = `
|
||||
<div class="card" style="margin:5px">
|
||||
<div class="card-body">
|
||||
<div class="vendor-info" style="display: flex; align-items: center; flex-wrap:wrap; justify-content:center">
|
||||
|
@ -466,111 +489,122 @@ $filteredProducts = [];
|
|||
</div>
|
||||
</div>
|
||||
</div>`;
|
||||
// Append the product card to the container
|
||||
document.querySelector(".vendor-list")
|
||||
.appendChild(card);
|
||||
});
|
||||
} else {
|
||||
document.querySelector(".vendor-list").innerHTML = `
|
||||
// Append the product card to the container
|
||||
document.querySelector(
|
||||
".vendor-list")
|
||||
.appendChild(card);
|
||||
});
|
||||
} else {
|
||||
document.querySelector(".vendor-list")
|
||||
.innerHTML = `
|
||||
<h6>No vendors available</h6>
|
||||
|
||||
`;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// Send the request to fetch products
|
||||
xhrProducts.send();
|
||||
}
|
||||
};
|
||||
|
||||
// Send the request to fetch vendors
|
||||
xhrVendors.send();
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
// Send the request to fetch products
|
||||
xhrProducts.send();
|
||||
}
|
||||
};
|
||||
function loadProducts(page, isFilter) {
|
||||
// Make AJAX request to fetch products for given page
|
||||
let xhr = new XMLHttpRequest();
|
||||
xhr.open("GET",
|
||||
"https://<?php echo htmlspecialchars($_SESSION["data_endpoint"]); ?>/api/v1/products/search?q=<?php echo $_GET['search'] ?>",
|
||||
true);
|
||||
|
||||
// Send the request to fetch vendors
|
||||
xhrVendors.send();
|
||||
|
||||
}
|
||||
|
||||
function loadProducts(page, isFilter) {
|
||||
// Make AJAX request to fetch products for given page
|
||||
let xhr = new XMLHttpRequest();
|
||||
xhr.open("GET",
|
||||
"https://<?php echo htmlspecialchars($_SESSION["data_endpoint"]); ?>/api/v1/products/search?q=<?php echo $_GET['search'] ?>",
|
||||
true);
|
||||
|
||||
xhr.onreadystatechange = function() {
|
||||
if (xhr.readyState == 4 && xhr.status == 200) {
|
||||
// Parse JSON response
|
||||
let products1 = JSON.parse(xhr.responseText);
|
||||
let products = products1.results.filter(product => product.product
|
||||
.product_type !== 'variation');
|
||||
console.log(products);
|
||||
// if(isFilter===true){
|
||||
var checkedCategories = getCheckedCheckboxes();
|
||||
var prices = getMinMaxPrices();
|
||||
// Pass the values to your filter function
|
||||
products = filterFunction(checkedCategories, prices.minPrice, prices
|
||||
.maxPrice, products);
|
||||
// }
|
||||
// Construct HTML for product cards
|
||||
let productContainer = document.getElementById("product-container");
|
||||
productContainer.innerHTML = ""; // Clear previous content
|
||||
console.log(products)
|
||||
let startIndex = (page - 1) * productsPerPage;
|
||||
let endIndex = startIndex + productsPerPage - 1;
|
||||
// Filter products for current page
|
||||
if (products.length > 0) {
|
||||
let productsForPage = products.slice(startIndex, endIndex + 1);
|
||||
xhr.onreadystatechange = function() {
|
||||
if (xhr.readyState == 4 && xhr.status == 200) {
|
||||
// Parse JSON response
|
||||
let products1 = JSON.parse(xhr.responseText);
|
||||
let products = products1.results.filter(product => product
|
||||
.product
|
||||
.product_type !== 'variation');
|
||||
console.log(products);
|
||||
// if(isFilter===true){
|
||||
var checkedCategories = getCheckedCheckboxes();
|
||||
var prices = getMinMaxPrices();
|
||||
// Pass the values to your filter function
|
||||
products = filterFunction(checkedCategories, prices.minPrice,
|
||||
prices
|
||||
.maxPrice, products);
|
||||
// }
|
||||
// Construct HTML for product cards
|
||||
let productContainer = document.getElementById(
|
||||
"product-container");
|
||||
productContainer.innerHTML = ""; // Clear previous content
|
||||
console.log(products)
|
||||
let startIndex = (page - 1) * productsPerPage;
|
||||
let endIndex = startIndex + productsPerPage - 1;
|
||||
// Filter products for current page
|
||||
if (products.length > 0) {
|
||||
let productsForPage = products.slice(startIndex, endIndex +
|
||||
1);
|
||||
|
||||
|
||||
productsForPage.forEach(function(prod) {
|
||||
let product = prod.product;
|
||||
let vendor = prod.vendor;
|
||||
productsForPage.forEach(function(prod) {
|
||||
let product = prod.product;
|
||||
let vendor = prod.vendor;
|
||||
|
||||
let vendorOfProduct = prod.vendor;
|
||||
// let card = document.createElement("div");
|
||||
let token = "<?php echo $_SESSION['token'] ?>";
|
||||
let email = "<?php echo $_SESSION['email'] ?>";
|
||||
let password = "<?php echo $_SESSION['password'] ?>";
|
||||
let customer_data =
|
||||
'<?php echo json_encode($customer_data) ?>';
|
||||
let vendorOfProduct = prod.vendor;
|
||||
// let card = document.createElement("div");
|
||||
let token = "<?php echo $_SESSION['token'] ?>";
|
||||
let email = "<?php echo $_SESSION['email'] ?>";
|
||||
let password =
|
||||
"<?php echo $_SESSION['password'] ?>";
|
||||
let customer_data =
|
||||
'<?php echo json_encode($customer_data) ?>';
|
||||
|
||||
// Load product images dynamically
|
||||
let imageContainer = document.createElement("div");
|
||||
if (product.images && product.images.length > 0) {
|
||||
let imageUrls = product.images.split(',');
|
||||
let firstImageUrl = imageUrls[0].trim();
|
||||
let img = document.createElement("img");
|
||||
img.setAttribute("style",
|
||||
"border: 1px solid #eeeeee; height: 330px; object-fit: cover;"
|
||||
);
|
||||
img.setAttribute("class", "main-image");
|
||||
img.setAttribute("src", firstImageUrl);
|
||||
img.setAttribute("loading", "lazy");
|
||||
// Load product images dynamically
|
||||
let imageContainer = document.createElement(
|
||||
"div");
|
||||
if (product.images && product.images.length >
|
||||
0) {
|
||||
let imageUrls = product.images.split(',');
|
||||
let firstImageUrl = imageUrls[0].trim();
|
||||
let img = document.createElement("img");
|
||||
img.setAttribute("style",
|
||||
"border: 1px solid #eeeeee; height: 330px; object-fit: cover;"
|
||||
);
|
||||
img.setAttribute("class", "main-image");
|
||||
img.setAttribute("src", firstImageUrl);
|
||||
img.setAttribute("loading", "lazy");
|
||||
|
||||
img.setAttribute("alt", "Product");
|
||||
img.className = "main-image";
|
||||
imageContainer.appendChild(img);
|
||||
} else {
|
||||
let img = document.createElement("img");
|
||||
img.className = "main-image";
|
||||
img.setAttribute("style",
|
||||
"width: 290px; height: 200px; object-fit: cover;"
|
||||
);
|
||||
img.setAttribute("loading", "lazy");
|
||||
img.setAttribute("alt", "Product");
|
||||
img.className = "main-image";
|
||||
imageContainer.appendChild(img);
|
||||
} else {
|
||||
let img = document.createElement("img");
|
||||
img.className = "main-image";
|
||||
img.setAttribute("style",
|
||||
"width: 290px; height: 200px; object-fit: cover;"
|
||||
);
|
||||
img.setAttribute("loading", "lazy");
|
||||
|
||||
img.setAttribute("class", "main-image");
|
||||
img.setAttribute("src",
|
||||
"https://api.obanana.com/images/storage/web_images/1709002636671-viber_image_2024-02-22_15-54-42-498.png"
|
||||
);
|
||||
img.setAttribute("alt", "Product");
|
||||
imageContainer.appendChild(img);
|
||||
}
|
||||
img.setAttribute("class", "main-image");
|
||||
img.setAttribute("src",
|
||||
"https://api.obanana.com/images/storage/web_images/1709002636671-viber_image_2024-02-22_15-54-42-498.png"
|
||||
);
|
||||
img.setAttribute("alt", "Product");
|
||||
imageContainer.appendChild(img);
|
||||
}
|
||||
|
||||
// Create product card
|
||||
let card = document.createElement("div");
|
||||
card.classList.add("col-lg-4", "col-md-6", "col-sm-6",
|
||||
"col-xs-6", "mb-6", "pro-gl-content", "width-100");
|
||||
card.innerHTML = `
|
||||
// Create product card
|
||||
let card = document.createElement("div");
|
||||
card.classList.add("col-lg-4", "col-md-6",
|
||||
"col-sm-6",
|
||||
"col-xs-6", "mb-6", "pro-gl-content",
|
||||
"width-100");
|
||||
card.innerHTML = `
|
||||
<div class="ec-product-inner">
|
||||
<div class="ec-pro-image-outer" style="max-width: 290px; height: 350px;">
|
||||
<div class="ec-pro-image">
|
||||
|
@ -605,198 +639,201 @@ $filteredProducts = [];
|
|||
|
||||
</div>
|
||||
</div>`;
|
||||
productContainer.appendChild(card);
|
||||
updatePaginationUI(page, products.length);
|
||||
productContainer.appendChild(card);
|
||||
updatePaginationUI(page, products.length);
|
||||
});
|
||||
gridList()
|
||||
} else {
|
||||
document.getElementById("product-container").innerHTML = `
|
||||
<h6>No products available</h6>
|
||||
|
||||
`;
|
||||
|
||||
}
|
||||
|
||||
} else {
|
||||
document.getElementById("product-container").innerHTML = `
|
||||
<h6>No products available</h6>
|
||||
|
||||
`;
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
xhr.send();
|
||||
}
|
||||
|
||||
function updatePaginationUI(page, totalProducts) {
|
||||
let totalPages = Math.ceil(totalProducts / productsPerPage);
|
||||
let paginationInner = document.getElementById("prod-search-pagination");
|
||||
let paginationIndicator = document.querySelector(".page-indicator");
|
||||
|
||||
paginationInner.innerHTML = ""; // Clear previous pagination
|
||||
let startPage = 1;
|
||||
let endPage = totalPages;
|
||||
|
||||
const visiblePages = 5; // Number of visible page links excluding ellipses
|
||||
|
||||
if (totalPages > visiblePages) {
|
||||
if (page <= Math.ceil(visiblePages / 2)) {
|
||||
endPage = visiblePages;
|
||||
} else if (page >= totalPages - Math.floor(visiblePages / 2)) {
|
||||
startPage = totalPages - visiblePages + 1;
|
||||
} else {
|
||||
startPage = page - Math.floor(visiblePages / 2);
|
||||
endPage = page + Math.ceil(visiblePages / 2) - 1;
|
||||
}
|
||||
}
|
||||
|
||||
// Display ellipsis at the beginning if necessary
|
||||
if (startPage > 1) {
|
||||
let firstPageLi = document.createElement("li");
|
||||
let firstPageLink = document.createElement("a");
|
||||
firstPageLink.setAttribute("href", "#");
|
||||
firstPageLink.setAttribute("data-page", 1);
|
||||
firstPageLink.textContent = 1;
|
||||
firstPageLi.appendChild(firstPageLink);
|
||||
paginationInner.appendChild(firstPageLi);
|
||||
|
||||
// Display ellipsis after the first page link if necessary
|
||||
if (startPage > 2) {
|
||||
let ellipsisLi = document.createElement("li");
|
||||
ellipsisLi.textContent = "...";
|
||||
paginationInner.appendChild(ellipsisLi);
|
||||
}
|
||||
}
|
||||
|
||||
for (let i = startPage; i <= endPage; i++) {
|
||||
let li = document.createElement("li");
|
||||
let a = document.createElement("a");
|
||||
a.setAttribute("href", "#");
|
||||
a.setAttribute("data-page", i);
|
||||
a.textContent = i;
|
||||
if (i === page) {
|
||||
a.classList.add("active");
|
||||
}
|
||||
li.appendChild(a);
|
||||
paginationInner.appendChild(li);
|
||||
}
|
||||
|
||||
|
||||
// Display ellipsis at the end if necessary
|
||||
if (endPage < totalPages) {
|
||||
let li = document.createElement("li");
|
||||
li.textContent = "...";
|
||||
paginationInner.appendChild(li);
|
||||
|
||||
let lastPageLi = document.createElement("li");
|
||||
let lastPageLink = document.createElement("a");
|
||||
lastPageLink.setAttribute("href", "#");
|
||||
lastPageLink.setAttribute("data-page", totalPages);
|
||||
lastPageLink.textContent = totalPages;
|
||||
lastPageLi.appendChild(lastPageLink);
|
||||
paginationInner.appendChild(lastPageLi);
|
||||
}
|
||||
|
||||
// Update pagination indicator
|
||||
let startIndex = (page - 1) * productsPerPage + 1;
|
||||
let endIndex = Math.min(startIndex + productsPerPage - 1, totalProducts);
|
||||
paginationIndicator.textContent = "Showing " + startIndex + " to " +
|
||||
endIndex + " of " +
|
||||
totalProducts + " item(s)";
|
||||
}
|
||||
|
||||
function getCheckedCheckboxes() {
|
||||
var checkboxes = document.querySelectorAll(
|
||||
'input[name="category[]"]:checked');
|
||||
var values = [];
|
||||
checkboxes.forEach(function(checkbox) {
|
||||
values.push(checkbox.value.toLowerCase().trim());
|
||||
});
|
||||
return values;
|
||||
}
|
||||
|
||||
// Function to get min and max prices
|
||||
function getMinMaxPrices() {
|
||||
var minPrice = document.getElementById('minPrice').value;
|
||||
var maxPrice = document.getElementById('maxPrice').value;
|
||||
return {
|
||||
minPrice: minPrice,
|
||||
maxPrice: maxPrice
|
||||
};
|
||||
}
|
||||
|
||||
// Function to handle form submission
|
||||
function applyFilters() {
|
||||
var checkedCategories = getCheckedCheckboxes();
|
||||
var prices = getMinMaxPrices();
|
||||
// Pass the values to your filter function
|
||||
filterFunction(checkedCategories, prices.minPrice, prices.maxPrice);
|
||||
}
|
||||
|
||||
|
||||
var checkboxes = document.querySelectorAll('input[name="category[]"]');
|
||||
checkboxes.forEach(function(checkbox) {
|
||||
checkbox.addEventListener('change', function() {
|
||||
loadProducts(1, true);
|
||||
});
|
||||
});
|
||||
gridList()
|
||||
} else {
|
||||
document.getElementById("product-container").innerHTML = `
|
||||
<h6>No products available</h6>
|
||||
|
||||
`;
|
||||
|
||||
}
|
||||
function gridList(e) {
|
||||
console.log("hereeeee")
|
||||
var $gridCont = $('.shop-pro-inner');
|
||||
var $gridView = $('.pro-gl-content');
|
||||
// e.preventDefault();
|
||||
$gridCont.removeClass('list-view');
|
||||
$gridView.removeClass('width-100');
|
||||
}
|
||||
// Listen for changes in min and max price inputs
|
||||
var minPriceInput = document.getElementById('minPrice');
|
||||
minPriceInput.addEventListener('input', function() {
|
||||
loadProducts(1, true);
|
||||
});
|
||||
|
||||
} else {
|
||||
document.getElementById("product-container").innerHTML = `
|
||||
<h6>No products available</h6>
|
||||
|
||||
`;
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
xhr.send();
|
||||
}
|
||||
|
||||
function updatePaginationUI(page, totalProducts) {
|
||||
let totalPages = Math.ceil(totalProducts / productsPerPage);
|
||||
let paginationInner = document.getElementById("prod-search-pagination");
|
||||
let paginationIndicator = document.querySelector(".page-indicator");
|
||||
|
||||
paginationInner.innerHTML = ""; // Clear previous pagination
|
||||
let startPage = 1;
|
||||
let endPage = totalPages;
|
||||
|
||||
const visiblePages = 5; // Number of visible page links excluding ellipses
|
||||
|
||||
if (totalPages > visiblePages) {
|
||||
if (page <= Math.ceil(visiblePages / 2)) {
|
||||
endPage = visiblePages;
|
||||
} else if (page >= totalPages - Math.floor(visiblePages / 2)) {
|
||||
startPage = totalPages - visiblePages + 1;
|
||||
} else {
|
||||
startPage = page - Math.floor(visiblePages / 2);
|
||||
endPage = page + Math.ceil(visiblePages / 2) - 1;
|
||||
}
|
||||
}
|
||||
|
||||
// Display ellipsis at the beginning if necessary
|
||||
if (startPage > 1) {
|
||||
let firstPageLi = document.createElement("li");
|
||||
let firstPageLink = document.createElement("a");
|
||||
firstPageLink.setAttribute("href", "#");
|
||||
firstPageLink.setAttribute("data-page", 1);
|
||||
firstPageLink.textContent = 1;
|
||||
firstPageLi.appendChild(firstPageLink);
|
||||
paginationInner.appendChild(firstPageLi);
|
||||
|
||||
// Display ellipsis after the first page link if necessary
|
||||
if (startPage > 2) {
|
||||
let ellipsisLi = document.createElement("li");
|
||||
ellipsisLi.textContent = "...";
|
||||
paginationInner.appendChild(ellipsisLi);
|
||||
}
|
||||
}
|
||||
|
||||
for (let i = startPage; i <= endPage; i++) {
|
||||
let li = document.createElement("li");
|
||||
let a = document.createElement("a");
|
||||
a.setAttribute("href", "#");
|
||||
a.setAttribute("data-page", i);
|
||||
a.textContent = i;
|
||||
if (i === page) {
|
||||
a.classList.add("active");
|
||||
}
|
||||
li.appendChild(a);
|
||||
paginationInner.appendChild(li);
|
||||
}
|
||||
|
||||
|
||||
// Display ellipsis at the end if necessary
|
||||
if (endPage < totalPages) {
|
||||
let li = document.createElement("li");
|
||||
li.textContent = "...";
|
||||
paginationInner.appendChild(li);
|
||||
|
||||
let lastPageLi = document.createElement("li");
|
||||
let lastPageLink = document.createElement("a");
|
||||
lastPageLink.setAttribute("href", "#");
|
||||
lastPageLink.setAttribute("data-page", totalPages);
|
||||
lastPageLink.textContent = totalPages;
|
||||
lastPageLi.appendChild(lastPageLink);
|
||||
paginationInner.appendChild(lastPageLi);
|
||||
}
|
||||
|
||||
// Update pagination indicator
|
||||
let startIndex = (page - 1) * productsPerPage + 1;
|
||||
let endIndex = Math.min(startIndex + productsPerPage - 1, totalProducts);
|
||||
paginationIndicator.textContent = "Showing " + startIndex + " to " + endIndex + " of " +
|
||||
totalProducts + " item(s)";
|
||||
}
|
||||
|
||||
function getCheckedCheckboxes() {
|
||||
var checkboxes = document.querySelectorAll('input[name="category[]"]:checked');
|
||||
var values = [];
|
||||
checkboxes.forEach(function(checkbox) {
|
||||
values.push(checkbox.value.toLowerCase().trim());
|
||||
});
|
||||
return values;
|
||||
}
|
||||
|
||||
// Function to get min and max prices
|
||||
function getMinMaxPrices() {
|
||||
var minPrice = document.getElementById('minPrice').value;
|
||||
var maxPrice = document.getElementById('maxPrice').value;
|
||||
return {
|
||||
minPrice: minPrice,
|
||||
maxPrice: maxPrice
|
||||
};
|
||||
}
|
||||
|
||||
// Function to handle form submission
|
||||
function applyFilters() {
|
||||
var checkedCategories = getCheckedCheckboxes();
|
||||
var prices = getMinMaxPrices();
|
||||
// Pass the values to your filter function
|
||||
filterFunction(checkedCategories, prices.minPrice, prices.maxPrice);
|
||||
}
|
||||
|
||||
|
||||
var checkboxes = document.querySelectorAll('input[name="category[]"]');
|
||||
checkboxes.forEach(function(checkbox) {
|
||||
checkbox.addEventListener('change', function() {
|
||||
loadProducts(1, true);
|
||||
});
|
||||
});
|
||||
|
||||
function gridList(e) {
|
||||
console.log("hereeeee")
|
||||
var $gridCont = $('.shop-pro-inner');
|
||||
var $gridView = $('.pro-gl-content');
|
||||
// e.preventDefault();
|
||||
$gridCont.removeClass('list-view');
|
||||
$gridView.removeClass('width-100');
|
||||
}
|
||||
// Listen for changes in min and max price inputs
|
||||
var minPriceInput = document.getElementById('minPrice');
|
||||
minPriceInput.addEventListener('input', function() {
|
||||
loadProducts(1, true);
|
||||
});
|
||||
|
||||
var maxPriceInput = document.getElementById('maxPrice');
|
||||
maxPriceInput.addEventListener('input', function() {
|
||||
loadProducts(1, true);
|
||||
});
|
||||
var maxPriceInput = document.getElementById('maxPrice');
|
||||
maxPriceInput.addEventListener('input', function() {
|
||||
loadProducts(1, true);
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
document.getElementById("prod-search-pagination").addEventListener("click", function(
|
||||
event) {
|
||||
if (event.target.tagName.toLowerCase() === "a") {
|
||||
event.preventDefault(); // Prevent default link behavior
|
||||
let page = parseInt(event.target.getAttribute("data-page"));
|
||||
currentPage = page;
|
||||
loadProducts(page, false);
|
||||
// Scroll to top
|
||||
window.scrollTo({
|
||||
top: 0,
|
||||
behavior: "smooth" // Optional smooth scrolling behavior
|
||||
});
|
||||
}
|
||||
});
|
||||
document.getElementById("prod-search-pagination").addEventListener("click",
|
||||
function(
|
||||
event) {
|
||||
if (event.target.tagName.toLowerCase() === "a") {
|
||||
event.preventDefault(); // Prevent default link behavior
|
||||
let page = parseInt(event.target.getAttribute("data-page"));
|
||||
currentPage = page;
|
||||
loadProducts(page, false);
|
||||
// Scroll to top
|
||||
window.scrollTo({
|
||||
top: 0,
|
||||
behavior: "smooth" // Optional smooth scrolling behavior
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
// Load initial products on page load
|
||||
loadProducts(currentPage);
|
||||
// Attach click event listeners to pagination links
|
||||
// document.getElementById("pagination-container").addEventListener("click", function(event) {
|
||||
// if (event.target.tagName.toLowerCase() === "a") {
|
||||
// event.preventDefault(); // Prevent default link behavior
|
||||
// let page = event.target.getAttribute("data-page");
|
||||
// loadProducts(page); // Load products for the clicked page
|
||||
// }
|
||||
// });
|
||||
// Load initial products on page load
|
||||
loadProducts(currentPage);
|
||||
// Attach click event listeners to pagination links
|
||||
// document.getElementById("pagination-container").addEventListener("click", function(event) {
|
||||
// if (event.target.tagName.toLowerCase() === "a") {
|
||||
// event.preventDefault(); // Prevent default link behavior
|
||||
// let page = event.target.getAttribute("data-page");
|
||||
// loadProducts(page); // Load products for the clicked page
|
||||
// }
|
||||
// });
|
||||
|
||||
// // Attach event listener to search form or button
|
||||
// document.getElementById("search-form").addEventListener("submit", function(event) {
|
||||
// event.preventDefault(); // Prevent default form submission
|
||||
// let searchQuery = document.getElementById("search-input").value;
|
||||
// console.log(searchQuery + " search clicked");
|
||||
// // Make AJAX request to fetch products based on search query
|
||||
// // You need to implement this part in a similar way to loading products
|
||||
// });
|
||||
});
|
||||
// // Attach event listener to search form or button
|
||||
// document.getElementById("search-form").addEventListener("submit", function(event) {
|
||||
// event.preventDefault(); // Prevent default form submission
|
||||
// let searchQuery = document.getElementById("search-input").value;
|
||||
// console.log(searchQuery + " search clicked");
|
||||
// // Make AJAX request to fetch products based on search query
|
||||
// // You need to implement this part in a similar way to loading products
|
||||
// });
|
||||
});
|
||||
</script>
|
||||
<!-- Sidebar Area Start -->
|
||||
<div class="ec-shop-leftside col-lg-3 order-lg-first col-md-12 order-md-last">
|
||||
|
|
124
user-profile.php
124
user-profile.php
|
@ -219,7 +219,7 @@ if ($_SESSION["isVendor"] == true) {
|
|||
class="ec-vendor-detail-block ec-vendor-block-contact space-bottom-30">
|
||||
<h6>Contact number</h6>
|
||||
<ul>
|
||||
<li><strong><?php echo $customer_data[0]['phone_number'] ?></li>
|
||||
<li><strong><?php echo $customer_data['phone_number'] ?></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -233,6 +233,10 @@ if ($_SESSION["isVendor"] == true) {
|
|||
<div class="shipping">
|
||||
<?php foreach ($customer_data[0]['address'] as $address) : ?>
|
||||
<?php if ($address['shipping']) : ?>
|
||||
<div>
|
||||
<span style="font-size:16px;font-weight:800;">Shipping
|
||||
Address:</span>
|
||||
</div>
|
||||
<div class="sName">
|
||||
<span>Name:
|
||||
<span
|
||||
|
@ -261,8 +265,70 @@ if ($_SESSION["isVendor"] == true) {
|
|||
</span>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<?php if ($address['billing']) : ?>
|
||||
<div>
|
||||
<span style="font-size:16px;font-weight:800;">Billing
|
||||
Address:</span>
|
||||
</div>
|
||||
<div class="sName">
|
||||
<span>Name:
|
||||
<span
|
||||
id="selectedBillingFName"><?php echo $address['first_name']; ?></span>
|
||||
<span id="selectedBillingLName">
|
||||
<?php echo $address['last_name']; ?></span>
|
||||
</span>
|
||||
</div>
|
||||
<div class="sContact">
|
||||
<span id="selectedBillingContact">Contact #:
|
||||
<?php echo $address['phone']; ?></span>
|
||||
</div>
|
||||
<div class="sAddress">
|
||||
<span>Address:
|
||||
<span
|
||||
id="sBillingBuilding"><?php echo $address['address_1']; ?></span>
|
||||
<span
|
||||
id="sBillingStreet"><?php echo $address['address_2']; ?></span>
|
||||
<span
|
||||
id="sBillingBarangay"><?php echo $address['barangay']; ?></span>
|
||||
<span
|
||||
id="sBillingCity"><?php echo $address['city']; ?></span>
|
||||
<span
|
||||
id="sBillingProvince"><?php echo $address['province']; ?></span>
|
||||
<span
|
||||
id="sBillingCountry"><?php echo $address['country']; ?></span>
|
||||
</span>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
<!-- <div class="billing">
|
||||
<php foreach ($customer_data[0]['address'] as $address) : ?>
|
||||
<php if ($address['billing']) : ?>
|
||||
<div>
|
||||
<span style="font-size:16px;font-weight:800;"><php var_dump($address); ?>Billing Address:</span>
|
||||
</div>
|
||||
<div class="sName">
|
||||
<span>Name:
|
||||
<span id="selectedBillingFName"><php echo $address['first_name']; ?></span>
|
||||
<span id="selectedBillingLName"> <php echo $address['last_name']; ?></span>
|
||||
</span>
|
||||
</div>
|
||||
<div class="sContact">
|
||||
<span id="selectedBillingContact">Contact #: <php echo $address['phone']; ?></span>
|
||||
</div>
|
||||
<div class="sAddress">
|
||||
<span>Address:
|
||||
<span id="sBillingBuilding"><php echo $address['address_1']; ?></span>
|
||||
<span id="sBillingStreet"><php echo $address['address_2']; ?></span>
|
||||
<span id="sBillingBarangay"><php echo $address['barangay']; ?></span>
|
||||
<span id="sBillingCity"><php echo $address['city']; ?></span>
|
||||
<span id="sBillingProvince"><php echo $address['province']; ?></span>
|
||||
<span id="sBillingCountry"><php echo $address['country']; ?></span>
|
||||
</span>
|
||||
</div>
|
||||
<php endif; ?>
|
||||
<php endforeach; ?>
|
||||
</div> -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -291,14 +357,15 @@ if ($_SESSION["isVendor"] == true) {
|
|||
<div class="selectCon">
|
||||
<div class="selectWrap"
|
||||
style="display: flex; justify-content: center; align-items: center; width: 50%;">
|
||||
<!-- <input type="radio" style="padding-left: 0px !important; margin: 0px 0px !important;" name="selectedBillingAddress[<?php # echo $customer_index; ?>]" id="billing_address_<?php # echo $customer_index; ?>_<?php # echo $address_index; ?>" value="<?php # echo $customer_index; ?>_<?php # echo $address_index; ?>" class="form-check-input" onchange="updateAddressBilling('<?php # echo $customer['_id']; ?>', <?php # echo $address_index; ?>, true)" <?php # echo $address["billing"] ? 'checked' : ''; ?>> -->
|
||||
<input type="radio"
|
||||
style="padding-left: 0px !important; margin: 0px 0px !important;"
|
||||
name="selectedBillingAddress[<?php echo $customer_index; ?>]"
|
||||
id="billing_address_<?php echo $customer_index; ?>_<?php echo $address_index; ?>"
|
||||
value="<?php echo $customer_index; ?>_<?php echo $address_index; ?>"
|
||||
name="selectedBillingAddress[<?php echo $customer_index; ?>]"
|
||||
id="billing_address_<?php echo $customer_index; ?>_<?php echo $address_index; ?>"
|
||||
value="<?php echo $customer_index; ?>_<?php echo $address_index; ?>"
|
||||
class="form-check-input"
|
||||
<?php echo $address["billing"] ? 'checked' : ''; ?>>
|
||||
onchange="updateAddressBilling('<?php echo $customer['_id']; ?>', <?php echo $address_index; ?>, true)"
|
||||
<?php echo $address["billing"] ? 'checked' : ''; ?>>
|
||||
<!-- <input type="radio" style="padding-left: 0px !important; margin: 0px 0px !important;" name="selectedBillingAddress[<?php # echo $customer_index; ?>]" id="billing_address_<?php # echo $customer_index; ?>_<?php # echo $address_index; ?>" value="<?php # echo $customer_index; ?>_<?php # echo $address_index; ?>" class="form-check-input" <?php # echo $address["billing"] ? 'checked' : ''; ?>> -->
|
||||
<label class="form-check-label" style="margin: 0px 10px !important;"
|
||||
for="billing_address_<?php echo $customer_index; ?>_<?php echo $address_index; ?>">
|
||||
Billing Address
|
||||
|
@ -307,14 +374,15 @@ if ($_SESSION["isVendor"] == true) {
|
|||
|
||||
<div class="selectWrap"
|
||||
style="display: flex; justify-content: center; align-items: center; width: 50%; margin-left:-20px;">
|
||||
<!-- <input type="radio" style="padding-left: 0px !important; margin: 0px 0px !important;" name="selectedShippingAddress[<?php # echo $customer_index; ?>]" id="shipping_address_<?php # echo $customer_index; ?>_<?php # echo $address_index; ?>" value="<?php # echo $customer_index; ?>_<?php # echo $address_index; ?>" class="form-check-input" onchange="updateAddressShipping('<?php # echo $customer['_id']; ?>', <?php # echo $address_index; ?>, true)" <?php # echo $address["shipping"] ? 'checked' : ''; ?>> -->
|
||||
<input type="radio"
|
||||
style="padding-left: 0px !important; margin: 0px 0px !important;"
|
||||
name="selectedShippingAddress[<?php echo $customer_index; ?>]"
|
||||
id="shipping_address_<?php echo $customer_index; ?>_<?php echo $address_index; ?>"
|
||||
value="<?php echo $customer_index; ?>_<?php echo $address_index; ?>"
|
||||
name="selectedShippingAddress[<?php echo $customer_index; ?>]"
|
||||
id="shipping_address_<?php echo $customer_index; ?>_<?php echo $address_index; ?>"
|
||||
value="<?php echo $customer_index; ?>_<?php echo $address_index; ?>"
|
||||
class="form-check-input"
|
||||
<?php echo $address["billing"] ? 'checked' : ''; ?>>
|
||||
onchange="updateAddressShipping('<?php echo $customer['_id']; ?>', <?php echo $address_index; ?>, true)"
|
||||
<?php echo $address["shipping"] ? 'checked' : ''; ?>>
|
||||
<!-- <input type="radio" style="padding-left: 0px !important; margin: 0px 0px !important;" name="selectedShippingAddress[<?php # echo $customer_index; ?>]" id="shipping_address_<?php # echo $customer_index; ?>_<?php # echo $address_index; ?>" value="<?php # echo $customer_index; ?>_<?php # echo $address_index; ?>" class="form-check-input" <?php # echo $address["billing"] ? 'checked' : ''; ?>> -->
|
||||
<label class="form-check-label" style="margin: 0px 10px !important;"
|
||||
for="shipping_address_<?php echo $customer_index; ?>_<?php echo $address_index; ?>">
|
||||
Shipping Address
|
||||
|
@ -367,9 +435,7 @@ if ($_SESSION["isVendor"] == true) {
|
|||
</div>
|
||||
<?php } ?>
|
||||
<?php } ?>
|
||||
<button type="button"
|
||||
onclick="updateAddressBilling('<?php echo $customer['_id']; ?>', <?php echo $address_index; ?>, true)">Use
|
||||
Selected Address</button>
|
||||
<!-- <button type="button" onclick="updateAddressBilling('<?php # echo $customer['_id']; ?>', <?php # echo $address_index; ?>, true)">Use Selected Address</button> -->
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -811,7 +877,7 @@ if ($_SESSION["isVendor"] == true) {
|
|||
if (selectedCityCode) {
|
||||
fetch(
|
||||
`https://psgc.gitlab.io/api/cities-municipalities/${selectedCityCode}/barangays/`
|
||||
)
|
||||
)
|
||||
.then(response => {
|
||||
if (response.ok) {
|
||||
return response.json();
|
||||
|
@ -945,7 +1011,7 @@ if ($_SESSION["isVendor"] == true) {
|
|||
if (selectedCityCode) {
|
||||
fetch(
|
||||
`https://psgc.gitlab.io/api/cities-municipalities/${selectedCityCode}/barangays/`
|
||||
)
|
||||
)
|
||||
.then(response => {
|
||||
if (response.ok) {
|
||||
return response.json();
|
||||
|
@ -1179,6 +1245,28 @@ if ($_SESSION["isVendor"] == true) {
|
|||
if (!updateResponse.ok) {
|
||||
throw new Error(`Failed to update address: ${updateResponse.status}`);
|
||||
}
|
||||
|
||||
const selectedBillingElement = document.getElementById('selectedBillingFName');
|
||||
const selectedBillingLNameElement = document.getElementById('selectedBillingLName');
|
||||
const selectedBillingContactElement = document.getElementById('selectedBillingContact');
|
||||
const sBillingBuildingElement = document.getElementById('sBillingBuilding');
|
||||
const sBillingStreetElement = document.getElementById('sBillingStreet');
|
||||
const sBillingBarangayElement = document.getElementById('sBillingBarangay');
|
||||
const sBillingCityElement = document.getElementById('sBillingCity');
|
||||
const sBillingProvinceElement = document.getElementById('sBillingProvince');
|
||||
const sBillingCountryElement = document.getElementById('sBillingCountry');
|
||||
if (selectedBillingElement) {
|
||||
selectedBillingElement.textContent = customerData.address[addressIndex].first_name;
|
||||
selectedBillingLNameElement.textContent = customerData.address[addressIndex].last_name;
|
||||
selectedBillingContactElement.textContent = 'Contact #: ' + customerData.address[addressIndex]
|
||||
.phone;
|
||||
sBillingBuildingElement.textContent = customerData.address[addressIndex].address_1;
|
||||
sBillingStreetElement.textContent = customerData.address[addressIndex].address_2;
|
||||
sBillingBarangayElement.textContent = customerData.address[addressIndex].barangay;
|
||||
sBillingCityElement.textContent = customerData.address[addressIndex].city;
|
||||
sBillingProvinceElement.textContent = customerData.address[addressIndex].province;
|
||||
sBillingCountryElement.textContent = customerData.address[addressIndex].country;
|
||||
}
|
||||
console.log(`Address updated successfully for customer ${customerId}`);
|
||||
} catch (error) {
|
||||
console.error('Error updating address:', error.message);
|
||||
|
@ -1256,8 +1344,8 @@ if ($_SESSION["isVendor"] == true) {
|
|||
sCountryElement.textContent = customerData.address[addressIndex].country;
|
||||
}
|
||||
console.log(`Address updated successfully for customer ${customerId}`);
|
||||
location.reload();
|
||||
header("location: user-profile.php");
|
||||
// location.reload();
|
||||
// header("location: user-profile.php");
|
||||
} catch (error) {
|
||||
console.error('Error updating address:', error.message);
|
||||
}
|
||||
|
|
|
@ -137,13 +137,13 @@ $vendorPayoutData = json_decode($response, true);
|
|||
<div class="col-12">
|
||||
<div class="row ec_breadcrumb_inner">
|
||||
<div class="col-md-6 col-sm-12">
|
||||
<h2 class="ec-breadcrumb-title">Vendor Settings</h2>
|
||||
<h2 class="ec-breadcrumb-title">Vendor Payouts</h2>
|
||||
</div>
|
||||
<div class="col-md-6 col-sm-12">
|
||||
<!-- ec-breadcrumb-list start -->
|
||||
<ul class="ec-breadcrumb-list">
|
||||
<li class="ec-breadcrumb-item"><a href="index.php">Home</a></li>
|
||||
<li class="ec-breadcrumb-item active">Settings</li>
|
||||
<li class="ec-breadcrumb-item active">Payouts</li>
|
||||
</ul>
|
||||
<!-- ec-breadcrumb-list end -->
|
||||
</div>
|
||||
|
|
|
@ -265,10 +265,6 @@ if ($_SESSION["isCustomer"] == true) {
|
|||
</span>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
<div class="billing">
|
||||
<?php foreach ($vendorData['address'] as $address) : ?>
|
||||
<?php if ($address['billing']) : ?>
|
||||
<div>
|
||||
<span style="font-size:16px;font-weight:800;">Billing Address:</span>
|
||||
|
@ -295,6 +291,34 @@ if ($_SESSION["isCustomer"] == true) {
|
|||
<?php endif; ?>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
<!-- <div class="billing">
|
||||
<php foreach ($vendorData['address'] as $address) : ?>
|
||||
<php if ($address['billing']) : ?>
|
||||
<div>
|
||||
<span style="font-size:16px;font-weight:800;">Billing Address:</span>
|
||||
</div>
|
||||
<div class="sName">
|
||||
<span>Name:
|
||||
<span id="selectedBillingFName"><php echo $address['first_name']; ?></span>
|
||||
<span id="selectedBillingLName"> <php echo $address['last_name']; ?></span>
|
||||
</span>
|
||||
</div>
|
||||
<div class="sContact">
|
||||
<span id="selectedBillingContact">Contact #: <php echo $address['phone']; ?></span>
|
||||
</div>
|
||||
<div class="sAddress">
|
||||
<span>Address:
|
||||
<span id="sBillingBuilding"><php echo $address['address_1']; ?></span>
|
||||
<span id="sBillingStreet"><php echo $address['address_2']; ?></span>
|
||||
<span id="sBillingBarangay"><php echo $address['barangay']; ?></span>
|
||||
<span id="sBillingCity"><php echo $address['city']; ?></span>
|
||||
<span id="sBillingProvince"><php echo $address['province']; ?></span>
|
||||
<span id="sBillingCountry"><php echo $address['country']; ?></span>
|
||||
</span>
|
||||
</div>
|
||||
<php endif; ?>
|
||||
<php endforeach; ?>
|
||||
</div> -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -31,19 +31,19 @@ $token = $_SESSION["token"];
|
|||
|
||||
|
||||
$response = addProduct(
|
||||
$vendorId,
|
||||
$productName,
|
||||
$stock,
|
||||
$price,
|
||||
$salePrice,
|
||||
$weight,
|
||||
$length,
|
||||
$width,
|
||||
$height,
|
||||
$specifications,
|
||||
$productType,
|
||||
$parentId,
|
||||
$token);
|
||||
$vendorId,
|
||||
$productName,
|
||||
$stock,
|
||||
$price,
|
||||
$salePrice,
|
||||
$weight,
|
||||
$length,
|
||||
$width,
|
||||
$height,
|
||||
$specifications,
|
||||
$productType,
|
||||
$parentId,
|
||||
$token);
|
||||
$array = json_decode($response,true);
|
||||
$_SESSION['newProductId'] = $array['_id'];
|
||||
header("location: vendor-uploads.php");
|
||||
|
|
|
@ -54,32 +54,32 @@ for ($i = 0; $i < count($quantities); $i++) {
|
|||
|
||||
|
||||
$response = editProduct(
|
||||
$productId,
|
||||
$vendorId,
|
||||
$productName,
|
||||
$stock,
|
||||
$ndd,
|
||||
$sdd,
|
||||
$freeSf,
|
||||
$price,
|
||||
$salePrice,
|
||||
$weight,
|
||||
$length,
|
||||
$width,
|
||||
$height,
|
||||
$description,
|
||||
$specifications,
|
||||
$productType,
|
||||
$productCategory,
|
||||
$productSf,
|
||||
$productStatus,
|
||||
$parentId,
|
||||
$minimumOrder,
|
||||
$color,
|
||||
$material,
|
||||
$size,
|
||||
$priceMatrix,
|
||||
$token);
|
||||
$productId,
|
||||
$vendorId,
|
||||
$productName,
|
||||
$stock,
|
||||
$ndd,
|
||||
$sdd,
|
||||
$freeSf,
|
||||
$price,
|
||||
$salePrice,
|
||||
$weight,
|
||||
$length,
|
||||
$width,
|
||||
$height,
|
||||
$description,
|
||||
$specifications,
|
||||
$productType,
|
||||
$productCategory,
|
||||
$productSf,
|
||||
$productStatus,
|
||||
$parentId,
|
||||
$minimumOrder,
|
||||
$color,
|
||||
$material,
|
||||
$size,
|
||||
$priceMatrix,
|
||||
$token);
|
||||
$array = json_decode($response,true);
|
||||
$_SESSION['newProdictId'] = $array['_id'];
|
||||
header("location: vendor-all-product-list.php");
|
||||
|
|
|
@ -345,32 +345,32 @@ if ($_SESSION["isCustomer"] == true) {
|
|||
<div class="col-md-12">
|
||||
<label for="slug" class="col-12 col-form-label">Slug</label>
|
||||
<div class="col-12">
|
||||
<input id="slug" name="slug" class="form-control here set-slug" type="text">
|
||||
<input id="slug" name="slug" class="form-control here set-slug" type="text" required>
|
||||
</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>
|
||||
<input type="number" class="form-control slug-title" id="width" name="weight" value="<?php echo $array['weight']; ?>">
|
||||
<input type="number" class="form-control slug-title" id="width" name="weight" value="<?php echo $array['weight']; ?>" required>
|
||||
</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>
|
||||
<input type="number" class="form-control slug-title" id="width" name="length" value="<?php echo $array['length']; ?>">
|
||||
<input type="number" class="form-control slug-title" id="width" name="length" value="<?php echo $array['length']; ?>" required>
|
||||
</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>
|
||||
<input type="number" class="form-control slug-title" id="width" name="width" value="<?php echo $array['width']; ?>">
|
||||
<input type="number" class="form-control slug-title" id="width" name="width" value="<?php echo $array['width']; ?>" required>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<!-- <label for="height" class="form-label">Height</label> -->
|
||||
<!-- raymart edit height -->
|
||||
<label for="height" class="form-label">Height(cm)</label>
|
||||
<input type="number" class="form-control slug-title" id="height" name="height" value="<?php echo $array['height']; ?>">
|
||||
<input type="number" class="form-control slug-title" id="height" name="height" value="<?php echo $array['height']; ?>" required>
|
||||
</div>
|
||||
<!-- raymart added short des feb 21 2024 -->
|
||||
<div class="col-md-12">
|
||||
|
|
Loading…
Reference in New Issue