From d89e15434d288a202b374a42810a5966d179b99f Mon Sep 17 00:00:00 2001
From: Michael Drury <mpdrury15@gmail.com>
Date: Tue, 9 May 2023 14:52:29 +0100
Subject: [PATCH] made all of the prices on the website look like actual prices
 and not just floats

---
 shop/templates/cart.html      | 6 +++---
 shop/templates/checkout.html  | 4 ++--
 shop/templates/item_page.html | 2 +-
 shop/templates/shopping.html  | 2 +-
 4 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/shop/templates/cart.html b/shop/templates/cart.html
index 3d7e103..367bed7 100644
--- a/shop/templates/cart.html
+++ b/shop/templates/cart.html
@@ -42,9 +42,9 @@
     {% endif %}
 
     {% if cart_size > 0: %}
-    <p class = "total_price">Total price: £{{ total_price }}</p>
+    <p class = "total_price">Total price: £{{ '{:,.2f}'.format(total_price) }}</p>
     <p class = "total_price">Shipping price: £{{ shipping_price }}</p>
-    <p class = "total_price">Final price: £{{ final_price }}</p>
+    <p class = "total_price">Final price: £{{ '{:,.2f}'.format(final_price) }}</p>
     {% endif %}
 
 
@@ -53,7 +53,7 @@
             <a href="/item?id={{item.product_id}}">
                 <img class = "item_cart_img" src = "{{ url_for('static', filename='images/' + item.product_image) }}" alt="background image"/></a>
             <p><a class = "item_cart_name" href="/item?id={{item.product_id}}"><b>{{ item.product_name }}</b></a></p>
-            <p>price: £{{ item.product_price }}</p>
+            <p>price: £{{ '{:,.2f}'.format(item.product_price) }}</p>
             <p>item id: {{ item.product_id }}</p>
         </div>
     {% endfor %}
diff --git a/shop/templates/checkout.html b/shop/templates/checkout.html
index 5b66821..5d74eb3 100644
--- a/shop/templates/checkout.html
+++ b/shop/templates/checkout.html
@@ -6,9 +6,9 @@
 
 <h1 class = "checkout_title">Checkout</h1>
 
-<p class = "checkout_price">Total to pay: £{{ total_price }}</p>
+<p class = "checkout_price">Total to pay: £{{ '{:,.2f}'.format(total_price) }}</p>
 <p class = "checkout_price">Shipping price: £{{ shipping_price }}</p>
-<p class = "checkout_price">Final price: £{{ final_price }}</p>
+<p class = "checkout_price">Final price: £{{ '{:,.2f}'.format(final_price) }}</p>
 
 
 <div class = "checkout_box">
diff --git a/shop/templates/item_page.html b/shop/templates/item_page.html
index a6e0454..3aab10c 100644
--- a/shop/templates/item_page.html
+++ b/shop/templates/item_page.html
@@ -24,7 +24,7 @@
         Information:
     </h1>
     <p class = "item_page_text">
-        Price: £{{ product.product_price }}
+        Price: £{{ '{:,.2f}'.format(product.product_price) }}
     </p>
     <p class = "item_page_text">
         Carbon footprint CO2 emissions: {{ product.product_footprint }}kg
diff --git a/shop/templates/shopping.html b/shop/templates/shopping.html
index 96d98e6..bad9acd 100644
--- a/shop/templates/shopping.html
+++ b/shop/templates/shopping.html
@@ -69,7 +69,7 @@
             <a href="/item?id={{item.product_id}}">
                 <img class = "item_shopping_img" src = "{{ url_for('static', filename='images/' + item.product_image) }}" alt="product image"/></a>
             <p><a class = "item_shopping_name" href="/item?id={{item.product_id}}"><b>{{ item.product_name }}</b></a></p>
-            <p class = "shopping_item_text">price: £{{ item.product_price }}</p>
+            <p class = "shopping_item_text">price: £{{ '{:,.2f}'.format(item.product_price) }}</p>
             <p class = "shopping_item_text">product type: {{ item.product_type }}</p>
             {% if current_user.is_authenticated %}
             <form method = "post">
-- 
GitLab