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

made alot better making it adjust with screen size

parent 05a7a977
No related branches found
No related tags found
No related merge requests found
No preview for this file type
......@@ -126,10 +126,20 @@ def cart():
for c in db.session.query(User).filter_by(id=current_user.get_id()):
c.cart = ''
db.session.commit()
return redirect(url_for('cart'))
total_price = get_total_cart_price()
return render_template('cart.html', cart_list = cart_list, cart_size = len(cart_list), total_price = total_price, remove_form = remove_form)
free_shipping = False
shipping_price = 4.99
if total_price >= 2000:
free_shipping = True
if free_shipping:
shipping_price = 0
final_price = shipping_price + total_price
return render_template('cart.html', cart_list = cart_list, cart_size = len(cart_list), total_price = total_price,
remove_form = remove_form, shipping_price = shipping_price ,final_price = final_price)
@app.route('/wishlist', methods=['GET', 'POST'])
......@@ -208,7 +218,15 @@ def checkout():
# gets the total price of items using the get_total_price function
total_price = get_total_cart_price()
return render_template('checkout.html', total_price = total_price, form = form)
free_shipping = False
shipping_price = 4.99
if total_price >= 2000:
free_shipping = True
if free_shipping:
shipping_price = 0
final_price = shipping_price + total_price
return render_template('checkout.html', total_price = total_price, form = form, shipping_price = shipping_price ,final_price = final_price)
def get_total_cart_price():
......
......@@ -438,15 +438,16 @@ li {
}
.home_block {
padding-top: 10px;
padding-bottom: 10px;
padding-bottom: 20px;
position: relative;
}
.home_block_text {
top: 33%;
left: 50%;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
text-align: center;
}
.start_shopping_text {
......@@ -519,7 +520,7 @@ li {
.header {
background-color: #202020;
margin:0px;
margin: 0px;
text-align: center;
height: 80px;
}
......@@ -527,3 +528,13 @@ li {
.header_img {
height: 90%;
}
.discount_div {
background-color: lightgrey;
height: 50px;
font-size: 2vw;
display: flex;
justify-content: center;
align-items: center;
font-family: Andale Mono, monospace;
}
\ No newline at end of file
......@@ -42,9 +42,12 @@
{% endif %}
{% if cart_size > 0: %}
<p class = "total_price">Total price: £{{ total_price }}</p>
<p class = "total_price">Total price: £{{ total_price }}</p>
<p class = "total_price">Shipping price: £{{ shipping_price }}</p>
<p class = "total_price">Final price: £{{ final_price }}</p>
{% endif %}
{% for item in cart_list %}
<div class = "cart_box" >
<a href="/item?id={{item.product_id}}">
......
......@@ -7,6 +7,8 @@
<h1 class = "checkout_title">Checkout</h1>
<p class = "checkout_price">Total to pay: £{{ total_price }}</p>
<p class = "checkout_price">Shipping price: £{{ shipping_price }}</p>
<p class = "checkout_price">Final price: £{{ final_price }}</p>
<div class = "checkout_box">
......
......@@ -17,6 +17,9 @@
<p class = "slogan"><i>Ride with confidence, ride with quality parts</i></p>
<div class = "discount_div">
<p>Free shipping on all orders over £2000!</p>
</div>
<div class = "home_block">
<img class = "home_backround_image" src = "{{ url_for('static', filename='images/home_image1.jpg') }}" alt="backround image" style="width:100%;">
<div class = "home_block_text">
......@@ -25,6 +28,7 @@
</a>
</div>
</div>
<div class = "home_block">
<img class = "home_backround_image" src = "{{ url_for('static', filename='images/home_image2.jpg') }}" alt="backround image" style="width:100%;">
</div>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment