diff --git a/admin/product-edit.php b/admin/product-edit.php
index 4ec941c..81cfeb2 100644
--- a/admin/product-edit.php
+++ b/admin/product-edit.php
@@ -1130,10 +1130,10 @@ $vendorId = $_SESSION["vendorId"];
promises.push(promise);
}
-
+ // 03-14-2024 Jun Jihad modified this block of code to properly upload images with comma in the filename
Promise.all(promises)
.then(filenames => {
- const updatedImages = existingImages.concat(filenames.map(filename => `https:///images/storage/product_uploads/${filename}`));
+ const updatedImages = existingImages.concat(filenames.map(filename => `https:///images/storage/product_uploads/${encodeURIComponent(filename)}`));
if (!Array.isArray(updatedImages)) {
console.error('Updated images is not an array:', updatedImages);
@@ -1154,6 +1154,7 @@ $vendorId = $_SESSION["vendorId"];
body: JSON.stringify(payload)
});
})
+ // 03-14-2024 Jun Jihad modified this block of code to properly upload images with comma in the filename
.then(response => {
if (response.ok) {
console.log('Images uploaded successfully');
diff --git a/admin/vendor-card.php b/admin/vendor-card.php
index d8ab00d..79fea72 100644
--- a/admin/vendor-card.php
+++ b/admin/vendor-card.php
@@ -4,7 +4,7 @@ include "../functions.php";
$_SESSION["url"] = $_SERVER['REQUEST_URI'];
if ($_SESSION["userId"] <> "") {
$_SESSION["isLoggedIn"] = true;
- $customer_data = getCustomerbyLoginId($_SESSION["userId"]);
+ //$customer_data = getCustomerbyLoginId($_SESSION["userId"]);
} else {
$_SESSION["isLoggedIn"] = false;
header("location: login.php");
@@ -14,8 +14,6 @@ if ($_SESSION["user_type"] != "admin") {
header("location: login.php?alert=Only admins allowed here!");
}
$products = productList();
-
-$vendorSearchResult = $_SESSION["vendorSearchResult"];
?>
@@ -66,8 +64,7 @@ $vendorSearchResult = $_SESSION["vendorSearchResult"];
-
-
+
@@ -92,22 +89,17 @@ $vendorSearchResult = $_SESSION["vendorSearchResult"];
-
-
-
@@ -673,49 +665,10 @@ $vendorSearchResult = $_SESSION["vendorSearchResult"];
$start = ($currentpage - 1) * $vendorsPerPage;
$end = $start + $vendorsPerPage - 1;
-
-
- $vendorsCopy = $vendors;
- // var_dump($vendorsCopy
- // );
-
-
- // 03-07-2024 added searh filter
- if (!empty($_GET['search']) ) {
- $filteredProducts=[];
- foreach ($vendorsCopy as $result) {
- $vendorName = strtolower($result['user_login']);
- if (
- // $result['user_login'] == $_GET['search']
- strpos($vendorName,$_GET['search'])!==false
- ) {
- $filteredProducts[] = $result;
- // var_dump("herees");
-
- // var_dump($_GET['search']);
- } else{
- // var_dump("none");
-
- }
- }
-
- $vendors = $filteredProducts;
- $totalVendors = count($filteredProducts);
- $vendorsPerPage = 20;
- }
- else{
- // $vendors=$vendorsCopy;
- }
-
- if ($totalVendors == 0) {
- echo '
No vendor found.
';
- }
-
// $vendors = vendorList();
for ($x = $start; $x <= $end && $x < $totalVendors; $x++) {
$vendor = $vendors[$x];
?>
-
@@ -806,7 +759,7 @@ $vendorSearchResult = $_SESSION["vendorSearchResult"];
';
+ echo '
';
} else {
echo '
';
}
@@ -822,21 +775,22 @@ $vendorSearchResult = $_SESSION["vendorSearchResult"];
label.innerHTML = '
Upload file';
}
}
+ // 03-14-2024 Jun Jihad modified this block of code to show preview of the image to be uploaded
+ function previewImage(vendorId) {
+ var fileInput = document.getElementById('fileInput' + vendorId);
+ var file = fileInput.files[0];
+ console.log('clicked hereee');
+ const reader = new FileReader();
- // 02-29-2024 Stacy for image preview
- function previewImage(vendorId){
- var fileInput = document.getElementById('fileInput' + vendorId);
- var file = fileInput.files[0];
- console.log('clicked hereee')
- const reader = new FileReader();
-
- reader.onload = function (e) {
+ reader.onload = function (e) {
const dataUri = e.target.result;
- document.getElementById('imgPrev').src=dataUri
- };
+ document.getElementById('imgPrev' + vendorId).src = dataUri; // Fixed concatenation here
+ };
+
+ reader.readAsDataURL(file);
+ }
+ // 03-14-2024 Jun Jihad modified this block of code to show preview of the image to be uploaded
- reader.readAsDataURL(file);
- }
-
-
+
diff --git a/vendor-uploads-edit-product-action.php b/vendor-uploads-edit-product-action.php
index 4aca644..6b58249 100644
--- a/vendor-uploads-edit-product-action.php
+++ b/vendor-uploads-edit-product-action.php
@@ -40,6 +40,18 @@ $material = $_POST['material'];
//echo '$material: '.$material.'
';
$token = $_SESSION["token"];
+$quantities = $_POST['quantity'];
+$prices = $_POST['price'];
+
+// Constructing the price matrix
+$priceMatrix = array();
+for ($i = 0; $i < count($quantities); $i++) {
+ $priceMatrix[] = array(
+ 'quantity' => $quantities[$i],
+ 'price' => $prices[$i]
+ );
+}
+
$response = editProduct(
$productId,
@@ -66,6 +78,7 @@ $response = editProduct(
$color,
$material,
$size,
+ $priceMatrix,
$token);
$array = json_decode($response,true);
$_SESSION['newProdictId'] = $array['_id'];
diff --git a/vendor-uploads.php b/vendor-uploads.php
index b2639a8..a60d129 100644
--- a/vendor-uploads.php
+++ b/vendor-uploads.php
@@ -118,14 +118,16 @@ $array = json_decode($result, true);
-
-
-
+ if (!empty($vendorData['vendor_banner'])) { ?>
+
+
+
-
+
-
+
@@ -134,7 +136,7 @@ $array = json_decode($result, true);
-
+
+
+
+
+
+
+
-
@@ -473,7 +500,7 @@ $array = json_decode($result, true);