Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -171,7 +171,7 @@ def add_to_cart():
|
|
| 171 |
addons_string = "; ".join(addons_details)
|
| 172 |
|
| 173 |
# Calculate the total price (item price + add-ons)
|
| 174 |
-
total_price = item_price +
|
| 175 |
|
| 176 |
try:
|
| 177 |
# Save the cart item in Salesforce
|
|
@@ -297,7 +297,7 @@ def update_quantity():
|
|
| 297 |
addons_price = 0 # Default to 0 if parsing fails
|
| 298 |
|
| 299 |
# Calculate the new price
|
| 300 |
-
|
| 301 |
|
| 302 |
# Update the record in Salesforce
|
| 303 |
sf.Cart_Item__c.update(cart_item_id, {
|
|
@@ -331,7 +331,7 @@ def checkout():
|
|
| 331 |
return jsonify({"success": False, "message": "Cart is empty"})
|
| 332 |
|
| 333 |
# Calculate the total price of the order
|
| 334 |
-
total_price = sum(item['Price__c']
|
| 335 |
|
| 336 |
# Create the order in Salesforce
|
| 337 |
order_data = {
|
|
|
|
| 171 |
addons_string = "; ".join(addons_details)
|
| 172 |
|
| 173 |
# Calculate the total price (item price + add-ons)
|
| 174 |
+
total_price = (item_price * quantity) + sum(addon['price'] for addon in addons)
|
| 175 |
|
| 176 |
try:
|
| 177 |
# Save the cart item in Salesforce
|
|
|
|
| 297 |
addons_price = 0 # Default to 0 if parsing fails
|
| 298 |
|
| 299 |
# Calculate the new price
|
| 300 |
+
new_price = (base_price * quantity) + addons_price
|
| 301 |
|
| 302 |
# Update the record in Salesforce
|
| 303 |
sf.Cart_Item__c.update(cart_item_id, {
|
|
|
|
| 331 |
return jsonify({"success": False, "message": "Cart is empty"})
|
| 332 |
|
| 333 |
# Calculate the total price of the order
|
| 334 |
+
total_price = sum(item['Price__c'] for item in cart_items)
|
| 335 |
|
| 336 |
# Create the order in Salesforce
|
| 337 |
order_data = {
|