nagasurendra commited on
Commit
a40731c
·
verified ·
1 Parent(s): 2dca26a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -1
app.py CHANGED
@@ -153,8 +153,17 @@ def cart():
153
  cart_items = result.get("records", [])
154
  # Subtotal should be the sum of all item prices in the cart
155
  subtotal = sum(item['Price__c'] for item in cart_items)
 
 
 
 
 
 
 
 
 
156
 
157
- return render_template("cart.html", cart_items=cart_items, subtotal=subtotal, customer_email=email)
158
  except Exception as e:
159
  print(f"Error fetching cart items: {e}")
160
  return render_template("cart.html", cart_items=[], subtotal=0)
 
153
  cart_items = result.get("records", [])
154
  # Subtotal should be the sum of all item prices in the cart
155
  subtotal = sum(item['Price__c'] for item in cart_items)
156
+ customer_result = sf.query(f"""
157
+ SELECT Reward_Points__c
158
+ FROM Customer_Login__c
159
+ WHERE Email__c = '{email}'
160
+ """)
161
+
162
+ # Extract the reward points (default to 0 if not found)
163
+ reward_points = customer_result['records'][0].get('Reward_Points__c', 0) if customer_result['records'] else 0
164
+ return render_template("cart.html", cart_items=cart_items, subtotal=subtotal, reward_points=reward_points, customer_email=email)
165
 
166
+
167
  except Exception as e:
168
  print(f"Error fetching cart items: {e}")
169
  return render_template("cart.html", cart_items=[], subtotal=0)