Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -319,14 +319,16 @@ def update_quantity():
|
|
319 |
addons_price = 0
|
320 |
if addons_string and addons_string != "None":
|
321 |
try:
|
|
|
322 |
addons_price = sum(
|
323 |
-
|
|
|
324 |
)
|
325 |
except ValueError:
|
326 |
addons_price = 0 # Default to 0 if parsing fails
|
327 |
|
328 |
# Calculate the new price
|
329 |
-
new_price = (base_price
|
330 |
|
331 |
# Update the record in Salesforce
|
332 |
sf.Cart_Item__c.update(cart_item_id, {
|
|
|
319 |
addons_price = 0
|
320 |
if addons_string and addons_string != "None":
|
321 |
try:
|
322 |
+
# Extract prices from "Addon1 ($2.00); Addon2 ($3.50)"
|
323 |
addons_price = sum(
|
324 |
+
float(price.strip()) for price in addons_string.split("$")[1::2]
|
325 |
+
if price.strip().replace('.', '', 1).isdigit()
|
326 |
)
|
327 |
except ValueError:
|
328 |
addons_price = 0 # Default to 0 if parsing fails
|
329 |
|
330 |
# Calculate the new price
|
331 |
+
new_price = (base_price * quantity) + addons_price
|
332 |
|
333 |
# Update the record in Salesforce
|
334 |
sf.Cart_Item__c.update(cart_item_id, {
|