Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -136,7 +136,7 @@ def cart():
|
|
136 |
try:
|
137 |
# Query cart items
|
138 |
result = sf.query(f"""
|
139 |
-
SELECT Name, Price__c, Quantity__c, Add_Ons__c, Image1__c
|
140 |
FROM Cart_Item__c
|
141 |
WHERE Customer_Email__c = '{email}'
|
142 |
""")
|
@@ -144,12 +144,12 @@ def cart():
|
|
144 |
# Subtotal should be the sum of all item prices in the cart
|
145 |
subtotal = sum(item['Price__c'] for item in cart_items)
|
146 |
|
147 |
-
|
148 |
return render_template("cart.html", cart_items=cart_items, subtotal=subtotal, customer_email=email)
|
149 |
except Exception as e:
|
150 |
print(f"Error fetching cart items: {e}")
|
151 |
return render_template("cart.html", cart_items=[], subtotal=0)
|
152 |
|
|
|
153 |
@app.route('/cart/add', methods=['POST'])
|
154 |
def add_to_cart():
|
155 |
data = request.json # Extract JSON payload from frontend
|
|
|
136 |
try:
|
137 |
# Query cart items
|
138 |
result = sf.query(f"""
|
139 |
+
SELECT Name, Price__c, Quantity__c, Add_Ons__c, Add_Ons_Price__c, Image1__c, Instructions__c
|
140 |
FROM Cart_Item__c
|
141 |
WHERE Customer_Email__c = '{email}'
|
142 |
""")
|
|
|
144 |
# Subtotal should be the sum of all item prices in the cart
|
145 |
subtotal = sum(item['Price__c'] for item in cart_items)
|
146 |
|
|
|
147 |
return render_template("cart.html", cart_items=cart_items, subtotal=subtotal, customer_email=email)
|
148 |
except Exception as e:
|
149 |
print(f"Error fetching cart items: {e}")
|
150 |
return render_template("cart.html", cart_items=[], subtotal=0)
|
151 |
|
152 |
+
|
153 |
@app.route('/cart/add', methods=['POST'])
|
154 |
def add_to_cart():
|
155 |
data = request.json # Extract JSON payload from frontend
|