From b706b410c3826cbaa341d70da9bf8bba5895dd0c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Minh=20V=C6=B0=C6=A1ng?= Date: Tue, 5 Dec 2023 14:43:38 +0700 Subject: [PATCH] Fix --- database/setup.sql | 2 +- src/main/webapp/assets/js/web/productHandler.js | 7 ++++++- src/main/webapp/view/web/checkout.jsp | 6 ------ 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/database/setup.sql b/database/setup.sql index f2a2c7c7..4cd074f3 100644 --- a/database/setup.sql +++ b/database/setup.sql @@ -90,7 +90,7 @@ CREATE TABLE `order` ( `payment` enum('cod','vnpay') NOT NULL COMMENT 'Lựa chọn phương thức thanh toán', `status` enum('processing','shipping','done','canceled') NOT NULL COMMENT 'Tình trạng đơn hàng', `create_at` datetime DEFAULT NULL, - `update_at` datetime DEFAULT NULL, + `update_at` datetime DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; -- -------------------------------------------------------- diff --git a/src/main/webapp/assets/js/web/productHandler.js b/src/main/webapp/assets/js/web/productHandler.js index d7e5fbd2..58e4d58c 100644 --- a/src/main/webapp/assets/js/web/productHandler.js +++ b/src/main/webapp/assets/js/web/productHandler.js @@ -55,7 +55,12 @@ function addToCart() { let cartCookie = getCartCookie(); if (cartCookie.hasOwnProperty(productID)) { - cartCookie[productID] += currentQuantity; + if (cartCookie[productID] + currentQuantity <= maxAmount) { + cartCookie[productID] += currentQuantity; + } + else { + cartCookie[productID] = maxAmount; + } } else { cartCookie[productID] = currentQuantity; } diff --git a/src/main/webapp/view/web/checkout.jsp b/src/main/webapp/view/web/checkout.jsp index 917c6c7a..648672f4 100644 --- a/src/main/webapp/view/web/checkout.jsp +++ b/src/main/webapp/view/web/checkout.jsp @@ -1,12 +1,6 @@ <%@ page contentType="text/html" pageEncoding="UTF-8" %> <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -<%@page import="io.hardingadonis.miu.model.Product"%> - -<%@page import="org.json.simple.JSONObject"%> -<%@page import="org.json.simple.parser.JSONParser"%> -<%@page import="org.json.simple.parser.ParseException"%> -