Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1118,6 +1118,9 @@ def add_to_cart():
|
|
1118 |
if not email:
|
1119 |
return jsonify({"success": False, "error": "User not logged in."}), 401
|
1120 |
|
|
|
|
|
|
|
1121 |
# Fetch item details (price, image, etc.) from Salesforce or your database if needed
|
1122 |
item_query = f"SELECT Name, Price__c, Image1__c FROM Menu_Item__c WHERE Name = '{item_name}'"
|
1123 |
result = sf.query(item_query)
|
@@ -1131,7 +1134,7 @@ def add_to_cart():
|
|
1131 |
# Add the item to the user's cart
|
1132 |
cart_item = {
|
1133 |
'Name': item_name,
|
1134 |
-
'Price__c': item_price,
|
1135 |
'Base_Price__c': item_price,
|
1136 |
'Quantity__c': 1,
|
1137 |
'Image1__c': item_image,
|
@@ -1147,6 +1150,7 @@ def add_to_cart():
|
|
1147 |
except Exception as e:
|
1148 |
return jsonify({"success": False, "error": str(e)}), 500
|
1149 |
|
|
|
1150 |
@app.route("/order", methods=["GET"])
|
1151 |
def order_summary():
|
1152 |
email = session.get('user_email') # Fetch logged-in user's email
|
|
|
1118 |
if not email:
|
1119 |
return jsonify({"success": False, "error": "User not logged in."}), 401
|
1120 |
|
1121 |
+
# Convert item_price to string if it isn't already
|
1122 |
+
item_price = str(item_price)
|
1123 |
+
|
1124 |
# Fetch item details (price, image, etc.) from Salesforce or your database if needed
|
1125 |
item_query = f"SELECT Name, Price__c, Image1__c FROM Menu_Item__c WHERE Name = '{item_name}'"
|
1126 |
result = sf.query(item_query)
|
|
|
1134 |
# Add the item to the user's cart
|
1135 |
cart_item = {
|
1136 |
'Name': item_name,
|
1137 |
+
'Price__c': item_price, # Ensure this is treated as a string
|
1138 |
'Base_Price__c': item_price,
|
1139 |
'Quantity__c': 1,
|
1140 |
'Image1__c': item_image,
|
|
|
1150 |
except Exception as e:
|
1151 |
return jsonify({"success": False, "error": str(e)}), 500
|
1152 |
|
1153 |
+
|
1154 |
@app.route("/order", methods=["GET"])
|
1155 |
def order_summary():
|
1156 |
email = session.get('user_email') # Fetch logged-in user's email
|