diff --git a/assets/js/tester11.js b/assets/js/tester11.js
index 883c291..0b407da 100644
--- a/assets/js/tester11.js
+++ b/assets/js/tester11.js
@@ -689,6 +689,7 @@ function popupAddToCart(
var cartList = document.querySelector(".eccart-pro-items");
var newOrder = document.createElement("li");
+ newOrder.className = "rowcart";
newOrder.id = `order_${response._id}`;
var imageUrl = response.items[0].product.product_image
? response.items[0].product.product_image.split(",")[0].trim()
@@ -696,6 +697,7 @@ function popupAddToCart(
console.log(response);
newOrder.innerHTML = `
+
@@ -709,10 +711,10 @@ function popupAddToCart(
diff --git a/catalog-single-vendor.php b/catalog-single-vendor.php
index fe0a7b0..88b4844 100644
--- a/catalog-single-vendor.php
+++ b/catalog-single-vendor.php
@@ -133,21 +133,35 @@ if (!empty($_GET['minPrice']) || !empty($_GET['maxPrice']) || !empty($_GET['cate
"") {
$product = getProduct($order['items'][0]['product']['product_id']);
$product_data = json_decode($product, true);
?>
- -
+
-
+
"") {
-
-
"") {
-
+
@@ -522,7 +537,43 @@ if ($_SESSION["userId"] <> "") {
}
let myLatestOrders = [];
+ var checkboxes = document.querySelectorAll('input[name="cart-item[]"]');
+ checkboxes.forEach(function(checkbox) {
+ checkbox.addEventListener('change', function() {
+ getCheckedCheckboxes();
+ getLatestOrders();
+ // update_Total()
+ });
+ });
+ function getCheckedCheckboxes() {
+ var checkboxes = document.querySelectorAll('input[name="cart-item[]"]:checked');
+ var values = [];
+ checkboxes.forEach(function(checkbox) {
+ values.push(checkbox.value.toLowerCase().trim());
+ });
+ console.log(values);
+ return values;
+ }
+ function update_Total(){
+
+ console.log(orderData);
+ var checkedCategories = getCheckedCheckboxes();
+ if (orderData && orderData !== "") {
+ // Calculate the new total amount based on the updated quantities
+ const orderInitial= null
+ if(checkedCategories?.length>0){
+ orderInitial = orderData?.filter(order => checkedCategories?.includes(order._id));
+
+ }else{
+ orderInitial = orderData
+ }
+ let newTotalAmount = orderData.items.reduce((total, item) => {
+ return total + (item.quantity * item.price);
+ }, 0);
+ console.log(response);
+ }
+ }
function handleQtyInput(input, orderId, itemId, isFloat) {
login(email, password, function(token) {
var newQuantity = parseInt(input.value);
@@ -717,7 +768,18 @@ if ($_SESSION["userId"] <> "") {
if (orderData && orderData !== "") {
console.log(orderData)
const filteredOrders = orderData.filter(order => order.status.toUpperCase() === 'CART');
- const totalAmountSum = filteredOrders.reduce((sum, order) => {
+ var checkedCategories = getCheckedCheckboxes();
+ let orderInitial= null;
+ if (filteredOrders && filteredOrders !== "") {
+ // Calculate the new total amount based on the updated quantities
+ if(checkedCategories?.length>0){
+ orderInitial = filteredOrders?.filter(order => checkedCategories?.includes(order._id));
+
+ }else{
+ orderInitial = filteredOrders
+ }
+ }
+ const totalAmountSum = orderInitial.reduce((sum, order) => {
const totalAmount = parseFloat(order.total_amount);
return sum + totalAmount;
}, 0);
@@ -752,9 +814,12 @@ if ($_SESSION["userId"] <> "") {
function handleCheckoutButton(event) {
event.preventDefault();
+ var checkedCategories = getCheckedCheckboxes();
+
+ const selectedIdString = checkedCategories.join('-');
login(email, password, function(token) {
- window.location.href = "checkouttest.php";
+ window.location.href = `checkouttest.php?selected=${selectedIdString}`;
});
}
diff --git a/next_day_delivery.php b/next_day_delivery.php
index 131a575..fccdf26 100644
--- a/next_day_delivery.php
+++ b/next_day_delivery.php
@@ -336,6 +336,8 @@ function loadProducts(page,isFilter) {
let img = document.createElement("img");
img.setAttribute("style", "width: 290px; height: 200px; object-fit: cover;");
img.setAttribute("class", "main-image");
+ img.setAttribute("loading", "lazy");
+
img.setAttribute("src", firstImageUrl);
img.setAttribute("alt", "Product");
img.className = "main-image";
@@ -344,7 +346,7 @@ function loadProducts(page,isFilter) {
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");
diff --git a/shop-list-left-sidebar.php b/shop-list-left-sidebar.php
index 57433f6..22ef2f7 100644
--- a/shop-list-left-sidebar.php
+++ b/shop-list-left-sidebar.php
@@ -516,13 +516,16 @@ function loadProducts(page,isFilter) {
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", "border: 1px solid #eeeeee; height: 330px; object-fit: cover;");
+ 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");
@@ -564,7 +567,7 @@ function loadProducts(page,isFilter) {
`₱${product?.regular_price}`: 'inquire'
}
- ${vendor.user_login}
+ ${vendor.user_login}
`;
diff --git a/user-history.php b/user-history.php
index fef88a8..28f793f 100644
--- a/user-history.php
+++ b/user-history.php
@@ -361,7 +361,22 @@ if ($_SESSION["isVendor"] == true) {
$jsonorder = json_encode($order);
?>
- |
+
+
+
+
+ " alt="product">
+
+ |
|
|
|
@@ -436,7 +451,22 @@ if ($_SESSION["isVendor"] == true) {
$jsonorder = json_encode($order);
?>
- |
+
+
+
+
+ " alt="product">
+
+ |
|
|
|
@@ -507,7 +537,22 @@ if ($_SESSION["isVendor"] == true) {
$jsonorder = json_encode($order);
?>
- |
+
+
+
+
+ " alt="product">
+
+ |
|
|
|
@@ -578,7 +623,20 @@ if ($_SESSION["isVendor"] == true) {
?>
-
+
+
+
+ " alt="product">
+
|
|
|
@@ -642,7 +700,7 @@ if ($_SESSION["isVendor"] == true) {
$orders = getOrderbyCustomerId($customer['_id']);
$totalAmount = 0;
$orderExist = false;
- if ($orders) {
+ if ($orders) {
$order_data = json_decode($orders, true);
$_SESSION['cart_items'] = $order_data;
foreach ($order_data as $order) {
@@ -656,8 +714,24 @@ if ($_SESSION["isVendor"] == true) {
$jsonorder = json_encode($order);
?>
- |
- |
+
+
+
+
+ " alt="product">
+
+
+ |
+ |
|
|
|
diff --git a/vendor-all-product-list.php b/vendor-all-product-list.php
index 147174b..f6d9c27 100644
--- a/vendor-all-product-list.php
+++ b/vendor-all-product-list.php
@@ -70,7 +70,9 @@ $products = productList();
-
+
+
+