PPPPPPP
PPPPPPP
PPPPPPP
EDUCATION
PROJECT REPORT
ON
“Online Shopping System”
BY
Pawan Mohite
Nakul Sharma
Shrawan Bora
Saket Ambede
Certificate
This is to certify that Mr.Pawan Mohite , Nakul Sharma, Shrawan Bora,
Saket Ambede from TSSM’s Bhivarabai Sawant College of Engineering and Research,
Polytechnic, Narhe, Pune having Enrollment number2116060067 has completed Project
Planning Report having title “Online Shopping System” in group consisting of 4
Candidates under the guidance of the faculty Guide Prof. Sahajrao P.S.
TABLE OF CONTENTS
ABSTRACT i
LIST OF FIGURE ii
LIST OF TABLES iv
ACKNOWLEDGEMENT v
1. INTRODUCTION PAGE
1.1 PROJECT OBJECTIVES 1
1.2 PROJECT OVER VIEW 2
1.3 PROJECT SCOPE 2
1.4 STUDY OF SYSTEMS 3
1.4.1 MODULES 3
1.4.1.1 ADMIN 3
1.4.1.2 MODERATOR 11
1.4.1.3 USER 12
2. SYSTEM ANALYSIS 15
2.1 EXISTING SYSTEM 15
2.2 PROPOSED SYSTEM 16
2.3 SYSTEM REQUIREMENT SPECIFICATION 16
2.3.1 GENERAL DESCRIPTION 16
Online Shopping System
2.3.2 SYSTEM OBJECTIVES 17
2.3.3 SYSTEM REQUIREMENTS 17
2.3.3.1 NON FUNCTIONAL REQUIREMENT 18
2.3.3.2 FUNCTIONAL REQUIREMENT 19
3. SYSTEM DESIGN 23
3.2 DATABASE 25
3.4 TABLES 28
4. CONCLUSION 67
REFERENCES 69
Online Shopping System
ABSTRACT
.
Online Shopping System
LIST OF FIGURES
1.1 ADMIN MODULE 5
3.5 LOGIN 30
ii
Online Shopping System
iii
Online Shopping System
LIST OF TABLES
iv
Online Shopping System
ACKNOWLEDGEMENT
P.S, for providing me with the right guidance and advice at the crucial
junctures and for showing me the right way. I extend my sincere thanks to
our respected Head of the department, for allowing us to use the facilities
available. I would like to thank the other faculty members also, at this
occasion. Last but not the least, I would like to thank my friends and family
for the support and encouragement they have given me during the course
of our work.
v
Online Shopping System
CHAPTER 1
INTRODUCTION
This project is a web based shopping system for an existing shop.
The project objective is to deliver the online shopping application into and
web based platform.
Page 11
Online Shopping System
The Server process the customers and the items are shipped to the
address submitted by them. The application was designed into two
modules first is for the customers who wish to buy the articles. Second is
for the storekeepers who maintains and updates the information pertaining
to the articles and those of the customers. The end user of this product is
a departmental store where the application is hosted on the web and the
administrator maintains the database. The application which is deployed
at the customer database, the details of the items are brought forward
from the database for the customer view based on the selection through
the menu and the database of all the products are updated at the end of
each transaction. Data entry into the application can be done through
various screens designed for various levels of users. Once the authorized
personnel feed the relevant data into the system, several reports could be
generated as per the security.
Page 12
Online Shopping System
1.4.1 MODULES:
The system after careful analysis has been identified to be presented with
the following modules and roles.
The modules involved are:
➢ Administrator
➢ Moderators
➢ Users
1.4.1.1 ADMINISTRATOR:
Page 13
Online Shopping System
1. Manage Moderators
2. Manage Products
3. Manage Users
4. Manage Orders
Page 14
Online Shopping System
MANAGE MODERATOR
Page 15
Online Shopping System
➢ Block moderator
Page 16
Online Shopping System
➢ Remove Moderator
➢ Search moderator:
MANAGE PRODUCTS
Page 17
Online Shopping System
➢ Add Products
The shopping cart project contains different kind of products. The products
can be classified into different categories by name. Admin can add new
products into the existing system with all its details including an image.
➢ Delete Products
Administrator can delete the products based on the stock of that particular
product.
➢ Search products
Page 18
Online Shopping System
Admin will have a list view of all the existing products. He can also search
for a particular product by name.
MANAGE USER
Page 19
Online Shopping System
➢ View Users
The admin will have a list view of all the users registered in the system.
Admin can view all the details of each user in the list except password.
➢ Add Users
MANAGE ORDERS
➢ View Order
Administrator can view the Orders which is generated by the users. He
can verify the details of the purchase.
➢ Delete order
Admin can delete order from the orders list when the product is taken for
delivery.
1.4.1.2 MODERATORS
A moderator is considered as a staff who can manage orders for the time
being. As a future update moderator may give facility to add and manage
his own products . Moderators can reduce the work load of admin. Now
moderator has all the privilege an admin having except managing other
Page 21
Online Shopping System
moderators. He can add products and users. He can also check the
orders and edit his profile.
➢ Manage products
➢ Manage users
➢ Manage orders
1.4.1.3 USERS
➢ Registration
Page 22
Online Shopping System
➢ Login
A user must login with his user name and password to the system after
registration.
➢ View Products
User can view the list of products based on their names after successful
login. A detailed description of a particular product with product name,
products details, product image, price can be viewed by users.
➢ Search Product
➢ Add to cart:
The user can add the desired product into his cart by clicking add to cart
option on the product.
He can view his cart by clicking on the cart button. All products added by
cart can be viewed in the cart. User can remove an item from the cart by
clicking remove.
Page 23
Online Shopping System
➢ Submit Cart:
After confirming the items in the cart the user can submit the cart by
providing a delivery address.On successful submitting the cart will become
empty.
➢ History
In the history the user will have a view of pending orders.
➢ Edit Profile
Page 24
Online Shopping System
CHAPTER 2
SYSTEM ANALYSIS
The current system for shopping is to visit the shop manually and from the
available product choose the item customer want and buying the item by
payment of the price of the item .
1. It is less user-friendly.
Page 25
Online Shopping System
Product Description:
The system consists of parts .A web application which can provide the
online shopping service and an application for the customer to
Page 26
Online Shopping System
access the web service from his Smartphone. Web application should be
able to help the customer for selecting his item and to help the owner in
managing the orders from the customers.
Problem Statement:
Page 27
Online Shopping System
i. EFFICIENCY REQUIREMENT
v. DELIVERY REQUIREMENT
Page 28
Online Shopping System
USER
➢ USER LOGIN
Description of feature
This feature used by the user to login into system. A user must login
with his user name and password to the system after registration. If they
are invalid, the user not allowed to enter the system.
Functional requirement
Description of feature
Page 29
Online Shopping System
Functional requirement
Description of feature
The user can add the desired product into his cart by clicking add to cart
option on the product. He can view his cart by clicking on the cart button.
All products added by cart can be viewed in the cart. User can remove an
item from the cart by clicking remove. After confirming the items in the cart
the user can submit the cart by providing a delivery address. On
successful submitting the cart will become empty.
Functional requirement
Page 30
Online Shopping System
ADMIN
➢ MANAGE USER
Description of feature
The administrator can add user, delete user, view user and block user.
➢ MANAGE MODERATOR
Description of feature
➢ MANAGE PRODUCTS
Description of feature
The administrator can add product, delete product and view product.
➢ MANAGE ORDERS
Description of feature
Functional requirements
Page 31
Online Shopping System
-Admin account should be secured so that only owner of the shop can
access that account
MODERATOR
Description of features
A moderator is considered as a staff who can manage orders for the time
being. As a future update moderator may give facility to add and manage
his own products. Moderators can reduce the work load of admin. Now
moderator has all the privilege of an admin having except managing other
moderators. He can manage users and manage products. He can also
check the orders and edit his profile.
Functional requirement
Page 32
Online Shopping System
CHAPTER 3
SYSTEM DESIGN
➢ Logical design
➢ Physical design
exactly what the candidate system must do. The programmers write
the necessary programs that accept input from the user, perform
Page 33
Online Shopping System
Input design is the link that ties the information system into the world of its
users. The input design involves determining the inputs, validating the
data, minimizing the data entry and provides a multi-user facility.
Inaccurate inputs are the most common cause of errors in data
processing. Errors entered by the data entry operators can be
controlled by input design. The user-originated inputs are converted to a
computer based format in the input design. Input data are collected and
organized into groups of similar data. Once identified, the appropriate
input media are selected for processing. All the input data are validated
and if any data violates any conditions, the user is warned by a
message. If the data satisfies all the conditions, it is transferred to
the appropriate tables in the database. In this project the student details
are to be entered at the time of registration. A page is designed for this
purpose which is user friendly and easy to use. The design is done
such that users get appropriate messages when exceptions occur.
Page 34
Online Shopping System
3.2 DATABASE
DATABASE DESIGN:
Databases are the storehouses of data used in the software systems. The
data is stored in tables inside the database. Several tables are
created for the manipulation of the data for the system. Two essential
settings for a database are.
.
The various system tools that have been used in developing both the front end and the
back end of the project are being discussed in this chapter.
Page 35
Online Shopping System
REACTJS:-
React.js is a popular JavaScript library for building user interfaces, particularly single- page
applications. It's widely used in e-commerce for creating dynamic and responsive frontends its
component-based architecture, which allows developers to build reusable UI elements
Here are some key features and considerations for using React.js in an e-commerce
frontend:
Page 36
Online Shopping System
4. Server-Side Rendering (SSR) and Static Site Generation (SSG): For better SEO
and performance, consider implementing server-side rendering or static site
generation with React. Libraries like Next.js provide support for SSR and SSG,
allowing you to pre-render pages on the server and serve them as static HTML
files.
5. Integration with Backend APIs: E-commerce frontends often need to
communicate with backend APIs to fetch product data, handle user authentication,
and process transactions. React makes it easy to interact with RESTful APIs or
GraphQL endpoints using libraries like Axios, Fetch API, or Apollo Client.
6. Responsive Design: With the increasing use of mobile devices for online
shopping, it's essential to build responsive user interfaces that adapt to different
screen sizes. React, along with CSS frameworks like Bootstrap or Material-UI, can
help create responsive designs for e-commerce websites.
7. Accessibility: Ensure that your e-commerce frontend is accessible to users with
disabilities by following best practices for accessibility. React offers tools like aria-*
attributes and focus management to improve accessibility.
Page 37
Online Shopping System
MongoDB:-
MongoDB is a popular NoSQL database that is commonly used in the backend of online
shopping systems due to its flexibility, scalability, and ease of use. MongoDB stores data
in a flexible, JSON-like format called BSON (Binary JSON), which allows for easy storage
and retrieval of complex data structures commonly found in e-commerce applications.
Here's how MongoDB can be used in the backend of an online shopping system:
Page 38
Online Shopping System
3.4 TABLES
➢ LOGIN
➢ USER DETAILS
Page 39
Online Shopping System
➢ PRODUCT DETAILS
➢ PRODUCT ORDERS
Page 40
Online Shopping System
➢ LOGIN
➢ USER DETAILS
Page 41
Online Shopping System
➢ PRODUCT DETAILS
➢ PRODUCT ORDERS
Page 42
Online Shopping System
➢ COMPLETE DIAGRAM
EXTERNAL ENTITY
PROCESS
DATAFLOW
Page 43
Online Shopping System
The data flow shows the flow of information from a source to its
destination. Data flow is represented by a line, with arrowheads
showing the direction of flow. Information always flows to or from a
process and may be written, verbal or electronic. Each data flow
may be referenced by the processes or data stores at its head and
tail, or by a description of its contents.
DATA STORE
➢ LOGIN DFD
Page 44
Online Shopping System
➢ REGISTRATION DFD
Page 45
Online Shopping System
➢ ADMIN DFD
Page 46
Online Shopping System
Page 47
Online Shopping System
➢ MODERATOR DFD
Page 48
Online Shopping System
➢ Home Page
Page 49
Online Shopping System
Cart Page:-
Page 50
Online Shopping System
DashBoard:-
Page 51
Online Shopping System
Sign-in-Page:-
Page 52
Online Shopping System
Sign-up-Page:-
Page 53
Online Shopping System
➢ Create Category:-
Page 54
Online Shopping System
Create Product:-
Page 55
Online Shopping System
Manage Product:-
Page 56
Online Shopping System
Manage Categories:-
Page 57
Online Shopping System
3.8Code:-
Admin:
import React from "react";
import Base from "../core/Base"
import { isAuthenticated } from "../auth/helper";
import { Link } from "react-router-dom/cjs/react-router-dom.min";
const AdminDashBoard=()=>{
const {user:{name,email,role}}=isAuthenticated()
const adminLeftSide=()=>{
return (
<div className="card">
<h4 className="card-header bg-dark text-white">Admin
Navigation</h4>
<ul className="list-group">
<li className="list-group-item">
<Link to="/admin/create/category" className="nav-link text-
success">
Create Categories
</Link>
</li>
<li className="list-group-item">
<Link to="/admin/categories" className="nav-link text-success">
Manage Categories
</Link>
</li>
<li className="list-group-item">
<Link to="/admin/create/product" className="nav-link text-
success">
Create Product
</Link>
</li>
<li className="list-group-item">
Page 58
Online Shopping System
<Link to="/admin/products" className="nav-link text-success">
Manage Products
</Link>
</li>
<li className="list-group-item">
<Link to="/admin/orders" className="nav-link text-success">
Manage Orders
</Link>
</li>
</ul>
</div>
);
}
<li className="list-group-item">
<span className="badge badge-danger">Admin Area</span>
</li>
</ul>
</div>
);
};
return (
Page 59
Online Shopping System
<Base title="Welcome to admin area" description="Manage all of your
products here">
<div className="row">
<div className="col-3">{adminLeftSide()}</div>
<div className="col-9">{adminRightSide()}</div>
</div>
</Base>
)
}
signin:
import React,{useState} from "react";
import Base from "../core/Base"
import {Link,Redirect} from "react-router-dom"
import {signin,isAuthenticated,authenticate} from "../auth/helper"
const Signin=()=>{
const {email,password,error,loading,didRedirect}=values
const {user}=isAuthenticated()
const onSubmit=event=>{
event.preventDefault();
setValues({...values, error:false,loading:true})
signin({email,password})
.then((data)=>{
if(data.error != null){
setValues({...values,error:data.error,loading:false})
}
else{
authenticate(data,()=>{
setValues({...values,didRedirect:true})
})
}
})
.catch(console.log("signin request failed"))
}
const loadingMessage=()=>{
return(
loading&&(
Page 61
Online Shopping System
<div className="alert alert-info">
<h4>Loading...</h4>
</div>
)
)
}
const errorMessage=()=>{
return (
<div className="row">
<div className="col-md-6 offset-sm-3 text-left">
<div className="alert alert-success" style={{display: error ?"":"none"}}>
{error}
</div>
</div>
</div>
)
}
const signInForm=()=>{
return (
<div className="row">
<div className="col-md-6 offset-sm-3 text-left">
<form>
<div className="form-group">
<label className="text-light">Email</label>
<input onChange={handleChange("email")} className="form-
control" type="email" value={email}/>
</div>
<div className="form-group">
<label className="text-light">password</label>
<input onChange={handleChange("password")}
className="form-control" type="password" value={password}/>
</div>
<button onClick={onSubmit}className="btn btn-success btn-
Page 62
Online Shopping System
block">Submit</button>
</form>
</div>
</div>
)
}
return (
<Base title="Sign in page" description="A page for user to sign in !!">
{loadingMessage()}
{errorMessage()}
{signInForm()}
{performRedirect()}
<p className="'text-white text-center">{JSON.stringify(values)}</p>
</Base>
)
}
signup:
import React,{useState} from "react"
import Base from "../core/Base"
import {Link} from "react-router-dom"
import {signup} from "../auth/helper"
const Signup=()=>{
const [values,setValues]=useState({
name:"",
email:"",
password:"",
error:"",
success:false
});
Page 63
Online Shopping System
const {name,email,password,error,success}=values
const onSubmit=event=>{
event.preventDefault()
setValues({...values, error:false})
signup({name,email,password})
.then(data=>{
if(data.error != null){
setValues({...values, error:data.error, success:false})
}
else{
setValues({
...values,
name:"",
email:"",
password:"",
error:"",
success:true
})
}
})
.catch(console.log("error in signup"))
const signUpForm=()=>{
return (
<div className="row">
<div className="col-md-6 offset-sm-3 text-left">
<form>
Page 64
Online Shopping System
<div className="form-group">
<label className="text-light">Name</label>
<input className="form-control"
onChange={handleChange("name")} type="text" value={name}/>
</div>
<div className="form-group">
<label className="text-light">Email</label>
<input className="form-control"
onChange={handleChange("email")} type="email" value={email}/>
</div>
<div className="form-group">
<label className="text-light">password</label>
<input className="form-control"
onChange={handleChange("password")} type="password" value={password}/>
</div>
<button onClick={onSubmit} className="btn btn-success btn-
block">Submit</button>
</form>
</div>
</div>
)
}
const successMessage=()=>{
return (
<div className="row">
<div className="col-md-6 offset-sm-3 text-left">
<div className="alert alert-success" style={{display: success
?"":"none"}}>
New Account Created Successfully.Please {" "} <Link to="/signin">Login
here</Link>
</div>
</div>
</div>
)
}
Page 65
Online Shopping System
const errorMessage=()=>{
return (
<div className="row">
<div className="col-md-6 offset-sm-3 text-left">
<div className="alert alert-success" style={{display: error ?"":"none"}}>
{error}
</div>
</div>
</div>
)
}
return (
<Base title="Sign up Page" description="page for user to sign up !!">
{successMessage()}
{errorMessage()}
{signUpForm()}
<p className="text-white text-center">{JSON.stringify(values)}</p>
</Base>
)
}
home page:
import React,{useEffect,useState} from "react";
import "../styles.css";
import { API } from "../backend";
import Base from "./Base";
import Card from "./Card";
import { getProducts } from "./helper/coreapicalls";
export default function Home() {
const [products, setProducts] = useState([]);
const [error, setError] = useState(false);
Page 66
Online Shopping System
useEffect(() => {
loadAllProduct();
}, []);
return (
<Base title="Home Page" description="Welcome to T-shirt store">
<div className="row">
{products.map((product, index) => {
return (
<div key={index} className="col-4 mb-4">
<Card product={product}/>
</div>
);
})}
</div>
</Base>
);
}
Controllers:
const Category=require("../models/category")
exports.getCategoryById=(req,res,next,id)=>{
Category.findById(id).exec((err,cate)=>{
Page 67
Online Shopping System
if(err){
res.status(400).json({
error:"Category not found in DB"
})
}
req.category=cate
next()
})
}
exports.createCategory=(req,res)=>{
const category=new Category(req.body)
category.save((err,category1)=>{
if(err) {
res.status(400).json({
error:"Not able to save category in DB"
})
}
res.json({category1})
})
}
exports.getCategory=(req,res)=>{
return res.json(req.category)
}
exports.getAllCategory=(req,res)=>{
Category.find().exec((err,categories)=>{
if(err) {
res.status(400).json({
error:"categories not found"
})
}
return res.json(categories)
})
Page 68
Online Shopping System
}
exports.updateCategory=(req,res)=>{
console.log(req.body)
Category.findByIdAndUpdate(
{_id:req.category._id},
{$set:req.body},
{new:true,useFindAndModify:false},
(err,categ)=>{
if(err){
return res.status(400).json({
error:"category not updated"
})
}
res.json(categ)
}
)
}
exports.updateCategory=(req,res)=>{
let form = new formidable.IncomingForm();
form.keepExtensions = true;
const User=require("../models/user")
const Order=require("../models/order")
exports.getUserById=(req,res,next,id)=>{
User.findById(id).exec((err,user)=>{
if(err || !user)
{
return res.status(400).json({
error:"No user found in DB"
})
}
req.profile=user
next()
})
}
exports.getUser=(req,res)=>{
req.profile.salt=undefined,
req.profile.encry_password=undefined,
req.profile.createdAt=undefined,
req.profile.updatedAt=undefined
return res.json(req.profile)
}
exports.updateUser=(req,res)=>{
User.findByIdAndUpdate(
Page 70
Online Shopping System
{_id:req.profile._id},
{$set:req.body},
{new:true,useFindAndModify:false},
(err,user)=>{
if(err){
return res.status(400).json({
error:"You are not authorized to update this
user"
})
}
user.salt=undefined
user.encry_password=undefined
res.json(user)
}
)
}
exports.userPurchaseList=(req,res)=>{
Order.find({user:req.profile._id})
.populate("user","_id name")
.exec((err,order)=>{
if(err){
return res.status(400).json({
error:"No order in this account"
})
}
return res.json(order)
})
}
exports.pushOrderInPurchaseList=(req,res,next)=>{
let purchases=[]
req.body.order.products.forEach(product =>{
purchases.push({
_id:product._id,
Page 71
Online Shopping System
name:product.name,
description:product.description,
category:product.category,
quantity:product.quantity,
amount:req.body.order.amount,
transaction_id:req.body.order.transaction_id
});
});
User.findByIdAndUpdate({_id:req.profile._id},
{$push:{purchases:purchases}},
{new:true},
(err,purchases)=>{
if(err){
return res.status(400).json({
error:"Unable to save in user purchase list"
});
}
next();
}
);
}
const {check,validationResult}=require("express-validator")
const User = require("../models/user");
const jwt=require("jsonwebtoken")
const expressJwt=require("express-jwt")
Page 72
Online Shopping System
if(!errors.isEmpty()){
return res.status(422).json({
//error:errors.array()[0].location,
error:errors.array()[0].msg,
//error:errors.array()[0].param
})
}
const user = new User(req.body);
user.save((err, user) => {
if (err) {
return res.status(400).json({
err: "NOT able to save user in DB"
});
}
res.json({
name: user.name,
email: user.email,
id: user._id
});
});
};
if (!errors.isEmpty()) {
return res.status(422).json({
error: errors.array()[0].msg
});
}
User.findOne({ email }, (err, user) => {
if (err) {
return res.status(400).json({
error: "USER email does not exists"
Page 73
Online Shopping System
});
}
if(!user){
return res.status(400).json({
error: "USER email not registered"
})
}
if (!user.autheticate(password)) {
return res.status(401).json({
error: "Email and password do not match"
});
}
//create token
const token = jwt.sign({ _id: user._id },
process.env.SECRET);
//put token in cookie
res.cookie("token", token, { expire: new Date() + 9999 });
exports.isSignedIn=expressJwt({
secret:process.env.SECRET,
userProperty:"auth"
Page 74
Online Shopping System
})
//custom middleware
exports.isAuthenticated=(req,res,next)=>{
let checker=req.profile && req.auth && req.profile._id ==
req.auth._id
if(!checker)
{
return res.status(403).json({
error:"ACCESS DENIED"
})
}
next()
}
exports.isAdmin=(req,res,next)=>{
if(req.profile.role===0)
{
return res.status(403).json({
error:"You are not admin ,ACCESS DENIED"
})
}
next()
}
Page 75
Online Shopping System
CHAPTER 4
CONCLUSION
The system has been developed with much care and free of errors and at
the same time it is efficient and less time consuming. The purpose of this
project was to develop a web application for purchasing items.
Page 88
Online Shopping System
Page 89
Online Shopping System
REFERENCES
Page 90