Rammohan0504 commited on
Commit
d3ea1df
·
verified ·
1 Parent(s): 35ffe93

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -5
app.py CHANGED
@@ -1114,14 +1114,14 @@ def add_to_cart():
1114
  return jsonify({"success": False, "error": "Item name and price are required."}), 400
1115
 
1116
  try:
 
 
 
1117
  email = session.get('user_email') # Ensure user is logged in
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)
1127
 
@@ -1134,7 +1134,7 @@ def add_to_cart():
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,
 
1114
  return jsonify({"success": False, "error": "Item name and price are required."}), 400
1115
 
1116
  try:
1117
+ # Ensure price is treated as a string
1118
+ item_price = str(item_price) # Convert to string if it's not already
1119
+
1120
  email = session.get('user_email') # Ensure user is logged in
1121
  if not email:
1122
  return jsonify({"success": False, "error": "User not logged in."}), 401
1123
 
1124
+ # Fetch item details (price, image, etc.) from Salesforce or your database
 
 
 
1125
  item_query = f"SELECT Name, Price__c, Image1__c FROM Menu_Item__c WHERE Name = '{item_name}'"
1126
  result = sf.query(item_query)
1127
 
 
1134
  # Add the item to the user's cart
1135
  cart_item = {
1136
  'Name': item_name,
1137
+ 'Price__c': item_price, # Ensure the price is passed as a string
1138
  'Base_Price__c': item_price,
1139
  'Quantity__c': 1,
1140
  'Image1__c': item_image,