diff --git a/FLASK PROJECTS/E-commerce/app.py b/FLASK PROJECTS/E-commerce/app.py index 53f5b508..f4b3a878 100644 --- a/FLASK PROJECTS/E-commerce/app.py +++ b/FLASK PROJECTS/E-commerce/app.py @@ -25,7 +25,7 @@ Session(app) # Configure CS50 Library to use SQLite database -db = SQL("sqlite:///library.db") +db = SQL("sqlite:///shop.db") @app.after_request @@ -370,4 +370,10 @@ def cart(): return render_template("cart.html", rows=rows) +# payment methods +@app.route("/productdetails/", methods=["GET", "POST"]) +def methods(id): + """ methods for payment""" + + diff --git a/FLASK PROJECTS/E-commerce/flask.png b/FLASK PROJECTS/E-commerce/flask.png new file mode 100644 index 00000000..d4bbc6e2 Binary files /dev/null and b/FLASK PROJECTS/E-commerce/flask.png differ diff --git a/FLASK PROJECTS/E-commerce/readme.md b/FLASK PROJECTS/E-commerce/readme.md new file mode 100644 index 00000000..9bb9ecf8 --- /dev/null +++ b/FLASK PROJECTS/E-commerce/readme.md @@ -0,0 +1,27 @@ +# Shop +

+ alt text +

+ +--- +## Description +Hi, this my attempt to build a script for an e-commerce web app using Flask. +### Templates: + +* The index template serves as the catalog for the shop's products. +* Cart template deal with user's transactions +* Payment template +* The products template displays all products . + +### other files: + +* Database. +* helpers-- functions that help. +* App-- main script + + + +![github](https://img.shields.io/badge/github-000000?style=for-the-badge&logo=github&logoColor=white)](https://github.com/tarenjk24) + + +--- \ No newline at end of file diff --git a/FLASK PROJECTS/E-commerce/requirements.txt b/FLASK PROJECTS/E-commerce/requirements.txt new file mode 100644 index 00000000..1e9cc3dc --- /dev/null +++ b/FLASK PROJECTS/E-commerce/requirements.txt @@ -0,0 +1,4 @@ + +Flask +Flask-Session +requests \ No newline at end of file diff --git a/FLASK PROJECTS/E-commerce/shop.db b/FLASK PROJECTS/E-commerce/shop.db new file mode 100644 index 00000000..1b1279b4 Binary files /dev/null and b/FLASK PROJECTS/E-commerce/shop.db differ diff --git a/FLASK PROJECTS/E-commerce/templates/apology.html b/FLASK PROJECTS/E-commerce/templates/apology.html new file mode 100644 index 00000000..a414a390 --- /dev/null +++ b/FLASK PROJECTS/E-commerce/templates/apology.html @@ -0,0 +1,10 @@ +{% extends "layout.html" %} + +{% block title %} + Apology +{% endblock %} + +{% block main %} + + {{ top }} +{% endblock %} diff --git a/FLASK PROJECTS/E-commerce/templates/cart.html b/FLASK PROJECTS/E-commerce/templates/cart.html new file mode 100644 index 00000000..5bcd681b --- /dev/null +++ b/FLASK PROJECTS/E-commerce/templates/cart.html @@ -0,0 +1,46 @@ +{% extends "layout.html" %} + +{% block title %} + Cart +{% endblock %} +{% block main %} + + + + + +
+
+
+
+ +

Your Cart

+ + + + + + + + + + + + {% for row in rows %} + + + + + + {% endfor %} + +
CoverProduct NameQuantityPrice
+ {{ row.title }} + {{ row.name }}{{ row.quantity }}{{ row.price }}
+ + Check Out + Back to Catalog +
+
+
+{% endblock %} diff --git a/FLASK PROJECTS/E-commerce/templates/checkout.html b/FLASK PROJECTS/E-commerce/templates/checkout.html new file mode 100644 index 00000000..b7f3d350 --- /dev/null +++ b/FLASK PROJECTS/E-commerce/templates/checkout.html @@ -0,0 +1,57 @@ +{% extends "layout.html" %} + +{% block title %} + Check Out +{% endblock %} + +{% block main %} + + + + +
+
+ +
+ + +
Check Out
+ + + + + + + + + + + + + + + + + + + + + + + + + + +    + + + +
+
+
+
+{% endblock %} diff --git a/FLASK PROJECTS/E-commerce/templates/index.html b/FLASK PROJECTS/E-commerce/templates/index.html index e69de29b..3a517b55 100644 --- a/FLASK PROJECTS/E-commerce/templates/index.html +++ b/FLASK PROJECTS/E-commerce/templates/index.html @@ -0,0 +1,51 @@ +{% extends "layout.html" %} + +{% block title %} + Index +{% endblock %} + +{% block main %} + + + + +
+ +
Featured Products
+ + + + +
+
+
    + + + + + + + + {% for product in products %} +
  • +
    + + {{ product.name }} +
    + {{ product.category }} +
    {{ product.name }}
    +

    {{ product.price }}

    + details +
    +
    +
  • + {% endfor %} +
+
+
+
+{% endblock %} diff --git a/FLASK PROJECTS/E-commerce/templates/layout.html b/FLASK PROJECTS/E-commerce/templates/layout.html new file mode 100644 index 00000000..51aac114 --- /dev/null +++ b/FLASK PROJECTS/E-commerce/templates/layout.html @@ -0,0 +1,96 @@ + + + + + + + + + + + + + shop {% block title %}{% endblock %} + + + + + {% if get_flashed_messages() %} + + + {% endif %} + + +
+ + +
+ + +
+ {% if request.path == '/' %} + +
+ + + + + {% endif %} + + +
{% block main %}{% endblock %}
+ + +
+ + + +
+ + diff --git a/FLASK PROJECTS/E-commerce/templates/login.html b/FLASK PROJECTS/E-commerce/templates/login.html new file mode 100644 index 00000000..0828b901 --- /dev/null +++ b/FLASK PROJECTS/E-commerce/templates/login.html @@ -0,0 +1,44 @@ +{% extends "layout.html" %} + +{% block title %} + Log In +{% endblock %} + +{% block main %} + + + + +
+
+
+ +
Sign in
+ + + + + + + + + + + + + + + + + + +
+
+
+
+{% endblock %} + diff --git a/FLASK PROJECTS/E-commerce/templates/payment.html b/FLASK PROJECTS/E-commerce/templates/payment.html new file mode 100644 index 00000000..66172d1f --- /dev/null +++ b/FLASK PROJECTS/E-commerce/templates/payment.html @@ -0,0 +1,38 @@ +{% extends "layout.html" %} + +{% block title %} + Payment +{% endblock %} + +{% block main %} + + + + +
+
+ +
+
+ + + + +
Select a Payment Method:
+ + + + + + + + +
+ +
+
+{% endblock %} diff --git a/FLASK PROJECTS/E-commerce/templates/productdetails.html b/FLASK PROJECTS/E-commerce/templates/productdetails.html new file mode 100644 index 00000000..0e9863e8 --- /dev/null +++ b/FLASK PROJECTS/E-commerce/templates/productdetails.html @@ -0,0 +1,74 @@ +{% extends "layout.html" %} + +{% block title %} + productdetails +{% endblock %} + +{% block main %} + + + + + +
+
+
+ {% for detail in details %} + + +

{{ detail.name }}

+ + + + + + +
+ +
+ {{ detail.title }} +
+ +
+

Details:

+
{{ detail.description }}
+

Price:

{{ detail.price|usd }}
+ {% if session["user_id"] %} + +
+

Quantity:

+
+
+ + + + + + + + + Check Out + {% else %} +

Click here to log in and add the product to your cart. + *

+ {% endif %} + {% endfor %} + +
+ +
+ +
+
+ +
+ + +
+
+
+{% endblock %} diff --git a/FLASK PROJECTS/E-commerce/templates/profile.html b/FLASK PROJECTS/E-commerce/templates/profile.html new file mode 100644 index 00000000..c8ac8428 --- /dev/null +++ b/FLASK PROJECTS/E-commerce/templates/profile.html @@ -0,0 +1,89 @@ +{% extends "layout.html" %} + +{% block title %} + Profile +{% endblock %} + +{% block main %} + + + + +
+
+
+
+

Personal Information

+ +

Username: {{ user_data["username"] }}

+ + + + + + + + + + + + + + {% if not orders %} + + + + {% else %} + + {% for order in orders %} + + + + + + + {% endfor %} + {% endif %} + +
addresscitypostal codephone number
No information available.
{{ order.address }}{{ order.city }}{{ order.postal_code }}{{ order.phone_number }}
+ +
+
+

Your Order History

+ + + + + + + + + + + + {% if not orders %} + + + + {% else %} + + {% for order in orders %} + + + + {% endfor %} + + + + {% endif %} + +
Order NumberOrder DateTotal Amount
No order history available.
{{ order.id }}{{ order.history }}{{ total_amount|usd }}
+ +

Remove Account

+

Check cart

+
+
+
+
+ +{% endblock %} diff --git a/FLASK PROJECTS/E-commerce/templates/register.html b/FLASK PROJECTS/E-commerce/templates/register.html new file mode 100644 index 00000000..43251030 --- /dev/null +++ b/FLASK PROJECTS/E-commerce/templates/register.html @@ -0,0 +1,43 @@ +{% extends "layout.html" %} + +{% block title %} + register +{% endblock %} + +{% block main %} + + + + +
+
+
+ +
Sign up
+ + + + + + + + + + + + + + + + + + + + + + + + +
+
+{% endblock %} diff --git a/README.md b/README.md index dea7b86d..8505b537 100644 --- a/README.md +++ b/README.md @@ -122,4 +122,6 @@ guide [HERE](https://github.com/larymak/Python-project-Scripts/blob/main/CONTRIB | 73 | [Logging Helper](https://github.com/larymak/Python-project-Scripts/tree/main/OTHERS/add-multiprocessing-logger) | [Jerry W.](https://github.com/Jerry0420) | | 74 | [Notepad](https://github.com/larymak/Python-project-Scripts/tree/main/PYTHON%20APPS/Notepad) | [Annarhysa Albert](https://github.com/Annarhysa) | | 75 | [Quadratic Equation Solver](https://github.com/larymak/Python-project-Scripts/tree/main/GUI/Quadratic-Equation-Solver) | [Akinfenwa Ezekiel](https://github.com/Ezek-iel) | -| 76 | [Internet Connectivity Monitor](https://github.com/larymak/Python-project-Scripts/tree/main/AUTOMATION/InternetConnectivityMonitor) | [Prince Khunt](https://github.com/princekhunt) | \ No newline at end of file +| 76 | [Internet Connectivity Monitor](https://github.com/larymak/Python-project-Scripts/tree/main/AUTOMATION/InternetConnectivityMonitor) | [Prince Khunt](https://github.com/princekhunt) | +| 76 | [E-commerce](https://github.com/larymak/Python-project-Scripts/tree/main/FLASK%20PROJECTS/E-commerce) | [Eter Nada](https://github.com/tarenjk24) | +