luigicorreia / supershop

An example shop developed in vanilla PHP.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Super Shop

An example shop developed in vanilla PHP.

Initial page developed using only HTML and CSS:

  • Created folder for images
  • Created folder for css
  • Added css/style.css
  • Added images/products/1.png
  • Added images/site/logo.svg
  • Added index.php

Organize the HTML code into separate template files:

  • Created folder templates/common
  • Created folder templates/category
  • Created folder templates/product
  • Added templates/common/header.php
  • Added templates/category/list_categories.php
  • Added templates/product/list_products.php
  • Added templates/common/footer.php
  • Moved code from index.php to new files

Created the database:

  • Created folder database
  • Added database/connection.php
  • Added database/shop.sql
  • Generated database/shop.db using sqlite3
  • Added images for 3 more products in images/products
  • Included database/connection.php in index.php

Categories are now listed from the database:

  • Added database/category.php
  • Used getAllCategories in index.php
  • Updated templates/category/list_categories.php

Products are now listed from the database:

  • Added database/product.php
  • Used getAllProducts in index.php
  • Updated templates/product/list_products.php

Started session:

  • Created folder includes
  • Added includes/init.php
  • Added includes/session.php
  • Pages now include includes/init.php instead of database/connection.php

Added shopping cart:

  • Added action_add_to_cart.php
  • Created getCartSize and addToCart in includes/session.php
  • Used getCartSize in templates/common/header.php
  • Created getCartProducts in database/product.php
  • Added list_cart.php
  • Added templates/product/list_cart.php

Added login and logout:

  • Added user table in database/shop.sql
  • Regenerated database/shop.db
  • Added database/user.php
  • Created setCurrentUser in includes/session.php
  • Added templates/common/user.php
  • Included templates/common/user.php in templates/common/header.php
  • Added action_login.php
  • Added action_logout.php

Added error and success messages:

  • Added messages section to templates/common/header.php
  • Added getErrorMessages, getSuccessMessages and clearMessages to includes/session.php
  • Added messages in action_login.php, action_logout.php and action_add_to_cart.php

About

An example shop developed in vanilla PHP.


Languages

Language:PHP 65.2%Language:CSS 34.8%