Spaces:
Sleeping
Sleeping
Update templates/order_history.html
Browse files- templates/order_history.html +12 -6
templates/order_history.html
CHANGED
@@ -126,14 +126,19 @@
|
|
126 |
<script>
|
127 |
function addToCart(itemName) {
|
128 |
const button = document.getElementById(itemName); // Get the button element by its ID
|
129 |
-
let itemPrice = button.dataset.price; //
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
|
134 |
-
// Explicitly convert price to string if it's a number (important for concatenation)
|
135 |
-
let itemPriceStr = String(itemPrice); // Convert price to string after retrieving the value
|
136 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
137 |
if (!itemPriceStr || !itemImage || !itemName || !category || !section) {
|
138 |
alert('Missing required item data.');
|
139 |
return;
|
@@ -148,6 +153,7 @@
|
|
148 |
category: category,
|
149 |
section: section
|
150 |
};
|
|
|
151 |
|
152 |
fetch('/cart/add', {
|
153 |
method: 'POST',
|
|
|
126 |
<script>
|
127 |
function addToCart(itemName) {
|
128 |
const button = document.getElementById(itemName); // Get the button element by its ID
|
129 |
+
let itemPrice = button.dataset.price; // Get price from data-price attribute
|
130 |
+
const itemImage = button.dataset.image; // `const` is fine because it won't change
|
131 |
+
const category = button.dataset.category; // `const` is fine
|
132 |
+
const section = button.dataset.section; // `const` is fine
|
133 |
|
|
|
|
|
134 |
|
135 |
+
console.log(itemPrice)
|
136 |
+
console.log(itemImage)
|
137 |
+
console.log(category)
|
138 |
+
console.log(section)
|
139 |
+
// Explicitly convert price to string before concatenation
|
140 |
+
let itemPriceStr = String(itemPrice); // Convert price to string
|
141 |
+
console.log(itemPriceStr)
|
142 |
if (!itemPriceStr || !itemImage || !itemName || !category || !section) {
|
143 |
alert('Missing required item data.');
|
144 |
return;
|
|
|
153 |
category: category,
|
154 |
section: section
|
155 |
};
|
156 |
+
console.log(dataToSend)
|
157 |
|
158 |
fetch('/cart/add', {
|
159 |
method: 'POST',
|