Mini Project
Mini Project
“E-COMMERCE WEBSITE”
By
MR. DEBANJAN
GHOSH
1
ABSTRACT
Online Shopping play a great importance in the modern business
environment. Dream gate has opened the door of opportunity and
advantage to the firms. This paper analyzed the different issue of online
shopping. The project aims to provide theoretical contribution in
understanding the present status of online shopping. The Study Discuss
the consumers’ online shopping behaviors. Paper also identify the
problems face by the consumers when they want to accept internet
shopping. Present paper is an expressive study based on the detailed
review of earlier pertinent studies related to the various concepts of
online shopping to discover the concept of online shopping. Solitude and
safety risk emerge regularly as a reason for being cautious about internet
shopping.
2
ACKNOWLEDGEMENT
NAME : CHINMAYI K
USN : U01CM22S0007
3
DECLARATION
I hereby declare that the project report entitled “E COMMERCE WEBSITE” submitted by me
in partial fulfillment of the requirements for the degree of Bachelor of Computer Applications
(BCA) is a record of original work carried out by me under the guidance of Pavithra
Assistant,Prof Department of BCA, Sri K PuttaSwamy First Grade College, Mysore. This
project report has not been submitted to any other institution for the award of any
degree/diploma.
Date:
Place: Mysore
(Chinmayi.K)
4
Table of Contents
Certificate Page No:
Abstract
Acknowledgement
Declaration
Chapter 1: Introduction 11-12
1.1 Objective
1.2 Purpose & Scope
Chapter 2: System Analysis 13-15
2.1 Existing System
2.2 Purpose System
2.3 Requirement Analysis
2.4 Hardware Requirement & Software Requirement
2.5 Justification of Selection of Technology
2.6 Database normalization & DFD
Chapter 3: System Design 16-27
3.1 Module Division
3.2 Data Dictionary
3.3 ER Diagram
Chapter 4: Coding
28-69
Chapter 5: implementation and testing
5.1 Testing Approach 70-71
5
Chapter 1
Introduction
Objective
Online Shopping play a great importance in the modern business environment. Dream gate has
opened the door of opportunity and advantage to the firms. This paper analysedthe different issue
of online shopping. The project aims to provide theoretical contribution in understanding the
present status of online shopping. The Study Discuss the consumers’ online shopping behaviors.
Paper also identify the problems face by the consumers when they want to accept internet
shopping. Present paper is an expressive study based on the detailed review of earlier pertinent
studies related to the various concepts of online shopping to discover the concept of online
shopping. Solitude and safety risk emerge regularly as a reason for being cautious about internet
shopping. Shopping convenience, information seeking, social contact, and diversity affects the
consumer attitude towards online shopping. The impossibility of product testing, problems with
complaints, product return and missus of personal data are the main doubts regarding on-line
shopping.
6
Keywords: E-Commerce is now seen as a reality for many businesses and a normal part of a
business plan. The immediate benefits, in terms of cost savings, efficiencies and enhanced
profitability are clear at every stage in the supply chain. Adopting e-business is no longer a
competitive advantage, but a normal business process, without which an enterprise is unlikely to
survive in the new economy. Year 2000 saw many Dot-com companies built up and many
companies going into E-commerce however now it is a different story, more and more
companies are failing, and investors are becoming cautious to invest money into Internet
ventures.
Purpose
Traditionally, customers are used to buying the products at the real, in other words, factual shops
or supermarkets. It needs the customers to show up in the shops in person, and walk around
different shopping shelves, and it also needs the owners of shops to stock, exhibit, and transfer
the products required by customers. It takes labor, time and space to process these operations.
Furthermore, the spread of the Covid-19 pandemic has caused a lot of changes in our lifestyle,
people fearing to get outside their homes, transportation almost shut down and social distancing
becoming all the more important. Big to small scale business that relied on the traditional incur a
lot of consequence due to the lockdown issues. Some tend to more towards using social media
platforms like Facebook to sell their product. However, the social media platforms have been
beneficial for marketing purposes alone but leaves the whole task of customer and massive order
management via direct messaging.
Scope
Dream gate
System provides a solution to reduce and optimize these expenses. Authorized Customers do not
need to go to the factual shops to choose, and bring the products they need by hands. They
simply browse their Personal computers or cellphones to access shops, and evaluate the products
description, pictures on the screen to choose products. In addition, the owners of the shop do not
need to arrange or exhibit their stocks products. They just input the description, prices of
products, and upload their pictures. Simply, both customers and shop owners do not need to
touch the real products in the whole process of shopping, and management. In the end the
logistic center will distribute the products required by customers, or products ordered by shop
owners to their locations. The customers are able to track the status of their orders until delivery,
after which they can leave a review of the type of service they received.
7
Chapter 2
System Analysis
As far as the project is developed the functionality is simple, the objective of the proposal is
to strengthen the functioning of Audit Status Monitoring and make them effective and better.
The entire scope has been classified into five streams knows as Coordinator Level,
management Level, Auditor Level, User Level and State Web Coordinator Level. The
proposed software will cover the information needs with respect to each request of the user
group viz. accepting the request, providing vulnerability document report and the current
status of the audit.
Existing System
In the existing system, each task is carried out manually and processing is also a tedious job. In
previous system travelers were maintaining time table details manually in pen and paper, which
was time taking and costly. The travelers is not able to achieve its need in time and also the results
may not accurate. Because of the manual maintenance there are number of difficulties and
drawbacks exist in the system. Some of them are
Drawbacks of the Existing System:
Increased transaction leads to increased source document and hence
maintenance becomes difficult.
If any admin, user entry is wrongly made then the maintenance becomes very
difficult.
Proposed System
Reports said that customers can take enjoy online shopping for 24 hour per day. Consumers can
purchase any goods and services anytime at everywhere. Online shopping is user friendly
compare to in store shopping because consumers can just complete his requirements just with a
click of mouse without leaving their home.
Online shopping has some advantages like below Save the Time of the consumers.
8
They can compare the price with the others retailers very easily.
Compare the advertising price and actual price
They can easily track their product
They can use cash back policy
They can purchase the product from the foreign marketers.
Requirement Analysis
Hardware Requirements:
Software Requirements:
9
Justification of Selection of Technology
The following is the desired functionality of the new system. The proposed project would cover:
Customer Module
• Customer can view/search products without login.
• Customer can also add/remove product to cart without login (if customer try to add same
product in cart. It will add only one)
• When customer try to purchase product, then he/she must login to system.
• After creating account and login to system, he/she can place order.
*If customer click on pay button, then their payment will be successful and their order will be
placed.
• Customer can check their ordered details by clicking on orders button.
• Customer can see the order status (Pending, Confirmed, Delivered) for each
order Customer can Download their order invoice for each order
Customer can send feedback to admin (without login)
Admin Module
• Admin can provide username, email, password and your admin account will be created.
• After login, there is a dashboard where admin can see how many customers is registered, how
many products are there for sale, how many orders placed.
• Admin can add/delete/view/edit the products.
10
Chapter 3
System Design
Module Division
The module division contains the following things:
•Login Page: The login page contains the username and the password.
•Sign up Page: If the user is new to the application, sign up page will open for them.
•Forget Password: After sign up, suppose you forget your password that get, password recovery page
will open.
•Loading frame: After Sign in, a loading frame will pop-up on the screen.
•Dashboard: Main frame of the Project will open – It is basically the dashboard from where the
whole project will be processed.
•Payment: There will be a payment gateway in order to make the payment of the Booking.
Data Dictionary
A Data Dictionary is a collection of names, definitions, and attributes about data elements that are
being used or captured in a database, information system, or part of a research project. Data
dictionary, or metadata repository, as defined in the IBM Dictionary of Computing, is a
"centralized repository of information about data such as meaning, relationships to other data,
origin, usage, and format". Oracle defines it as a collection of tables with metadata.
11
Tables:
Product table:
User table:
12
payment table:
cart table:
13
shopping table:
14
Oder items table:
15
ER DIAGRAM
16
SEQUENCE DIAGRAM
17
Database Normalization
Normalization is a database design technique that reduces data redundancy and eliminates
undesirable characteristics like insertion, update and Deletion Anomalies. Normalization rule
divides larger tables into smaller tables and link them using relationships. The purpose of
Normalization in SQL is to eliminate redundant (repetitive) data and ensure data is stored
logically.
payment_details
id int
order_id int
amount
Int
status
Varchar
provider
Varchar user
id int
order_details username varchar
Cart item
id int
product quantity int
id int product_id int
name varchar price int
category varchar modified_id varchar
price decimal created_id varchar
discount int
created_id varchar
18
Data Flow Diagram (DFD)
A data flow diagram is graphical tool used to describe and analyze movement of data through a
system. These are the central tool and the basis from which the other components are developed.
The transformation of data from input to output, through processed, may be described logically
and independently of physical components associated with the system. These are known as the
logical data flow diagrams. The physical data flow diagrams show the actual implements and
movement of data between people, departments and workstations.
DFD Level 0
E Commerce
Website
Admin Booking Info User
Booking Info
Response Response
19
DFD Level 1
2.0
Add /Edit Item Insert Data D2 Category
Manage
Response Category Reply
4.0
Manage Oder View Order
Order
Manage D4
Response Order Reply
5.0
View Report View Reports
Manage Order/user/
D5
Payment
Display Data Reports
Display Data
20
DFD Level 2
1.0
Login/Sign Up Request
User D1 Admin
Login Login/Sign Up Status
Insert Data
1.1
Category
Manage Reply D2
Category
1.2
Insert Item D3 Item
Manage
Item Reply
Manage D4 Order
Reply
Order
1.4
View Reports
Manage D5 Order/Payment
Report Display Data
21
DFD Level 2 Continued:
1.0
Login/Sign Up
User Request
D1 Admin
Login Login/Sign Up
Status
Insert
1.1 Data
Category
Repl
Manage y
D2
1.2
Insert D3
Item item
Manage
Item Repl
y
1.3
Manage
Repl
Order y
22
Chapter 4
CODING
Home.js
import React from
"react"; import
"./Home.css";
import Product from "./Product";
function Home()
{ return (
<div className="home">
<div className="home container">
<img
className="home image"
src="https://img.freepik.com/free-vector/happy-people-shopping-online_74855- 5865.jpg?
t=st=1650703537~exp=1650704137~hmac=915b737c0b07c1b9eed2726b0e09f8e558f
809d18472bcf38d47311380cb8c1b&w=740"
alt=""
/>
<div className="home row">
<Product
id="12321341"
title="The Lean Startup: How Constant Innovation Creates Radically Successful
Businesses Paperback"
price={11.96}
23
rating={5}
image="https://images-na.ssl-images-
amazon.com/images/I/51Zymoq7UnL._SX325_BO1,204,203,200_.jpg"
/>
<Product
id="49538094"
title="Kenwood kMix Stand Mixer for Baking, Stylish Kitchen Mixer with K-beater,
Dough Hook and Whisk, 5 Litre Glass Bowl"
price={239.0}
rating={4}
image="https://images-na.ssl-images- amazon.com/images/I/81O
%2BGNdkzKL._AC_SX450_.jpg"
/>
</div>
24
image="https://media.very.co.uk/i/very/P6LTG_SQ1_0000000071_CHARCOAL_SLf?$300x40
0_retinamobilex2$"
/>
<Product
id="3254354345"
title="New Apple iPad Pro (12.9-inch, Wi-Fi, 128GB) - Silver (4th Generation)"
price={598.99}
rating={4}
image="https://images-na.ssl-images-
amazon.com/images/I/816ctt5WV5L._AC_SX385_.jpg"
/>
</div>
<div className="home row">
<Product
id="90829332"
title="Samsung LC49RG90SSUXEN 49' Curved LED Gaming Monitor - Super Ultra
Wide Dual WQHD 5120 x 1440"
price={1094.98}
rating={4}
image="https://images-na.ssl-images-
amazon.com/images/I/6125mFrzr6L._AC_SX355_.jpg"
/>
</div>
</div>
</div>
);
}
25
Home.css
home
{ display:
flex;
justify-content: center;
margin-left: auto;
margin-right: auto;
max-width: 1500px;
}
.home row
{ display:
flex; z-
index: 1;
margin-left: 5px;
margin-right: 5px;
}
.home image {
width: 100%;
z-index: -1;
margin-bottom: -150px;
mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 1), rgba(0, 0, 0, 0));
}
26
Index.js
import React from "react";
import ReactDOM from "react-dom";
import "./index.css";
import App from "./App";
import * as serviceWorker from "./serviceWorker";
import reducer, { initialState } from "./reducer";
import { StateProvider } from "./StateProvider";
ReactDOM.render(
<React.StrictMode>
<StateProvider initialState={initialState} reducer={reducer}>
<App />
</StateProvider>
</React.StrictMode>,
document.getElementById("root")
);
// If you want your app to work offline and load faster, you can change
// unregister() to register() below. Note this comes with some pitfalls.
// Learn more about service workers: https://bit.ly/CRA-PWA
serviceWorker.unregister();
27
Index.css
*{
margin: 0;
}
body {
background-color: rgb(234, 237, 237);
margin: 0;
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen",
"Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue",
sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
code {
font-family: source-code-pro, Menlo, Monaco, Consolas, "Courier New",
monospace;
}
28
Login.js
import React, { useState } from 'react';
import './Login.css'
import { Link, useHistory } from "react-router-dom";
import { auth } from "./firebase";
function Login() {
const history = useHistory();
const [email, setEmail] = useState('');
const [password, setPassword] = useState('');
auth
.signInWithEmailAndPassword(email, password)
.then(auth => {
history.push('/')
})
.catch(error => alert(error.message))
}
29
auth
.createUserWithEmailAndPassword(email, password)
.then((auth) => {
// it successfully created a new user with email and password
if (auth) {
history.push('/')
}
})
.catch(error => alert(error.message))
}
return (
<div className='login'>
<Link to='/'>
<img
className="login logo"
src='https://upload.wikimedia.org/wikipedia/commons/thumb/a/a9/Amazon_logo.svg/1024px-
Amazon_logo.svg.png'
/>
</Link>
<form>
<h5>E-mail</h5>
<input type='text' value={email} onChange={e => setEmail(e.target.value)} />
30
<h5>Password</h5>
<input type='password' value={password} onChange={e =>
setPassword(e.target.value)} />
<p>
By signing-in you agree to the AMAZON FAKE CLONE Conditions of Use & Sale.
Please
see our Privacy Notice, our Cookies Notice and our Interest-Based Ads Notice.
</p>
31
Login.css
.login {
background-color: rgba(90, 76, 89, 0.007);
height: 100vh;
display: flex;
flex-direction: column;
align-items: center;
}
.login logo {
margin-top: 20px;
margin-bottom: 20px;
object-fit: contain;
width: 100px;
margin-right: auto;
margin-left: auto;
}
.login container
{ width: 300px;
height: fit-content;
display: flex;
flex-direction: column;
border-radius: 5px;
border: 1px solid rgb(151, 117, 5);
32
padding: 20px;
}
.login signInButton {
background: #6fb3eb;
border-radius: 2px;
width: 100%;
33
height: 30px;
border: 1px solid;
margin-top:
10px;
border-color: #1b0ce9 }
.login registerButton {
border-radius: 2px;
width: 100%;
height: 30px;
border: 1px solid;
margin-top:
10px;
border-color: rgb(133, 197, 14);
}
34
Header.css
.header
{ height:
60px;
display: flex;
align-items: center;
background-color: #bd11a6;
position: sticky;
top: 0;
z-index: 100;
}
.header logo
{ width: 160px;
object-fit: contain;
margin: 0 20px;
margin-top: 5px;
}
.header Location{
width: 20px;
object-fit: contain;
margin: 0 20px;
margin-top: 5px;
}
.header search {
35
display: flex;
flex: 1;
align-items: center;
border-radius:
24px;
}
.header searchInput {
height: 12px;
padding: 10px;
border: none;
width: 100%;
}
.header searchIcon {
padding: 5px;
height: 22px !important;
background-color: #ddf169;
}
.header optionLineOne
{ font-size: 10px;
}
.header optionLineTwo {
font-size: 13px;
font-weight: 800;
}
36
.header optionBasket {
display: flex;
align-items: center;
color: white;
}
.header basketCount
{ margin-left: 10px;
margin-right: 10px;
}
.header nav {
display: flex;
justify-content: space-evenly;
}
.header option {
display: flex;
flex-direction: column;
margin-left: 10px;
margin-right: 10px;
color: white;
}
37
Header.js
import React from
"react"; import
"./Header.css";
import SearchIcon from "@material-ui/icons/Search";
import ShoppingBasketIcon from "@material-ui/icons/ShoppingBasket";
import { Link } from "react-router-dom";
import { useStateValue } from "./StateProvider";
import { auth } from "./firebase";
function Header() {
const [{ basket, user }, dispatch] = useStateValue();
return (
<div className="header">
<Link to="/">
<img
className="header logo"
src="https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcQw2kAgk_uAYOxZp-
IQre1JzdMCHtdKx-3oiQ&usqp=CAU"/>
38
<img
className="header Location" src="D:\Downloads\
Picsart_22-04-26_13-07-49-540.png"/>
</Link>
<Link to='/orders'>
<div className="header option">
<span className="header optionLineOne">Returns</span>
<span className="header optionLineTwo">& Orders</span>
</div>
</Link>
39
<span className="header optionLineOne"></span>
<span className="header optionLineTwo">offer%</span>
</div>
<Link to="/checkout">
<div className="header optionBasket">
<ShoppingBasketIcon />
<span className="header optionLineTwo header basketCount">
{basket?.length}
</span>
</div>
</Link>
</div>
</div>
);
}
40
Firebase.js
import firebase from "firebase";
const firebaseConfig = {
apiKey: "AIzaSyCcPSKlYtpdzBoAC8soeSmIARMzVKzrf5I",
authDomain: "challenge-4b2b2.firebaseapp.com",
databaseURL: "https://challenge-4b2b2.firebaseio.com",
projectId: "challenge-4b2b2",
storageBucket: "challenge-4b2b2.appspot.com",
messagingSenderId: "962418448875",
appId: "1:962418448875:web:f6cce5eeaf819481f661ae",
};
const db = firebaseApp.firestore();
const auth = firebase.auth();
41
checkoutProduct.css
.checkoutProduct
{ display: flex;
margin-top: 20px;
margin-bottom: 20px;
}
.checkoutProduct info
{ padding-left: 20px
}
.checkoutProduct image
{ object-fit: contain;
width: 180px;
height: 180px;
}
42
.checkoutProduct rating {
display: flex;
}
.checkoutProduct title {
font-size: 17px;
font-weight: 800;
}
43
Checkoutproduct.js
import React from
"react"; import
"./Checkout.css";
import Subtotal from "./Subtotal";
import { useStateValue } from "./StateProvider";
import CheckoutProduct from "./CheckoutProduct";
function Checkout() {
const [{ basket, user }, dispatch] = useStateValue();
return (
<div className="checkout">
<div className="checkout left">
<img
className="checkout ad"
src="https://images-na.ssl-images-
amazon.com/images/G/02/UK_CCMP/TM/OCC_Amazon1._CB423492668_.jpg"
alt=""
/>
<div>
<h3>Hello, {user?.email}</h3>
<h2 className="checkout title">Your shopping Basket</h2>
{basket.map(item => (
44
<CheckoutProduct
id={item.id}
title={item.title}
image={item.image}
price={item.price}
rating={item.rating}
/>
))}
</div>
</div>
45
checkout.js
import React from
"react"; import
"./Checkout.css";
import Subtotal from "./Subtotal";
import { useStateValue } from "./StateProvider";
import CheckoutProduct from "./CheckoutProduct";
function Checkout() {
const [{ basket, user }, dispatch] = useStateValue();
return (
<div className="checkout">
<div className="checkout left">
<img
className="checkout ad"
src="https://images-na.ssl-images-
amazon.com/images/G/02/UK_CCMP/TM/OCC_Amazon1._CB423492668_.jpg"
alt=""
/>
<div>
<h3>Hello, {user?.email}</h3>
<h2 className="checkout title">Your shopping Basket</h2>
{basket.map(item => (
46
<CheckoutProduct
id={item.id}
title={item.title}
image={item.image}
price={item.price}
rating={item.rating}
/>
))}
</div>
</div>
47
Checkout.css
.checkout
{ display: flex;
padding: 20px;
background-color: white;
height: max-content;
}
.checkout ad {
width: 100%;
margin-bottom: 10px;
}
.checkout title
{ margin-right:
10px; padding:
10px;
border-bottom: 1px solid lightgray;
}
48
App.js
import React, { useEffect } from "react";
import "./App.css";
import Header from "./Header";
import Home from "./Home";
import { BrowserRouter as Router, Switch, Route } from "react-router-dom";
import Checkout from "./Checkout";
import Login from "./Login";
import Payment from "./Payment";
import Orders from "./Orders";
import { auth } from "./firebase";
import { useStateValue } from "./StateProvider";
import { loadStripe } from "@stripe/stripe-js";
import { Elements } from "@stripe/react-stripe-js";
"pk_test_51HPvU9DFg5koCdLGJJbNo60QAU99BejacsvnKvT8xnCu1wFLCuQP3WBArscK3
RvSQmSIB3N0Pbsc7TtbQiJ1vaOi00X9sIbazL"
);
function App() {
const [{}, dispatch] = useStateValue();
useEffect(() => {
// will only run once when the app component loads...
49
auth.onAuthStateChanged((authUser) =>
{ console.log("THE USER IS >>> ", authUser);
if (authUser) {
// the user just logged in / the user was logged in
dispatch({
type: "SET_USER",
user: authUser,
});
} else {
// the user is logged out
dispatch({
type: "SET_USER",
user: null,
});
}
});
}, []);
return (
<Router>
<div className="app">
<Switch>
<Route path="/orders">
<Header />
<Orders />
50
</Route>
<Route path="/login">
<Login />
</Route>
<Route path="/checkout">
<Header />
<Checkout />
</Route>
<Route path="/payment">
<Header />
<Elements stripe={promise}>
<Payment />
</Elements>
</Route>
<Route path="/">
<Header />
<Home />
</Route>
</Switch>
</div>
</Router>
);
}
51
ServiceWorker.js
// This lets the app load faster on subsequent visits in production, and gives
// it offline capabilities. However, it also means that developers (and users)
// will only see deployed updates on subsequent visits to a page, after all the
// existing tabs open on the page have been closed, since previously cached
// resources are updated in the background.
// To learn more about the benefits of this model and instructions on how to
// opt-in, read https://bit.ly/CRA-PWA
const isLocalhost =
Boolean( window.location.hostname ===
'localhost' ||
// [::1] is the IPv6 localhost address.
window.location.hostname === '[::1]' ||
// 127.0.0.0/8 are considered localhost for IPv4.
window.location.hostname.match(
/^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/
)
);
window.addEventListener('load', () => {
const swUrl = `${process.env.PUBLIC_URL}/service-worker.js`;
if (isLocalhost) {
// This is running on localhost. Let's check if a service worker still exists or not.
checkValidServiceWorker(swUrl, config);
53
'worker. To learn more, visit https://bit.ly/CRA-PWA'
);
});
} else {
// Is not localhost. Just register service worker
registerValidSW(swUrl, config);
}
});
}
}
// Execute callback
if (config && config.onUpdate) {
config.onUpdate(registration);
}
} else {
// At this point, everything has been precached.
// It's the perfect time to display a
// "Content is cached for offline use." message.
console.log('Content is cached for offline use.');
// Execute callback
if (config && config.onSuccess) {
config.onSuccess(registration);
}
}
54
}
55
};
};
})
.catch(error => {
console.error('Error during service worker registration:', error);
});
}
Payment.js
function Payment() {
const [{ basket, user }, dispatch] = useStateValue();
const history = useHistory();
useEffect(() => {
// generate the special stripe secret which allows us to charge a customer
const getClientSecret = async () => {
const response = await
axios({ method: 'post',
// Stripe expects the total in a currencies subunits
url: `/payments/create?total=${getBasketTotal(basket) * 100}`
});
setClientSecret(response.data.clientSecret)
}
getClientSecret();
57
}, [basket])
db
.collection('users')
.doc(user?.uid)
.collection('orders')
.doc(paymentIntent.id)
.set({
basket: basket,
amount: paymentIntent.amount,
created: paymentIntent.created
})
setSucceeded(true);
setError(null)
setProcessing(false)
dispatch({
type: 'EMPTY_BASKET'
})
history.replace('/orders')
})
<form onSubmit={handleSubmit}>
<CardElement onChange={handleChange}/>
Reducer.js
// Selector
export const getBasketTotal = (basket) =>
basket?.reduce((amount, item) => item.price + amount, 0);
case 'EMPTY_BASKET':
return {
...state,
basket: []
}
case "REMOVE_FROM_BASKET":
const index =
state.basket.findIndex( (basketItem) =>
basketItem.id === action.id
);
let newBasket = [...state.basket];
if (index >= 0)
{ newBasket.splice(index,
1);
} else {
console.warn(
`Cant remove product (id: ${action.id}) as its not in basket!`
)
}
return {
...state,
basket: newBasket
}
case "SET_USER":
return {
...state,
user: action.user
}
default:
return state;
}
};
61
export default reducer;
62
Order.js
function Orders() {
const [{ basket, user }, dispatch] = useStateValue();
const [orders, setOrders] = useState([]);
useEffect(() =>
{ if(user) {
db
.collection('users')
.doc(user?.uid)
.collection('orders')
.orderBy('created', 'desc')
.onSnapshot(snapshot =>
( setOrders(snapshot.docs.map(doc =>
({ id: doc.id,
data: doc.data()
})))
))
} else {
setOrders([])
}
}, [user])
return (
<div className='orders'>
<h1>Your Orders</h1>
function Subtotal()
{ const history =
useHistory();
const [{ basket }, dispatch] = useStateValue();
return (
<div className="subtotal">
<CurrencyFormat
renderText={(value) => (
<>
<p>
{/* Part of the homework */}
Subtotal ({basket.length} items): <strong>{value}</strong>
</p>
<small className="subtotal gift">
<input type="checkbox" /> This order contains a gift
</small>
</>
)}
decimalScale={2}
value={getBasketTotal(basket)} // Part of the homework
displayType={"text"}
thousandSeparator={true}
prefix={"$"}
/>
64
StateProvider.js
Orders.js
65
title={item.title}
image={item.image}
price={item.price}
rating={item.rating}
hideButton
/>
))}
<CurrencyFormat
renderText={(value) => (
<h3 className="order total">Order Total: {value}</h3>
)}
decimalScale={2}
value={order.data.amount / 100}
displayType={"text"}
thousandSeparator={true}
prefix={"$"}
/>
</div>
)
}
66
Chapter 5
Implementation & Testing
Software testing is a critical element of software quality assurance and represents the ultimate
review of specification, design and coding. In fact, testing is the one step in the software
engineering process that could be viewed as destructive rather than constructive.
UNIT TESTING
Unit testing focuses verification effort on the smallest unit of software design, the module. The
unit testing we have is white box oriented and some modules the steps are conducted in parallel.
This type of testing selects the path of the program according to the location of definition and
use of variables. This kind of testing was used only when some local variable were declared. The
definition-use chain method was used in this type of testing. These were particularly useful in
nested statements.
LOOP TESTING
* In this type of testing all the loops are tested to all the limits possible. The following
exercise was adopted for all loops:
*. All the loops were tested at their limits, just above them and just below them.
*. All the loops were skipped at least once.
*. For nested loops test the inner most loop first and then work outwards
67
INTEGRATION TESTING
Established technique of flow graph with Cyclomatic complexity was used to derive test cases
for all the functions. The main steps in deriving test cases were:
Use the design of the code and draw correspondent flow graph.
formula: V(G)=E-N+2 or
V(G)=P+1 or
V(G)=Number Of Regions
68
Chapter 6
Result & Discussion
Login Page: This allow the user to login to the Travel Management System.
Signup Page: This allow the user to make a new registration to the Travel Management System.
69
Dashboard: This allow the user to enter to the main page of the E-commerce website
70
Total Details: The total of the products to be updated.
71
Chapter 7
CONCLUSION
The project entitled dream gate (e commerce website) was completed successfully. 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 from a fashion shop. This project enabled me gain valuable information and practical
knowledge on several topics like designing web pages using html & CSS, usage of responsive
templates, designing of full stack Django application, and management of database using SQLite
The entire system is secured. Also, the project helped me understanding about the development
phases of a project and software development life cycle. I learned how to test different features
of a project. This project has given me great satisfaction in having designed an application which
can be implemented to any nearby shops or branded shops selling various kinds of products by
simple modifications The Internet has become a major resource in modern business, thus
electronic shopping has gained significance not only from the entrepreneur’s but also from the
customer’s point of view. For the entrepreneur, electronic shopping generates new business
opportunities and for the customer, it makes comparative shopping possible.
72
CHAPTER 8
REFERENCE
1. www.msdn.microsoft.com
2. www.phpcity.com
3. ww.phpgurukul.com
4. www.myproject.com
5. www.way3html.com
6. w3schools.com
73