Skip to content
Snippets Groups Projects
Commit 1e45e233 authored by Michael Drury's avatar Michael Drury
Browse files

added more comments

parent 3c5711bd
No related branches found
No related tags found
No related merge requests found
No preview for this file type
......@@ -151,6 +151,7 @@ def cart():
# gets the total price of the cart and then decides on if the user is allowed free shipping and if not adds
# shipping cost to the final price
# repeated in checkout as need some of the variables created in the code to pass into template
total_price = get_total_cart_price()
......@@ -197,6 +198,7 @@ def wishlist():
c.wishlist = ''
db.session.commit()
return redirect(url_for('wishlist'))
return render_template('wishlist.html', wishlist_list = wishlist_list, wishlist_size = len(wishlist_list), remove_form = remove_form)
......@@ -224,10 +226,11 @@ def item_page():
review_form = reviewForm()
# adds the review to the reviews database as well as the authors id
if review_form.validate_on_submit():
review_in = review_form.review.data
for c in db.session.query(User).filter_by(id=current_user.get_id()):
current_user_username = c.username
current_user_username = current_user.username
review_table.new_review(review_in=review_in, product_id_in=product_in.product_id, author_in = current_user_username)
reviews = review_table.query.filter_by(product_id=product_in.product_id)
......@@ -252,6 +255,10 @@ def checkout():
# gets the total price of items using the get_total_price function
total_price = get_total_cart_price()
# gets the total price of the cart and then decides on if the user is allowed free shipping and if not adds
# shipping cost to the final price
# repeated in cart as need some of the variables created in the code to pass into template
free_shipping = False
shipping_price = 14.99
if total_price >= 2000:
......@@ -279,7 +286,7 @@ def get_total_cart_price():
total_price += item.product_price
return total_price
# just takes you to the thank you page
@app.route('/thank_you', methods=['GET', 'POST'])
@login_required
def thank_you():
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment