Update app.py
Browse files
app.py
CHANGED
@@ -764,7 +764,7 @@ def add_suggestion_to_cart():
|
|
764 |
except Exception as e:
|
765 |
print(f"Error adding item to cart: {str(e)}")
|
766 |
return jsonify({"success": False, "error": str(e)})
|
767 |
-
|
768 |
@app.route('/cart/add', methods=['POST'])
|
769 |
def add_to_cart():
|
770 |
try:
|
@@ -785,15 +785,6 @@ def add_to_cart():
|
|
785 |
|
786 |
if not customer_email:
|
787 |
return jsonify({"success": False, "error": "User email is required."}), 400
|
788 |
-
|
789 |
-
# Ensure only one selection from spice level and oil/ghee preference
|
790 |
-
spice_level = data.get('spiceLevel')
|
791 |
-
oil_ghee_preference = data.get('oilGheePreference')
|
792 |
-
|
793 |
-
if not spice_level:
|
794 |
-
return jsonify({"success": False, "error": "Spice level is required."}), 400
|
795 |
-
if not oil_ghee_preference:
|
796 |
-
return jsonify({"success": False, "error": "Oil/Ghee preference is required."}), 400
|
797 |
|
798 |
# Query to check if the item is already in the cart
|
799 |
query = f"""
|
@@ -1164,6 +1155,12 @@ def order_summary():
|
|
1164 |
except Exception as e:
|
1165 |
print(f"Error fetching order details: {str(e)}")
|
1166 |
return render_template("order.html", order=None, error=str(e))
|
|
|
|
|
|
|
|
|
|
|
|
|
1167 |
|
1168 |
if __name__ == "__main__":
|
1169 |
app.run(debug=True, host="0.0.0.0", port=7860)
|
|
|
764 |
except Exception as e:
|
765 |
print(f"Error adding item to cart: {str(e)}")
|
766 |
return jsonify({"success": False, "error": str(e)})
|
767 |
+
|
768 |
@app.route('/cart/add', methods=['POST'])
|
769 |
def add_to_cart():
|
770 |
try:
|
|
|
785 |
|
786 |
if not customer_email:
|
787 |
return jsonify({"success": False, "error": "User email is required."}), 400
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
788 |
|
789 |
# Query to check if the item is already in the cart
|
790 |
query = f"""
|
|
|
1155 |
except Exception as e:
|
1156 |
print(f"Error fetching order details: {str(e)}")
|
1157 |
return render_template("order.html", order=None, error=str(e))
|
1158 |
+
import smtplib
|
1159 |
+
from email.mime.multipart import MIMEMultipart
|
1160 |
+
from email.mime.text import MIMEText
|
1161 |
+
|
1162 |
+
|
1163 |
+
|
1164 |
|
1165 |
if __name__ == "__main__":
|
1166 |
app.run(debug=True, host="0.0.0.0", port=7860)
|