diff --git a/admin/config.php b/admin/config.php
index 9b40b50..57d9763 100644
--- a/admin/config.php
+++ b/admin/config.php
@@ -1,7 +1,7 @@
';
$stock = $_POST['stock'];
+// 02-19-2024 Jun Jihad Promo Field Product Upload Vendor Page Action
+$ndd = isset($_POST['promo']['next-day-delivery']) ? $_POST['promo']['next-day-delivery'] : 'No';
+$sdd = isset($_POST['promo']['same-day-delivery']) ? $_POST['promo']['same-day-delivery'] : 'No';
+$freeSf = isset($_POST['promo']['free-shipping']) ? $_POST['promo']['free-shipping'] : 'No';
+// 02-19-2024 Jun Jihad Promo Field Product Upload Vendor Page Action
$minimumOrder = $_POST['minimum_order'];
//echo '$stock: '.$stock.' ';
$price = $_POST['regular_price'];
@@ -40,6 +45,9 @@ $response = editProduct(
$vendorId,
$productName,
$stock,
+ $ndd,
+ $sdd,
+ $freeSf,
$price,
$salePrice,
$weight,
@@ -57,8 +65,7 @@ $response = editProduct(
$color,
$material,
$size,
- $token
-);
+ $token);
$array = json_decode($response, true);
$_SESSION['prodictId'] = $array['_id'];
header("location: vendor-product-grid.php");
diff --git a/admin/product-edit.php b/admin/product-edit.php
index 6968787..4ec941c 100644
--- a/admin/product-edit.php
+++ b/admin/product-edit.php
@@ -672,86 +672,103 @@ $vendorId = $_SESSION["vendorId"];
@@ -890,6 +907,31 @@ $vendorId = $_SESSION["vendorId"];
)
+
+
Stock
@@ -997,105 +1039,134 @@ $vendorId = $_SESSION["vendorId"];
}
}
- function uploadImage() {
+ function uploadProductImage() {
var productId = '';
var fileInput = document.getElementById('imageUpload');
- var file = fileInput.files[0];
+ var files = fileInput.files;
- if (file) {
- const reader = new FileReader();
- reader.onload = function(e) {
- const img = new Image();
- img.onload = function() {
- const canvas = document.createElement('canvas');
- const ctx = canvas.getContext('2d');
+ if (files.length > 0) {
+ var promises = [];
+ var existingImages = [];
- // Resize the image
- const maxWidth = 1200; // Set your desired maximum width
- const maxHeight = 1000; // Set your desired maximum height
- const aspectRatio = img.width / img.height;
+ fetch('https:///api/v1/products/' + productId)
+ .then(response => response.json())
+ .then(product => {
+ existingImages = product.images || [];
+ existingImages = Array.isArray(existingImages) ? existingImages : [existingImages];
+ existingImages = existingImages.filter(image => image);
+ })
+ .catch(error => {
+ console.error('Error fetching existing images:', error);
+ });
- let newWidth = img.width;
- let newHeight = img.height;
+ for (let i = 0; i < files.length; i++) {
+ const file = files[i];
+ const reader = new FileReader();
- if (img.width > maxWidth) {
- newWidth = maxWidth;
- newHeight = newWidth / aspectRatio;
- }
+ const promise = new Promise((resolve, reject) => {
+ reader.onload = function(e) {
+ const img = new Image();
+ img.onload = function() {
+ const canvas = document.createElement('canvas');
+ const ctx = canvas.getContext('2d');
+ const maxWidth = 1200;
+ const maxHeight = 1000;
+ const aspectRatio = img.width / img.height;
+ let newWidth = img.width;
+ let newHeight = img.height;
- if (newHeight > maxHeight) {
- newHeight = maxHeight;
- newWidth = newHeight * aspectRatio;
- }
+ if (img.width > maxWidth) {
+ newWidth = maxWidth;
+ newHeight = newWidth / aspectRatio;
+ }
- canvas.width = newWidth;
- canvas.height = newHeight;
+ if (newHeight > maxHeight) {
+ newHeight = maxHeight;
+ newWidth = newHeight * aspectRatio;
+ }
- // Draw the image on the canvas
- ctx.drawImage(img, 0, 0, newWidth, newHeight);
+ canvas.width = newWidth;
+ canvas.height = newHeight;
+ ctx.drawImage(img, 0, 0, newWidth, newHeight);
- // Convert the canvas content to a new image file
- canvas.toBlob((blob) => {
- const resizedFile = new File([blob], file.name, {
- type: 'image/jpeg'
- });
+ canvas.toBlob((blob) => {
+ const resizedFile = new File([blob], file.name, {
+ type: 'image/jpeg'
+ });
- // Continue with the rest of your upload logic using the resized file
- var formData = new FormData();
- formData.append('image_id', productId);
- formData.append('category', 'product');
- formData.append('image', resizedFile);
+ var formData = new FormData();
+ formData.append('image_id', productId);
+ formData.append('category', 'product');
+ formData.append('image', resizedFile);
- fetch('https:///api/v1/upload_image', {
- method: 'POST',
- body: formData
- })
- .then(response => {
- if (response.ok) {
- return response.json();
- } else {
- console.error('File upload failed');
- throw new Error('File upload failed');
- }
- })
- .then(result => {
- const filename = result.filename;
+ fetch('https:///api/v1/upload_image', {
+ method: 'POST',
+ body: formData
+ })
+ .then(response => {
+ if (response.ok) {
+ return response.json();
+ } else {
+ console.error('File upload failed');
+ reject(new Error('File upload failed'));
+ }
+ })
+ .then(result => {
+ const filename = result.filename;
+ resolve(filename);
+ })
+ .catch(error => {
+ console.error('Error during fetch:', error);
+ reject(error);
+ });
+ }, 'image/jpeg');
+ };
- const payload = {
- product_image: `https:///images/storage/product_uploads/${filename}`,
- };
+ img.src = e.target.result;
+ };
- console.log('Payload:', payload);
- const token = '';
- return fetch('https:///api/v1/products/' + productId, {
- method: 'PATCH',
- headers: {
- 'Content-Type': 'application/json',
- 'Authorization': 'Bearer ' + token,
- },
- body: JSON.stringify(payload)
- });
- })
- .then(secondResponse => {
- if (secondResponse.ok) {
- console.log('Second request successful');
- location.reload();
- } else {
- console.error('Second request failed');
- }
- })
- .catch(error => {
- console.error('Error during fetch:', error);
- });
- }, 'image/jpeg');
- };
+ reader.readAsDataURL(file);
+ });
- img.src = e.target.result;
- };
+ promises.push(promise);
+ }
- reader.readAsDataURL(file);
- }
- }
+ Promise.all(promises)
+ .then(filenames => {
+ const updatedImages = existingImages.concat(filenames.map(filename => `https:///images/storage/product_uploads/${filename}`));
+
+ if (!Array.isArray(updatedImages)) {
+ console.error('Updated images is not an array:', updatedImages);
+ throw new Error('Updated images is not an array');
+ }
+ const imagesString = updatedImages.join(',');
+ const payload = {
+ images: imagesString,
+ };
+
+ const token = '';
+ return fetch('https:///api/v1/products/' + productId, {
+ method: 'PATCH',
+ headers: {
+ 'Content-Type': 'application/json',
+ 'Authorization': 'Bearer ' + token,
+ },
+ body: JSON.stringify(payload)
+ });
+ })
+ .then(response => {
+ if (response.ok) {
+ console.log('Images uploaded successfully');
+ location.reload();
+ } else {
+ console.error('Image upload failed');
+ }
+ })
+ .catch(error => {
+ console.error('Error during image upload:', error);
+ });
+ }
+ }
diff --git a/admin/update-token-session.php b/admin/update-token-session.php
index 3423690..9162fc5 100644
--- a/admin/update-token-session.php
+++ b/admin/update-token-session.php
@@ -6,7 +6,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
if (isset($input['token'])) {
// Update the session token
- $_SESSION['token'] = $input['token'];
+ $_SESSION["token"] = $input['token'];
echo json_encode(['status' => 'success']);
} else {
echo json_encode(['status' => 'error', 'message' => 'Token not provided']);
diff --git a/assets/js/tester3.js b/assets/js/tester5.js
similarity index 96%
rename from assets/js/tester3.js
rename to assets/js/tester5.js
index 033da4c..396fff9 100644
--- a/assets/js/tester3.js
+++ b/assets/js/tester5.js
@@ -611,12 +611,14 @@ function popupAddToCart(product, productVendor, token, email, password, customer
Unit Price:
${response.items[0].price}
Subtotal: ${totalAmount}
-
`;
getLatestOrders()
diff --git a/catalog-single-vendor.php b/catalog-single-vendor.php
index 4c1332d..6923744 100644
--- a/catalog-single-vendor.php
+++ b/catalog-single-vendor.php
@@ -1092,7 +1092,7 @@ if ($_SESSION["userId"] <> "") {
';
+ echo '';
} else {
echo '';
}
diff --git a/contact-seller-action.php b/contact-seller-action.php
new file mode 100644
index 0000000..7b478db
--- /dev/null
+++ b/contact-seller-action.php
@@ -0,0 +1,42 @@
+
+
-
-
-
-
-
-
-
-
-
-
-
oBanana B2B - Elevate Your Business
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Sub-Total :
- $300.00
-
-
- VAT (20%) :
- $60.00
-
-
- Total :
- $360.00
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Someone in new just bought
-
stylish baby shoes
-
10 Minutes ago
-
-
×
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/contact-us.php b/contact-us.php
new file mode 100644
index 0000000..1a729e2
--- /dev/null
+++ b/contact-us.php
@@ -0,0 +1,528 @@
+
+
+
+
+
+
+
+
+
+
+
+
oBanana B2B - Elevate Your Business
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Sub-Total :
+ $300.00
+
+
+ VAT (20%) :
+ $60.00
+
+
+ Total :
+ $360.00
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+