diff --git a/instance/app.db b/instance/app.db index 658026cda18b1026ae13d2ff7edef976e8e77d5c..daa0cc1a7bd4ab7fc7735ff015c0e1881f1dcead 100644 Binary files a/instance/app.db and b/instance/app.db differ diff --git a/shop/routes.py b/shop/routes.py index ad6f95d9893fbc7a51bcc0de34a69aab07c51404..e5ecb733226ff4d90d29dc41ad1dbcf44bb2d743 100644 --- a/shop/routes.py +++ b/shop/routes.py @@ -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():