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"];
- +
-
- editedit -
+
+ + edit + + edit + +
-
-
- - -
-
-
- edit -
-
-
-
-
- - -
-
-
- edit -
-
-
-
-
- - -
-
-
- edit -
-
-
-
-
- - -
-
-
- edit -
-
-
-
-
- - -
-
-
- edit -
-
-
-
-
- - -
-
-
- edit -
-
+ $image_url) { + $image_url = trim($image_url); + ?> +
+
+ +
+
+
+ edit
+
+ +
+
+ + +
+
+
+ edit +
+
+
+ + +
@@ -858,15 +875,15 @@ $vendorId = $_SESSION["vendorId"];
- +
- - + +
- +
@@ -890,6 +907,31 @@ $vendorId = $_SESSION["vendorId"]; )
+ +
+ +
+
+
+ style="background-color: blue;"> + +
+
+
+
+ style="background-color: blue;"> + +
+
+
+
+ style="background-color: blue;"> + +
+
+
+
+
@@ -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} -
-
-
- -
+
+ +
+
-
+ +
+
+
- x +
`; 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 - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-
-
-
-
-
-
- - -
- -
-
-
- -
-
- -
    -
  • -
  • -
  • -
  • -
-
-
- - -
-
- Free ShippingThis Week Order Over - $75 -
-
- - -
-
- - - - - - - -
-
- - -
-
- - - - - -
- 4 -
- - - -
- 3 -
- - - - - - -
-
- -
-
-
- - -
-
-
-
- -
- -
- - - -
- -
- - - -
-
- - - - - - -
- 4 -
- - - -
- 3 -
- -
-
-
-
-
-
- - -
-
-
- - -
- -
- - -
- -
- -
-
-
- - - - - -
-
- My Menu - -
-
-
- -
-
-
- - - - - - -
- -
-
-
    -
  • -
  • -
  • -
  • -
-
-
- -
-
-
- -
- - - -
-
-
-
-
- My Cart - -
- -
-
-
- - - - - - - - - - - - - - - -
Sub-Total :$300.00
VAT (20%) :$60.00
Total :$360.00
-
- -
-
-
- - - -
-
-
-
-
-
-

Contact Us

-
-
- -
    -
  • Home
  • -
  • Contact Us
  • -
- -
-
-
-
-
-
- - - -
-
-
-
-
-
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-
-
-
-
-
- - -
-
-
-

Contact us

- -
-
-
-
-
-
- - - - - - -
-
-
-
- -
-
- 3 -
-
- -
-
- 4 -
-
- -
- -
-
-
- - - -
- payment image -
-

Someone in new just bought

-
stylish baby shoes
-

10 Minutes ago

-
- × -
- - - -
- -
-
- 3 -
-
- - - -
- - - - -
-
-
- whatsapp icon -
-
-
- -
- - - -
-
-
-

Features

-
- - icon - -
-
-

Color Scheme

-
    -
  • -
  • -
  • -
  • -
  • -
-
-
-

Backgrounds

- -
-
-

Full Screen mode

-
-
-
Mode
-
On
-
Off
-
-
-
-
-

Dark mode

-
-
-
Mode
-
On
-
Off
-
-
-
-
-

RTL mode

-
-
-
Rtl
-
On
-
Off
-
-
-
-
-

Clear local storage

- Clear Cache & Default -
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - \ 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 + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+
+
+
+
+
+ + + + + + +
+
+
+
+
+ My Cart + +
+ +
+
+
+ + + + + + + + + + + + + + + +
Sub-Total :$300.00
VAT (20%) :$60.00
Total :$360.00
+
+ +
+
+
+ + + +
+
+
+
+
+
+

Contact Us

+
+
+ +
    +
  • Home
  • +
  • Contact Us
  • +
+ +
+
+
+
+
+
+ + + +
+
+
+
+
+
+
+ + '; + echo $_SESSION["SuccessfullySent"]; + echo '
'; + unset($_SESSION["SuccessfullySent"]); + echo " "; + } + ?> + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+
+
+
+
+ + +
+
+
+

Contact us

+ +
+
+
+
+
+ + + + + + + + + +
+
+
+
+ +
+
+ 3 +
+
+ +
+
+ 4 +
+
+ +
+ +
+
+
+ + + +
+ payment image +
+

Someone in new just bought

+
stylish baby shoes
+

10 Minutes ago

+
+ × +
+ + + +
+ +
+
+ 3 +
+
+ + + +
+ +
+ +
+ Need Help? +

Chat with us on WhatsApp

+
+ + +
+ + +
+
+
+ whatsapp icon +
+
+
+ +
+ + + +
+
+
+

Features

+
+ + icon + +
+
+

Color Scheme

+
    +
  • +
  • +
  • +
  • +
  • +
+
+
+

Backgrounds

+ +
+
+

Full Screen mode

+
+
+
Mode
+
On
+
Off
+
+
+
+
+

Dark mode

+
+
+
Mode
+
On
+
Off
+
+
+
+
+

RTL mode

+
+
+
Rtl
+
On
+
Off
+
+
+
+
+

Clear local storage

+ Clear Cache & Default +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/footer.php b/footer.php index a4a2abe..048b01b 100644 --- a/footer.php +++ b/footer.php @@ -35,7 +35,10 @@ - + + + + diff --git a/functions.php b/functions.php index b234e4f..ef0387f 100644 --- a/functions.php +++ b/functions.php @@ -28,6 +28,38 @@ function simpleProducts($category) return $products; } +// 02-19-2024 Jun Jihad Same Day Filter Function +function sddProducts() +{ + $curl = curl_init(); + $url = "https://".$_SESSION["data_endpoint"]."/api/v1/products"; + curl_setopt($curl, CURLOPT_URL, $url); + curl_setopt_array($curl, array( + //CURLOPT_URL => 'https://".$_SESSION["data_endpoint"]."/api/v1/products/vendor/6527b593f79b5deac5ad6cb8', + CURLOPT_RETURNTRANSFER => true, + CURLOPT_ENCODING => '', + CURLOPT_MAXREDIRS => 10, + CURLOPT_TIMEOUT => 0, + CURLOPT_FOLLOWLOCATION => true, + CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, + CURLOPT_CUSTOMREQUEST => 'GET', + CURLOPT_HTTPHEADER => array( + 'X-Api-Key: {{apiKey}}' + ), + )); + $response = curl_exec($curl); + curl_close($curl); + $json = json_decode($response, true); + $products = array_filter($json, function ($var) { + return ($var['promo'][0]['next-day-delivery'] === "Yes" && $var['product_type'] == '' || $var['promo'][0]['next-day-delivery'] === "Yes" && $var['product_type'] == 'simple' || $var['promo'][0]['next-day-delivery'] === "Yes" && $var['product_type'] == 'variable' ); + }); + $products = array_values($products); + return $products; + return $json; // Add this line to return the decoded JSON data +} +// 02-19-2024 Jun Jihad Same Day Filter Function + + // function searchProducts($query) // { // $query = str_replace(" ", "+", $query); @@ -450,13 +482,12 @@ function vendorExists($email) return $count; } - -function sendEmail($fName, $lName, $email, $phone, $message) +function sendEmail_obanana($fName, $lName, $email, $phone, $message) { if($_SESSION["is_test"]==true && $_SESSION["test_email_rcpt"]!=""){ - $email = $_SESSION["test_email_rcpt"]; + $testEmail = $_SESSION["test_email_rcpt"]; } - $message2 = " + $msgto_obanana = "

Greetings from Obanana!

"; + $data = [ + "Messages" => [ + [ + "From" => [ + "Email" => "webdev@obanana.com", + "Name" => "Obanana B2B" + ], + "To" => [ + [ + "Email" => $testEmail, + "Name" => "Subscriber" + ] + ], + "Subject" => "Obanana Contact Us Form", + "TextPart" => "Greetings from Obanana!", + "HTMLPart" => $msgto_obanana + ] + ] + ]; + + $json = json_encode($data); + + $curl = curl_init(); + curl_setopt($curl, CURLOPT_POSTFIELDS, $json); + curl_setopt_array($curl, array( + CURLOPT_URL => "https://api.mailjet.com/v3.1/send", + CURLOPT_RETURNTRANSFER => true, + CURLOPT_ENCODING => '', + CURLOPT_MAXREDIRS => 10, + CURLOPT_TIMEOUT => 0, + CURLOPT_FOLLOWLOCATION => true, + CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, + CURLOPT_CUSTOMREQUEST => 'POST', + CURLOPT_HTTPHEADER => array( + 'Content-Type: application/json', + 'Authorization: Basic ODA4MDc4ZThjMDA4NjVhYzU4MTcyNDJjNTMxY2JlZGU6MGQ4ODg3ZTdiZjY1ZWNkMmQ0NzdiOWJhZGIyYTJhY2Q=' + ), + )); + + $response = curl_exec($curl); + curl_close($curl); + + return $response; +} + + +function sendEmail_customer($fName, $lName, $email) +{ + // if($_SESSION["is_test"]==true && $_SESSION["test_email_rcpt"]!=""){ + // $testEmail = $_SESSION["test_email_rcpt"]; + // } + $msgto_customer = " +

Greetings from Obanana!

+ "; $data = [ "Messages" => [ [ @@ -480,7 +570,126 @@ function sendEmail($fName, $lName, $email, $phone, $message) ], "Subject" => "Obanana Contact Us Form", "TextPart" => "Greetings from Obanana!", - "HTMLPart" => $message2 + "HTMLPart" => $msgto_customer + ] + ] + ]; + + $json = json_encode($data); + + $curl = curl_init(); + curl_setopt($curl, CURLOPT_POSTFIELDS, $json); + curl_setopt_array($curl, array( + CURLOPT_URL => "https://api.mailjet.com/v3.1/send", + CURLOPT_RETURNTRANSFER => true, + CURLOPT_ENCODING => '', + CURLOPT_MAXREDIRS => 10, + CURLOPT_TIMEOUT => 0, + CURLOPT_FOLLOWLOCATION => true, + CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, + CURLOPT_CUSTOMREQUEST => 'POST', + CURLOPT_HTTPHEADER => array( + 'Content-Type: application/json', + 'Authorization: Basic ODA4MDc4ZThjMDA4NjVhYzU4MTcyNDJjNTMxY2JlZGU6MGQ4ODg3ZTdiZjY1ZWNkMmQ0NzdiOWJhZGIyYTJhY2Q=' + ), + )); + + $response = curl_exec($curl); + curl_close($curl); + + return $response; +} + +function contact_Seller($cstm_email, $prd_name, $prd_qnty, $message) +{ + if($_SESSION["is_test"]==true && $_SESSION["test_email_rcpt"]!=""){ + $testEmail = $_SESSION["test_email_rcpt"]; + } + $msgto_seller = " +

Greetings from Obanana!

+ "; + $data = [ + "Messages" => [ + [ + "From" => [ + "Email" => "webdev@obanana.com", + "Name" => "Obanana B2B" + ], + "To" => [ + [ + "Email" => $testEmail, + "Name" => "Subscriber" + ] + ], + "Subject" => "Obanana Contact Seller Form", + "TextPart" => "Greetings from Obanana!", + "HTMLPart" => $msgto_seller + ] + ] + ]; + + $json = json_encode($data); + + $curl = curl_init(); + curl_setopt($curl, CURLOPT_POSTFIELDS, $json); + curl_setopt_array($curl, array( + CURLOPT_URL => "https://api.mailjet.com/v3.1/send", + CURLOPT_RETURNTRANSFER => true, + CURLOPT_ENCODING => '', + CURLOPT_MAXREDIRS => 10, + CURLOPT_TIMEOUT => 0, + CURLOPT_FOLLOWLOCATION => true, + CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, + CURLOPT_CUSTOMREQUEST => 'POST', + CURLOPT_HTTPHEADER => array( + 'Content-Type: application/json', + 'Authorization: Basic ODA4MDc4ZThjMDA4NjVhYzU4MTcyNDJjNTMxY2JlZGU6MGQ4ODg3ZTdiZjY1ZWNkMmQ0NzdiOWJhZGIyYTJhY2Q=' + ), + )); + + $response = curl_exec($curl); + curl_close($curl); + + return $response; +} + +function contact_Inquirer($cstm_email) +{ + // if($_SESSION["is_test"]==true && $_SESSION["test_email_rcpt"]!=""){ + // $testEmail = $_SESSION["test_email_rcpt"]; + // } + $msgto_inquirer = " +

Greetings from Obanana!

+ "; + $data = [ + "Messages" => [ + [ + "From" => [ + "Email" => "webdev@obanana.com", + "Name" => "Obanana B2B" + ], + "To" => [ + [ + // "Email" => $cstm_email, + "Email" => "stacyjoycemapano@gmail.com", + + "Name" => "Subscriber" + ] + ], + "Subject" => "Obanana Contact Seller Form", + "TextPart" => "Greetings from Obanana!", + "HTMLPart" => $msgto_inquirer ] ] ]; @@ -1279,6 +1488,9 @@ function editProduct( $vendorId, $productName, $stock, + $ndd, + $sdd, + $freeSf, $price, $salePrice, $weight, @@ -1315,6 +1527,11 @@ function editProduct( 'product_category' => $productCategory, 'shipping_fee' => $productSf, 'status' => $productStatus, + 'promo' => array( + 'next-day-delivery' => $ndd , + 'same-day-delivery' => $sdd , + 'free-shipping' => $freeSf + ), 'parent_id' => $parentId, 'minimum_order' => $minimumOrder, // 'variants' => array( diff --git a/header.php b/header.php index 846816c..71d2a17 100644 --- a/header.php +++ b/header.php @@ -386,13 +386,16 @@
Subtotal:
-
-
-
- -
+
+ +
+
-
+ +
+
+ + +
- - x +
Pages