Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
CM1102 shop
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Michael Drury
CM1102 shop
Commits
1e45e233
Commit
1e45e233
authored
2 years ago
by
Michael Drury
Browse files
Options
Downloads
Patches
Plain Diff
added more comments
parent
3c5711bd
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
instance/app.db
+0
-0
0 additions, 0 deletions
instance/app.db
shop/routes.py
+10
-3
10 additions, 3 deletions
shop/routes.py
with
10 additions
and
3 deletions
instance/app.db
+
0
−
0
View file @
1e45e233
No preview for this file type
This diff is collapsed.
Click to expand it.
shop/routes.py
+
10
−
3
View file @
1e45e233
...
...
@@ -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
():
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment