Shubham CS Project
Shubham CS Project
ROLL NO :
NAME : Vaibhav Pandey
CLASS : XII – A 1
SUBJECT : COMPUTER SCIENCE
SUB CODE : 083
PROJECT GUIDE :- Mr ANKIT PRABHAKAR PGT (CS)
SHRI MAHARPRABHU PUBLIC SCHOOL
SHRI MAHAPRABHU PUBLIC SCHOOL
CERTIFICATE
This is to certify that Master Shubham Vishwakarma Roll No: ***** has
successfully completed the project Work entitled “ONLINE SHOPPING SYSTEM”
in the subject Computer Science (083) laid down in the regulations of CBSE for
the purpose of Practical Examination in Class XII to be held in SHRI
MAHAPRABHU PUBLIC SCHOOL 2024. This report or identical report on this
topic has not been submitted for any other examination and does not form a
part of any other course undergone by the candidate.
(ANKIT PRABHAKAR)
PGT (Comp. Science)
Examiner Name:
Signature:
TABLE OF CONTENTS(TOC)
01 Acknowledgement
02 Introduction
03 Objectives of the
project
04 Source Code
05 Output
research and I came to know new things about it. Without their help,
making this project not only for marks but also to increase my
project.
ONLINE SHOPPING SYSTEM
INTRODUCTION :
The Online Shopping System is a simple project that allows users to browse
products, add items to their cart, and place orders. It provides basic features
like user signup, login, and managing purchases through a clear and easy-to-
use menu.
The system uses MySQL to store and manage data, ensuring everything runs
smoothly and reliably. With this project, users can create accounts, shop for
products, view their cart, and complete orders efficiently. It is a great example
of how to build a basic e-commerce application using Python and databases.
Objectives :
The main objectives of this project are:
1. User Management:
o Facilitate new user registration and secure authentication.
o Ensure user data integrity and uniqueness, especially for
usernames.
2. Product Browsing:
o Display an inventory of products with their details such as name,
price, and stock availability.
o Provide customers with easy access to available products.
3. Cart Management:
o Allow users to add desired products to a virtual cart.
o Validate product stock levels before addition to the cart.
o Enable users to view and modify their cart contents.
4. Order Placement:
o Allow customers to place orders based on their cart contents.
o Record order details, including total price, date, and status.
o Clear the cart upon successful order placement.
5. Database Setup and Maintenance:
o Automatically set up the necessary database schema, including
tables for users, products, orders, and carts.
o Prepopulate the database with sample product data for
demonstration purposes.
MODULES AND FUNCTIONS
MODULE
• mysql.connector
Provides the tools to connect to and interact with a MySQL database.
Functions
1. Database Connection
• sql.connect: Establishes a connection to the MySQL database.
2. Database Cursor
• con.cursor(): Creates a cursor object used to execute SQL queries.
• cursor.execute: Executes an SQL query using the cursor object.
• cursor.fetchone(): Fetches the first row of the query result.
• cursor.fetchall(): Fetches all rows of the query result.
3. Error Handling
• sql.Error: Captures and handles database-related errors.
4. General Application Functions
• create_connection: Establishes the database connection.
• setup_database: Creates the ONLINESHOP database and the necessary tables (users,
products, orders, cart), and inserts sample data into the products table.
• signup(con): Registers a new user by inserting their username and password into the
users table.
• login(con): Authenticates a user by checking their credentials against the users table
and returns the user_id if successful.
• browse_products(con): Fetches and displays all available products from the products
table.
• add_to_cart(con, user_id): Allows the user to add a product to their cart, checking
stock availability first.
• view_cart(con, user_id): Displays the products in the user's cart and calculates the
total price.
• place_order(con, user_id): Places an order based on the contents of the cart and
clears the cart after the order is placed.
1. Input/Output
o print: Outputs messages and information to the console.
o input: Accepts user input for various operations.
2. Control Flow
o while True: Creates a loop for the main menu and user sessions.
o break: Exits loops.
o exit(): Terminates the program in case of critical errors.
3. Database Transactions
o con.commit: Saves changes made by INSERT, UPDATE, or DELETE queries.
o con.close: Closes the database connection
FLOW OF PROJECT
SOURCE CODE
OUTPUT
HARDWARE AND SOFTWARE REQUIREMENTS
HARDWARE
• PERSONAL COMPUTER
• MOBILE PHONE
Software
• Python 3.10.2
• MySQL
• Python Connector
BIBLIOGRAPHY
• Books:-
• Websites:-
1. www.google.com
2. www.wikipedia.com
THANK YOU