You are on page 1of 80

Online Grocery Personalized Shopping Cart

with Loyalty Points

BY
Divya S

Roll No: 1925MCS0030


Reg. No: 75719100013

A PROJECT REPORT
Submitted to the

FACULTY OF SCIENCE AND HUMANITIES

in partial fulfilment for the award of the degree


of

MASTER OF SCIENCE IN COMPUTER SCIENCE

CENTRE FOR DISTANCE EDUCATION


ANNA UNIVERSITY
CHENNAI – 600 0025

August, 2021

i
Certified that the project report titled ONLINE GROCERY PERSONALIZED SHOPPING
CART WITH LOYALTY POINTS is the bonafide work of Ms. Divya.S who carried out the
work under any my supervision.Certified further that to the best of my knowledge the work
reported herein does not form part of any other project report or dissertation on the basis of which
a degree or award was conferred on an earlier occasion on this or any other candidate.

Signature of Student Signature of Guide


Divya S DR.Khanna Nehemiah
Roll No: 1925MCS0030 Professor,
Reg No: 75719100013 Center for Distance Education,
Anna University
Chennai-25

ii
Certificate of Viva-Voce-Examination

This is to certify that Ms. Divya S (Roll No.: 1925MCS0030; Register No.
: 75719100013) has been subjected to Viva-Voce-Examination on ……………………
(Date) at ................................ (Time) at the Study Centre Centre for Distance Education,
Anna University, Chennai 600 025.

Internal Examiner External Examiner


Name: Name:
Designation: Designation:
Address: Address:

Coordinator Study Centre

Dr. P. Nirmalkumar
Professor – Deputy Director (M.Sc(CS))
Centre for Distance Education,
Anna University, Chennai - 25
Date:

iii
CHAPTER TITLE PAGE

1 INTRODUCTION 1
1.1 AIM OF PROJECT 1

1.2 OVERVIEW OF PROJECT 1

1.3 ABOUT THE PROJECT 1

2 SYSTEM ANALYSIS 3

2.1 EXISTING SYSTEM 4

2.2 PROPOSED SYSTEM 5

2.3 FEASIBILITY STUDY 5

3 SYSTEM SPECIFICATION 9
3.1 HARDWARE REQUIREMENT 9

3.2 SOFTWARE REQUIREMENT 9

3.3 SOFTWARE SPECIFICATION 10

4 SYSTEM DESIGN 21
4.1 ARCHITECTURE DIAGRAM 22

4.2 USECASE DIAGRAM 23


4.3 ER DIAGRAM 25
4.4 SEQUENCE DIAGRAM 27
4.5 ACTIVITY DIAGRAM 29

4.6 TABLE STRUCTURE 32

5 SYSTEM IMPLEMENTATION 34
5.1 LIST OF MODULES 35
5.2 DESCRIPTION OF MODULES 35
iv
6 TESTING 38

6.1 SYSTEM TESTING 39

6.2 TESTING TECHNIQUES 39

6.3 TEST CASES 45

7 APPENDICES 47

7.1 SCREENSHOT 47

7.2 SOURCE CODING 57

8 CONCLUSION 91

8.1 PROJECT CONCLUSION 92

8.2 PROJECT ENHANCEMENT 92

9 REFERENCES 93

9.1 BOOK REFERENCE 94

9.2 WEB REFERENCE 94

v
ABSTRACT

Due to advancement in technologies and globalization buying and selling of products over other
boundaries had become very easy. Online selling is a best way of reaching the customers
worldwide. To support selling of our grocery product we are developing a web application which
should allow customer throughout the world to register, view products and buy them. It also
provides a payment gateway through which the customer can make their payment and track their
purchase thought our web application. As we have multiple product and models, our system
provides a virtual showroom to our customer so that they can view the product images,
description and details like color, size, type etc. before purchase the product. It also provides the
separate login to administrate the Online process by the sales team. The functionalities include
history, order status update, Login details, view payment details etc. In addition, available service
windows are presented to the customer as a function of customer selected order and service types
and further, the order picking is assigned in accordance with a picker's preference. When ordering
goods, many shopping systems provide a virtual shopping cart for holding items selected for
purchase. Successive items selected for purchase are placed into the virtual shopping cart until a
customer completes their shopping trip. Once the plan to by above certain amount of purchase
they will get the loyalty point. So that can be used in the next order. The system has purchase
space with the extra booster to save money on their next Oder and also we can grab our customer
back.

vi
ACKNOWLEDGEMENT

I have taken efforts in this project. However, it would not have been possible without the
kind support and help of many individuals and organizations. I would like to extend my
sincere thanks to all of them.

I am highly indebted to Mr. Khanna Nehemiah,Professor, Centre for Distance


Education, Anna University, Chennai - 25 for their guidance and constant supervision as
well as for providing necessary information regarding the project & also for their support in
completing the project.

I would like to express my gratitude towards my parents & friends for their kind co-operation
and encouragement which help me in completion of this project.

(Ms. Divya.S)

vii
LIST OF TABLES

TABLE NO. TITLE PAGE NO.

3.2.2.1 Database – Login Table 12


3.2.2.2 Database – List Table 13
3.2.2.3 Database – Restaurant view Table 13
3.2.2.4 Database – Reservation Table 13
3.2.2.5 Database – Feedback Table 13
3.2.2.6 Database – Contact info Table 13

viii
LIST OF FIGURES

FIGURE NO. TITLE PAGE NO.

3.1.1 Start Module 11


3.1.2 Login Module 11
3.1.3 List Module 11
3.1.4 Restaurant View Module 11
3.1.5 Reservation Module 11
3.1.6 Feedback Table 12
3.1.7 Contact Info Table 12

ix
CHAPTER 1

INTRODUCTION

1.1 Overview of the Project:

An online grocery system that permits a customer to submit online orders for
items and/or services from a store that serves online customers. The online shopping system
presents an online display of an order and an associated delivery window for items selected by the
customer. The system accepts the customer's submission of a purchase order for the item in
response to a time of submission. In addition, available service windows are presented to the
customer as a function of customer selected order and service types and further, the order picking
is assigned in accordance with a picker's preference. When ordering goods, shopping systems
provide a virtual shopping cart for holding items selected for purchase. Successive items selected
for purchase are placed into the virtual shopping cart until a customer completes their shopping
trip. Virtual shopping carts may be examined at any time, and their contents can be edited or
deleted at the option of the customer. Once the customer decides to submit a purchase order and if
the customer places order above the certain amount they will get the loyalty points which the user
can use it on their next purchase.
Advantages:
 Online grocery system helps is in easy purchase of fresh grocery in online

 It saves user time instead of going to the shop they will get the products using the
website.
 The can compare the price with the others retailers very easily.
 Compare the advertising price and actual price
 The system allows to select the product and then can order it and they will get it
delivered.
 It gives the customer benefits by giving the loyalty points that can be used on their
next purchase.

Disadvantages:
 The customers can not touch and fell of the products when they want to Purchase.
 Some time delivery time is so much late.
 Security of internet banking password and credit card password

1
1.2 Literature Survey:

Online grocery shopping – “Analyzing the paradigm shift in Consumer buying behavior"
The groceries segment of India is one of the major components of the Indian retail market of
which the groceries holds a whopping share of 60% as food is the basic requirement of all
the people irrespective of their class. Online grocery shopping is one of the mega-trends
which involves sale and purchase of groceries over the internet. The concept though
conceived in the west is gaining lot of popularity in the emerging markets of India. Since the
industry is growing at a tremendous pace it has attracted huge investments by venture
capitalists and angel investors. The market has seen lot of emerging players of which Big
Basket leads from the front. These startups have been very successful because they currently
are present in different cities and commanding leading sales. Although online grocery
shopping is yet to catch up with the residents of many cities, yet all these e-commerce
companies have started operating in many metro cities with an aim to change the way people
do their grocery, veggie and staples shopping. Penetration of internet and the rise in the
public's demand for convenience shopping among the population.

Since online grocery stores have potential to grow, retailers basically can use different
strategies to penetrate different markets and market segments. One of the strategies is
providing wide range of product assortments (Ramus, K. and Nielsen, N. A., 2005). Online
store creates the value to their customers by offering customers to search and browse a
specialized assortment or customised products (Anckar, et al., 2002). Online store easily
becomes a specialty store to offer specific products and their target audience classified
based on market segmentation and individual demands (Anckar, et al., 2002) .

Perceived order accessibility involves consumer‟s perception on the easiness to order the
products via online grocer‟s sites (Raijas, A., 2002). In this case, online grocers have to
find ways to solve the navigation problem. As mentioned by Ring, L. J. and Tigert, D. J.
(2001) the reducing number of online shoppers to purchase via online is due to the layout,
design and navigation of the online grocers‟ websites. Online groceries have to equip with
fast, flexible, convenience and easy-to-use-item search system where customers can easily
search what they want to buy (Ogawara. S. et al., 2003).

According to Duffy, G. and Dale, B. G. (2002), order fulfillment is one of the important
key success factors when running online business to end users. Based on the study of
2
understanding shopper‟s expectation on internet retailing, the most important and
significant factor of shopper‟s expectation on online groceries is “time to place an order”
(Wilson-Jeanselme, M. and Reynolds, J., 2006). In other words, online grocers have to
ensure that the speed of the webpage when placing an order via online (Wilson-Jeanselme,
M. and Reynolds, J., 2006).

Besides that, “delivery time” also another important attribute because the increase and
decrease of the sales depends on the duration of delivery (Wilson Jeanselme, M. and
Reynolds, J., 2006). The unique selling point of online busiess is superior delivery system
(Ogawara. S. et al., 2003). So, the delivery should be flexible and fast to fulfill different
kind of customers and increase the operational efficiency (Ogawara. S. et al., 2003).

3
SYSTEM ANALYSIS

4
CHAPTER 2
SYSTEM ANALYSIS

2. ANALYSIS OVERVIEW
System analysis is used in every field where something is developed. It is a
process of identifying our project goals and purposes and to create the systems and
procedures that will achieve them in an efficient way.

The system analysis and designing are two main process before developing
the project because if these two step go wrong then the entire project may go wrong
because wrong design leads us to the wrong product or system development.

2.1 EXISTING SYSTEM


1. Our company‟s existing marketing and sales mostly relies on the local and
offline selling process
2. And start new showroom of our products on different location and attract
customers
3. The produced good are distributed over these retail shops and showroom and
sold to the customers

2.1 DISADVANTAGE
1. To starting new showroom company need to invest a huge amount
2. offline retail sales limits the number of customer because they are accessible
at that particular geographic region

2.2 PROPOSED SYSTEM


1. In our proposed work build an Online grocery platform to market our company products
to a large circle of customers.
2. It allow administrator to add product to the website and list those product to the customer
globally
3. Customer comes and register in our E-Commerce platform and place their orders
4. Same time administrator can view the order and ship the products to the customers.

ADVANTAGES
1. Our market expands from local to global space so the number of customer get
increases
2. Very less cost of implementation when compare to starting a retail showroom
3. Customer Based Recommendation help improve the sales and customer
experience

5
2.3 FEASIBILITY STUDY
Preliminary investigation examine project feasibility, the likelihood the
system will be useful to the organization. The main objective of the feasibility study
is to test the Technical, Operational and Economical feasibility for adding new
modules and debugging old running system. All system is feasible if they are
unlimited resources and infinite time. There are aspects in the feasibility study
portion of the preliminary investigation:
 Technical Feasibility
 Operation Feasibility
 Economical Feasibility

TECHNICAL FEASIBILITY
The technical issue usually raised during the feasibility stage of the
investigation includes the following:
 Does the necessary technology exist to do what is suggested?
 Do the proposed equipment's have the technical capacity to hold the data
required to use the new system?
 Will the proposed system provide adequate response to inquiries, regardless
of the number or location of users?
 Can the system be upgraded if developed?
 Are there technical guarantees of accuracy, reliability, ease of access and data
security?
Earlier no system existed to cater to the needs of „Secure Infrastructure
Implementation System‟. The current system developed is technically feasible. It is
a browser based user interface for audit workflow. Thus it provides an easy access
to the users. The database‟s purpose is to create, establish and maintain a workflow
among various entities in order to facilitate all concerned users in their various
capacities or roles. Permission to the users would be granted based on the roles
specified. Therefore, it provides the technical guarantee of accuracy, reliability and
security. The software and hard requirements for the development of this project are
not many and are already available or are available as free as open source. The
work for the project is done with the current equipment and existing software
technology. Necessary bandwidth exists for providing a fast feedback to the users
irrespective of the number of users using the system.

OPERATIONAL FEASIBILITY
The analyst considers the extent the proposed system will fulfill his
departments. That is whether the proposed system covers all aspects of the working
6
system and whether it has considerable improvements. We have found that the
proposed “Secure file transaction” will certainly have considerable improvements
over the existing system.

ECONOMIC FEASIBILITY
The proposed system is economically feasible because the cost involved in
purchasing the hardware and the software are within approachable. Working in this
system need not required a highly qualified professional. The operating-
environment costs are marginal. The less time involved also helped in its
economical feasibility.

7
SYSTEM SPECIFICATION

8
CHAPTER 3
SYSTEM SPECIFICATION

3. REQUIREMENT REQUIREMENT
System requirement explains or describes the requirement of developing the
projects. The requirement is divides into two categories, first is hardware
requirements and configuration and second software requirements and
configuration. This is a pre-development process which is needed to be verified
before staring the project because if they doesn‟t match then the project outcomes
may have issues or the development process may be delay and interpreted in
between.

3.1 HARDWARE REQUIREMENT


 Processor : Dual Core or Above
 Mother Board : Intel Family Motherboard
 RAM : 2 GB and Above
 Hard Disk : 300GB GB or Above
 Ethernet Card : 1Mbps Ethernet Card
 Processor : Dual Core or Above
 Other Accessories : Keyboard & Optical Mouse

3.2 SOFTWARE REQUIREMENT


 Front End : PHP
 Back End : MySQL
 Operating System : Windows 7 or Above
 Development Tool : Visual Studio Code
 Web Server : Apache
 Web Browser : Mozilla Firefox / Chrome

3.3 SOFTWARE SPECIFICATION


PHP
Hypertext Preprocessor (PHP) is a programming language that allows web
developers to create dynamic content that interacts with databases. PHP is basically
used for developing web based software applications. This tutorial helps you to
build your base with PHP. Php is a widely-used, free, and efficient alternative to
competitors such as Microsoft's ASP.
9
PHP started out as a small open source project that evolved as more and more
people found out how useful it was. Rasmus Lerdorf unleashed the first version of
PHP way back in 1994.

 PHP is a server side scripting language that is embedded in HTML. It is used


to manage dynamic content, databases, session tracking, even build entire e-
commerce sites.
 It is integrated with a number of popular databases, including MySQL,
PostgreSQL, Oracle, Sybase, Informix, and Microsoft SQL Server.
 PHP is pleasingly zippy in its execution, especially when compiled as an
Apache module on the Unix side. The MySQL server, once started, executes
even very complex queries with huge result sets in record-setting time.
 PHP supports a large number of major protocols such as POP3, IMAP, and
LDAP. PHP4 added support for Java and distributed object architectures
(COM and CORBA), making n-tier development a possibility for the first
time.

3.1.1 Common uses of PHP


 PHP performs system functions, i.e. from files on a system it can create,
open, read, write, and close them.
 PHP can handle forms, i.e. gather data from files, save data to a file, through
email you can send data, return data to the user.
 You add, delete, modify elements within your database through PHP.
 Access cookies variables and set cookies.
 Using PHP, you can restrict users to access some pages of your website.
 It can encrypt data.

3.1.2 Characteristics of PHP


Five important characteristics make PHP's practical nature possible
 Simplicity
 Efficiency
 Security
 Flexibility
 Familiarity
PHP is embedded in HTML. That means that in amongst your normal HTML
(or XHTML if you're cutting-edge) you'll have PHP statements. If you examine the
HTML output of the above example, you'll notice that the PHP code is not present
in the file sent from the server to your Web browser. All of the PHP present in the
Web page is processed and stripped from the page; the only thing returned to the
client from the Web server is pure HTML output. All PHP code must be included
inside the special markup tags as shown below are recognized by the PHP Parser.
<?Php // Php code inside here ?>
10
In order to develop and run PHP Web pages three vital components need to
be installed on your computer system.

 Web Server: PHP will work with virtually all Web Server software,
including Microsoft's Internet Information Server (IIS) but then most often
used is freely available Apache Server. Download Apache for free here −
https://httpd.apache.org/download.cgi
 Database:PHP will work with virtually all database software, including
Oracle and Sybase but most commonly used is freely available MySQL
database. Download MySQL for free here −
https://www.mysql.com/downloads/
 PHP Parser: In order to process PHP script instructions a parser must be
installed to generate HTML output that can be sent to the Web Browser. This
tutorial will guide you how to install PHP parser on your computer.

3.1.3 APACHE HTTP SERVER


 Apache HTTP server is one of the most popular web servers.
 It was developed by the Apache Software Foundation open source
community.
 Most of the web server machines run the Apache web server.
 The word 'Apache' was taken from the Native American Indian tribe of
Apache, famous for its superior skills in warfare strategy and their
inexhaustible endurance.

3.1.4 Web server


A web server is a computer where content is stored on the server. Web
server's basic job is to accept user requests and send responses to those requests.
Every web server is always connected to the Internet. Web server has an unique IP
address made up of a series of four numbers between 0 and 256 separated by
periods.
Different types of web servers:
1. Apache HTTP Server
2. Internet Information Services (IIS)
3. Lighttpd
4. Sun Java System Web Server
5. Jigsaw Server
6. Apache Tomcat
7. Abyss web server

3.1.5 Features of Apache Server


 Apache server is a free and an open source web server.

11
 It can be installed on all operating systems like Linux, Windows, Unix,
FreeBSD, Solaris, Mac OS X etc.
 It is a powerful, flexible, HTTP/1.1 compliant web server.
 This server is highly configurable and extensible with third party modules.
 It provides complete source code and comes with an unrestricted license.
 Apache supports some of the capabilities like CGI (Common Gateway
Interface) and SSI (Server Side Includes), URL redirection, loading modules
support, user authentication, proxy caching abilities etc.

Structural Query Language (SQL)


The SQL language is sub-divided into several language elements,
including: Clauses, which are constituent components of statements and queries.
(In some cases, these are optional.) Expressions, which can produce either scalar
values or tables consisting of columns and rows of data. Predicates, which specify
conditions that can be evaluated to SQL three-valued logic (3VL) or Boolean
(true/false/unknown) truth values and which are used to limit the effects of
statements and queries, or to change program flow. Queries, which retrieve the data
based on specific criteria. This is the most important element of SQL. Statements,
which may have a persistent effect on schemata and data, or which may control
transactions, program flow, connections, sessions, or diagnostics. SQL statements
also include the semicolon (";") statement terminator. Though not required on every
platform, it is defined as a standard part of the SQL grammar. Insignificant white
space is generally ignored in SQL statements and queries, making it easier to format
SQL code for readability.

Figure:1.2.4 SQL Architecture

The most common operation in SQL is the query, which is performed with
the declarative SELECT statement. SELECT retrieves data from one or more tables,
or expressions. Standard SELECT statements have no persistent effects on the
database. Some non-standard implementations of SELECT can have persistent
effects, such as the SELECT INTO syntax that exists in some databases. Queries
allow the user to describe desired data, leaving the database management system

12
(DBMS) responsible for planning, optimizing, and performing the physical
operations necessary to produce that result as it chooses. A query includes a list of
columns to be included in the final result immediately following the SELECT
keyword. An asterisk ("*") can also be used to specify that the query should return
all columns of the queried tables. SELECT is the most complex statement in SQL,
with optional keywords and clauses that include:

The FROM clause which indicates the table(s) from which data is to be
retrieved. The FROM clause can include optional JOIN sub clauses to specify the
rules for joining tables. The WHERE clause includes a comparison predicate, which
restricts the rows returned by the query. The WHERE clause eliminates all rows
from the result set for which the comparison predicate does not evaluate to True.
The GROUP BY clause is used to project rows having common values
into a smaller set of rows. GROUP BY is often used in conjunction with SQL
aggregation functions or to eliminate duplicate rows from a result set. The WHERE
clause is applied before the GROUP BY clause. The HAVING clause includes a
predicate used to filter rows resulting from the GROUP BY clause. Because it acts
on the results of the GROUP BY clause, aggregation functions can be used in the
HAVING clause predicate.

The ORDER BY clause identifies which columns are used to sort the
resulting data, and in which direction they should be sorted (options are ascending
or descending). Without an ORDER BY clause, the order of rows returned by an
SQL query is undefined. Microsoft SQL Server 2000 automatically tunes many of
the server configuration options, therefore requiring little, if any, tuning by a system
administrator. Although these configuration options can be modified by the system
administrator, it is generally recommended that these options be left at their default
values, allowing SQL Server to automatically tune itself based on run-time
conditions.

However, if necessary, the following components can be configured to


optimize server performance
 SQL Server Memory
 I/O subsystem
 Microsoft Windows NT options
Indexes are structured to facilitate the rapid return of result sets. The two
types of indexes that SQL Server supports are clustered and non-clustered indexes.
Indexes are applied to one or more columns in tables or views. The characteristics
of an index affect its use of system resources and its lookup performance. The
Query Optimizer uses an index if it will increase query performance.

An index in SQL Server assists the database engine with locating records,
just like an index in a book helps you locate information quickly. Without indexes,
a query causes SQL Server to search all records in a table (table scan) in order to
13
find matches. A database index contains one or more column values from a table
(called the index key) and pointers to the corresponding table records. When you
perform a query using the index key, the Query Optimizer will likely use an index
to locate the records that match the query.

A B-tree is analogous to an upside-down tree with the root of the tree at the
top, the leaf levels at the bottom, and intermediate levels in between. Each object in
the tree structure is a group of sorted index keys called an index page. A B-tree
facilitates fast and consistent query performance by carefully balancing the width
and depth of the tree as the index grows. Sorting the index on the index key also
improves query performance. All search requests begin at the root of a B-tree and
then move through the tree to the appropriate leaf level. The number of table
records and the size of the index key affect the width and depth of the tree. Index
key size is called the key width. A table that has many records and a large index key
width creates a deep and wide B-tree. The smaller the tree, the more quickly a
search result is returned.
SQL Server Tables
SQL Server stores records relating to each other in a table. Different tables
are created for the various groups of information. Related tables are grouped
together to form a database.

Primary Key
Every table in SQL Server has a field or a combination of fields that uniquely
identifies each record in the table. The Unique identifier is called the Primary Key,
or simply the Key. The primary key provides the means to distinguish one record
from all other in a table. It allows the user and the database system to identify,
locate and refer to one particular record in the database.

Relational Database
Sometimes all the information of interest to a business operation can be
stored in one table. SQL Server makes it very easy to link the data in multiple
tables. Matching an employee to the department in which they work is one
example. This is what makes SQL Server a relational database management
system, or RDBMS. It stores data in two or more tables and enables you to define
relationships between the table and enables you to define relationships between the
tables.

Foreign Key
When a field is one table matches the primary key of another field is referred
to as a foreign key. A foreign key is a field or a group of fields in one table whose
values match those of the primary key of another table.

Referential Integrity

14
Not only does SQL Server allow you to link multiple tables, it also maintains
consistency between them. Ensuring that the data among related tables is correctly
matched is referred to as maintaining referential integrity.

Data Abstraction
A major purpose of a database system is to provide users with an abstract
view of the data. This system hides certain details of how the data is stored and
maintained. Data abstraction is divided into three levels. Physical level: This is the
lowest level of abstraction at which one describes how the data are actually stored.
Conceptual Level: At this level of database abstraction all the attributed and what
data are actually stored is described and entries and relationship among them. View
level: This is the highest level of abstraction at which one describes only part of the
database.

Advantages Of RDBMS
 Redundancy can be avoided
 Inconsistency can be eliminated
 Data can be Shared
 Standards can be enforced
 Security restrictions can be applied
 Integrity can be maintained
 Conflicting requirements can be balanced
 Data independence can be achieved.

Disadvantages Of DBMS
A significant disadvantage of the DBMS system is cost. In addition to the
cost of purchasing of developing the software, the hardware has to be upgraded to
allow for the extensive programs and the workspace required for their execution
and storage. While centralization reduces duplication, the lack of duplication
requires that the database be adequately backed up so that in case of failure the data
can be recovered.

Features Of MySQL Server (RDBMS)


MySQL Server is one of the leading database management systems (DBMS)
because it is the only Database that meets the uncompromising requirements of
today‟s most demanding information systems. From complex decision support
systems (DSS) to the most rigorous online transaction processing (OLTP)
application, even application that require simultaneous DSS and OLTP access to the
same critical data, SQL Server leads the industry in both performance and
capability

MySQL Server is a truly portable, distributed, and open DBMS that delivers
unmatched performance, continuous operation and support for every database. SQL
15
Server RDBMS is high performance fault tolerant DBMS which is specially
designed for online transactions processing and for handling large database
application. MySQL SERVER with transactions processing option offers two
features which contribute to very high level of transaction processing throughput,
which are the row level lock manager

16
SYSTEM DESIGN

17
CHAPTER 4
SYSTEM DESIGN
4. SYSTEM DESIGN
System design is process of software development life cycle where the
project is defined in diagrammatic way or picture representation so that the process
and the ideology of the project can be properly understood by the developer
visually.

4.1 ARCHITECTURE DESIGN


The overall system architecture diagram explains the structure of our
complete project in a graphical model in very simple and effective manner. It
almost holds every component or modules of our developing projects and the
workflow of the components and the relative data resources

Fig:4.1 System Architecture


4.2 USE CASE DIAGRAM
A use case is a set of scenarios that describing an interaction between a user and a
system. A use case diagram displays the relationship among actors and use cases.
The two main components of a use case diagram are use cases and actors. An actor
is represents a user or another system that will interact with the system modeled. A
use case is an external view of the system that represents some action the user might
perform in order to complete a task

18
Fig:4.2 System Usecase

USECASE COMPONENTS
Actor and usecase are the main components of the usecase diagram which are used
to explain the access of function for a particular participant in an application

Fig:4.2.1 Actor Component


The symbol mentioned in the fig 4.2.1 is used to represent the user of the
functionalities or usecase of the project. It contains a label below which helps us to
identifier the user category.

Fig:4.2.2 Usecase Component

19
The functionalities of the project are represented using an ellipse with a label inside
them which mentions the name of the functionality. The figure 4.2.2 is a how the
usecase will look like.

Fig:4.2.3 Relationship Component


The arrow show in the diagram are used to represent the relationship between the
usecase and the actor. The arrow point toward the usecase from the actor which
means the user have the access to the particular functionalities in the project. The
usecase diagram can contain multiple actor and can have multiple access to the
usecases. Similarly same usecase can be accessed by the multiple actor/users in the
project.

4.3 ER DIAGRAM
Relation database contains a collection table(entity) and relationship between
table(entity) them self. The Design of database mostly relies on tables and
relationship. For proper understanding of the structure we make use of entity
relationship diagram (in short known as ER diagram).

20
Fig:4.3 ER Diagram

ER COMPONENTS
ER diagram uses the ellipse, diamond, arrows and rectangle to represent the
database structure used in the project. The arrows are many used to represent the
connection or relationship between the other components

Fig:4.3.1 Database Entity Symbol

Entities (tables in database) are represented by means of rectangles as show in the


figure above. Rectangles are named with the entity set they represent.
Fig:4.3.2 Attributes Connected to Entity

Attributes are the properties of entities(columns of the tables). Attributes are


represented by means of ellipses. Every ellipse represents one attribute and is
directly connected to its entity (rectangle).
Fig:4.3.3 Entity and Their Relation

Relationships between the entities are represented by diamond-shaped box. All the
entities (rectangles) participating in a relationship, are connected to it by a line. The
21
type of relationship is mentioned at the sides of the diamond shape symbol as show
in the figure

4.4 SEQUENCE DIAGRAM


A sequence diagram shows, as parallel vertical lines (“lifelines”), different
processes or objects that live simultaneously, and as the horizontal arrows, the
messages exchanged between them, in the order in which they occur. This allows
the specification of simple runtime scenarios in a graphical manner

Fig:4.4 Sequence Diagram

SEQUENCE DIAGRAM COMPONENTS


The sequence diagram uses arrows to represent the message flow between the
object inside the project. The sequence of the arrow from top down method
represent the sequence of the message flow

22
Fig: Object Component

The rectangular box is used to represent the objects used in the project and a label
given inside the rectangle to identify the object. The messages flow between the
objects for which a straight line is drawn below the rectangle.

Fig: Message Flow Component

An arrow as shown in the figure Message Flow Component will be used to mention
the message flow between the objects the label below the arrow represent the
message. The point of the arrow represent the direction of the message flow and the
sequence of the arrows used in the diagram represent the sequence of the message
flow.

4.5 ACTIVITY DIAGRAM


Activity diagram is another important diagram in UML to describe dynamic aspects
of the system. Activity diagram is basically a flow chart to represent the flow from
one activity to another activity. The activity can be described as an operation of the
system.

23
Fig:4.5 Activity Diagram

ACTIVITY DIAGRAM COMPONENTS


The components of the activity diagram contain rounded corner rectangle,
downward arrows, diamond and circle symbols to represent the activity flow in the
project.

Fig:4.5.1 Start and final(end) Symbol

The initial node is the starting point of an activity represented by an empty circle or
a filled circle as in figure Start and final(end) Symbol. An activity can have more
than one initial node; in this case several flows start at the beginning of an activity.

24
It is also possible that an activity has no initial node, but is initiated by an event
(action: accepting an event).
The activity final node a circle with a dot are show in figure 4.4.1 indicates that an
activity is completed. An activity diagram can have more than one exit in the form
of activity final nodes: If several parallel flows are present within an activity, all
flows are stopped at the time the activity final node is reached.

Fig: Activity Symbol


The symbol represent in the figure Activity Symbol is used to represent the activity
in the project. The flow of the activities is represent by an arrow the travel in the
downward direction connecting to the next activities used in the project

Fig:4.5.3 Decision Symbol


The figure Decision Symbol represents a conditional branch point or decision node.
A decision node has one input and two or more outputs. Each output has a condition
attached to it. If a condition is met, the flow proceeds along the appropriate output.
An „else‟ output can be defined along which the flow can proceed if no other
condition is met.

4.6 TABLE STRUCTURE


Admin

Cities Table

25
Product

Sales

26
SYSTEM IMPLEMENTATION

27
CHAPTER 5
IMPLEMENTATION

5. SYSTEM IMPLEMENTATION
In this chapter the main implementation of the projects is explained in detail
part by part in the form of modules. The implementation is based on the project
design as already mentioned in the system design chapter. The developer always
need to compare and verify the system design information for developing the
correct and proper implementation of the project.

5.1 LIST OF MODULES


1. Add Products
2. Register Users
3. List Products
4. Cart Management
5. Place Order
6. Shipping Management
7. Recommendation

5.2 DESCRIPTION OF MODULES


Add Products
 To market and sell our products online we need to add the products to our E-
Commerce application
 This module allows the administrator to add product details like name, cost,
category and product image etc
 It also allows the administrator to view the all the product add to our e-
commerce application

Register Users
 In order to buy products in our E-Commerce website customers need to
register their details online
 On successful registration of customer our application create an account for
the users
 This account will be accessible on login using the username and password
and in this account customer‟s all transactions will be stored

List Products
 This module fetches product details from the database that we stored using
the add product module
 Product details like name, category and cost will be shown to the customer
along with their images

28
 When product is clicked then the complete details of the product will be
listed to the customers

Cart Management
 Cart is a temporary database which is used to store the product desired by the
customers before completion of the sale
 When a customer clicks on add to cart the product will be added to this
temporary database
 Customer can view them on clicking show my cart option in our ecommerce
website
 They can also remove the product which they don't like and update the cart

Place Order
 This module is used by the customer to place an order for the list of product
along with the quantity
 After review the product in the cart, customer need to click the place order
button which will redirect them to payment process
 Once the payment process get completed the order will be place by the
system to the administrator

Shipping Management
 After completing the purchase the customer‟s order the undergoes multiple
process which has to be shown to the customers
 Our application provides access to administrator to update the status of the
taken order
 When administrator update the status the changes are instantly shown to the
customer in their my orders page so that they can track the order

29
SYSTEM TESTING

30
CHAPTER 6
TESTING

6.1 SYSTEM TESTING


Software will undergo many changes after it is delivered to the user Because
of many errors, performance enhancements and change to new environments.
System testing is the stage of implementations, which is aimed at ensuring that the
system works accurately and efficiently before live operations commences. Testing
is vital to the success of the system. The candidate system is subject to a variety of
tests. Data prepared for the purpose of testing is called test data. Testing is the
process by which the programmers generate a set of test data, which gives the
maximum probability of finding all types of errors that can occur in the software
and the following steps has been performed.

6.2 TESTING TECHNIQUES


1. Unit Testing
2. System Testing
3. Black-Box Testing
4. White Box Testing
5. Integration Testing
6. Requirement Testing
7. Acceptance Testing

6.2.1 UNIT TESTING


Unit testing is a testing technique using which individual modules are tested to
determine if there are any issues by the developer himself. It is concerned with
functional correctness of the standalone modules. The main aim is to isolate or
separate each unit or module of the system to identify, analyze and fix the defects.
The following are the advantages of the testing.

 Reduces Defects in the newly developed features or reduces bugs when


changing the existing functionality.
 It reduces Cost of Testing as defects are captured in very early phase.
 Improves design and allows better refactoring of code.
 Unit Tests, when integrated with build gives the quality of the build as well.

31
6.2.2 SYSTEM TESTING
System Testing (ST) is a black box testing technique performed to evaluate
the complete system the system's compliance against specified requirements. In
System testing, the functionalities of the system are tested from an end-to-end
perspective.
System Testing is usually carried out by a team that is independent of the
development team in order to measure the quality of the system unbiased. It
includes both functional and Non-Functional testing.

32
The above diagram explains the different types of testing process carried out during
the system testing process. For a project to success the system testing it has to pass
all the above testing process

6.2.3 BLACK BOX TESTING


Black-box testing is a method of software testing that examines the
functionality of an application based on the specifications. It is also known as
Specifications based testing. Independent Testing Team usually performs this type
of testing during the software testing life cycle.
This method of test can be applied to each and every level of software testing such
as unit, integration, system and acceptance testing.
There are different techniques involved in Black Box testing process
 Equivalence Class
 Boundary Value Analysis
 Domain Tests
 Orthogonal Arrays
 Decision Tables
 State Models
 Exploratory Testing
 All-pairs testing

6.2.4 WHITE BOX TESTING


White box testing is a testing technique that examines the program structure
and derives test data from the program logic/code. The other names of glass box
33
testing are clear box testing, open box testing, logic driven testing or path driven
testing or structural testing. White Box Testing Techniques includes
 Statement Coverage-This technique is aimed at exercising all programming
statements with minimal tests.
 Branch Coverage-This technique is running a series of tests to ensure that
all branches are tested at least once.
 Path Coverage-This technique corresponds to testing all possible paths
which means that each statement and branch is covered.

6.2.5 INTEGRATION TESTING


Upon completion of unit testing, the units or modules are to be integrated
which gives raise to integration testing. The purpose of integration testing is to
verify the functional, performance, and reliability between the modules that are
integrated. Integration strategies include
1. Big-Bang Integration
2. Top Down Integration
3. Bottom Up Integration
4. Hybrid Integration

6.2.6 REQUIREMENT TESTING


Requirements-based testing is a testing approach in which test cases, conditions and
data are derived from requirements. It includes functional tests and also non-
functional attributes such as performance, reliability or usability. Stages in
Requirements based Testing:

 Defining Test Completion Criteria-Testing is completed only when all the


functional and non-functional testing is complete.
 Design Test Cases-A Test case has five parameters namely the initial state or
precondition, data setup, the inputs, expected outcomes and actual outcomes.
 Execute Tests-Execute the test cases against the system under test and
document the results.
 Verify Test Results-Verify if the expected and actual results match each
other.
 Verify Test Coverage-Verify if the tests cover both functional and non-
functional aspects of the requirement.
 Track and Manage Defects-Any defects detected during the testing process
goes through the defect life cycle and are tracked to resolution. Defect
Statistics are maintained which will give us the overall status of the project.

6.2.7 ACCEPTANCE TESTING

34
User acceptance testing is a testing methodology where the clients/end users
involved in testing the product to validate the product against their requirements. It
is performed at client location at developer's site.
For industry such as medicine or aviation industry, contract and regulatory
compliance testing and operational acceptance testing is also carried out as part of
user acceptance testing. UAT is context dependent and the UAT plans are prepared
based on the requirements and NOT mandatory to execute all kinds of user
acceptance tests and even coordinated and contributed by testing team.
The following diagram explains the fitment of user acceptance testing in the
software development life cycle:

The acceptance test cases are executed against the test data or using an acceptance
test script and then the results are compared with the expected ones. Acceptance
criteria are defined on the basis of the following attributes
 Functional Correctness and Completeness
 Data Integrity
 Data Conversion
 Usability
 Performance
 Timeliness
 Confidentiality and Availability
 Install ability and Upgradability
 Scalability
 Documentation

6.3 Test Cases


A test case, in software engineering, is a set of conditions under which a tester will
determine whether an application, software system or one of its features is working
as it was originally established for it to do.
35
Login Form: Test Case
Expected
Controls Cases Value Outcome
Result
EmailId Non Registered Login
test@gmail.com Yes
Textbox Email Restricted
Registered Email deepa@gmail.com Access Granted Yes
Login
Wrong Password 000000 Yes
Restricted
Password
Login
Textbox Null Value Null Yes
Restricted
Correct Password 12345 Access Granted Yes

36
CHAPTER 7
APPENDICE

7.1 SCREENSHOT
Home

View product

37
Product Category

Product Details

Product Recommendation

38
Registration

Login

39
Login with Validation

Cart

40
Payment

Payment Confirmation

41
Orders

Order Details

Admin

42
Add Category

View Category

43
Add Product

View Product

44
Registered Users

View order

45
User Details

7.2 SOURCE CODING

Header

<?php session_start(); ?>


<?php include 'data_function.php' ?>
<?php include 'view_function.php' ?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<link rel="stylesheet" href="css/style2.css">
<script src="js/jquery.min.js"></script>
</head>
<body>
<div class="headsmall">
<div class="container"></div>
</div>
<div class="container">
<div class="headbig">
<div class="logo"><img src="images/logo.jpg" alt=""></div>
</div>
<div class="menu">
<a href="index.php">Home</a>
<a href="about.php">About</a>
<a href="view_items.php">Product</a>
<a href="contact.php">Contact</a>

<?php if(isset($_SESSION['email'])){?>
<a href="cart.php">Cart</a>
<a href="my_order.php">My Orders</a>
<a href="logout.php">Logout</a>
46
<?php } else { ?>
<a href="register.php">Register</a>
<a href="login.php">Login</a>
<?php } ?>
</div>

<?php include_once('header.php'); ?>


<div class="slider"><img src="images/slider2.jpg" alt=""></div>
<div class="bpad10 grid4 gap10 brd mrg gray">
<?php
$cats = get_category();
$categories ="";
foreach($cats['data'] as $cat)
{
$catgory = "<div class='blue box cat'>";
$catgory .="<a
href='view_items.php?cat=".$cat['category_name']."'>".$cat['category_name']."</a>";
$catgory .="</div>";
$categories .=$catgory;
}
echo $categories;

?>
</div>
<?php include_once('footer.php'); ?>

<div class="bpad10 footer">

</div>
</div><!-- Container Ends here -->
</body>
</html>

dtat Functions

<?php

$servername = "localhost";
$username = "root";
$password = "";
$dbname = "ecommerce_db";
$connection = "mysql:host=$servername;dbname=$dbname";

function add_category($data)
{
$result['status'] ="failed";
$result['message'] ="No Updation";
global $connection;
global $username;
47
global $password;
try
{
$conn = new PDO($connection, $username, $password);
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$stmt = $conn->prepare("insert into pro_category (category_name) values (:catname)");
$stmt->bindParam(':catname', $data["category_name"]);
//$stmt->beginTransaction();
$stmt->execute();
//$last_id = $stmt->lastInsertId();
//$stmt->commit();
$result['status'] = 'success';
$result['message'] ="Category Created Successfully";
}
catch(PDOException $e)
{
//$stmt->rollback();
$result['status'] = 'error';
$result['message'] = $e->getMessage();
}
$conn = null;
return $result;
}

function view_category()
{
global $connection;
global $username;
global $password;
$result['status'] = "failed";
$result['data'] =array();
try
{
$conn = new PDO($connection, $username, $password);
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$sql ="select * from pro_category";
$stmt = $conn->prepare($sql);
$stmt->execute();
$result['data'] = $stmt->fetchAll(PDO::FETCH_ASSOC);
$result['status']='success';
}
catch(PDOException $e)
{
$result['status'] = "Error: " . $e->getMessage();
}
$conn = null;
return $result ;
}

function option_category()

48
{
global $connection;
global $username;
global $password;
$result =array();
$cat_status = 1;
$options ="";
try
{
$conn = new PDO($connection, $username, $password);
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$stmt = $conn->prepare("select * from pro_category");
$stmt->execute();
$result = $stmt->fetchAll(PDO::FETCH_ASSOC);
foreach($result as $key=>$row)
{
$options .="<option
value='".$row['category_name']."'>".$row['category_name']."</option>";
}
}
catch(PDOException $e)
{
$result['status'] = "Error: " . $e->getMessage();
}
$conn = null;
return $options ;
}

function get_category()
{
global $connection;
global $username;
global $password;
$result =array();
$cat_status = 1;
try
{
$conn = new PDO($connection, $username, $password);
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$stmt = $conn->prepare("select * from pro_category");
$stmt->execute();
$result['data'] = $stmt->fetchAll(PDO::FETCH_ASSOC);
$result['status'] = 'success';

}
catch(PDOException $e)
{
$result['status'] = "Error: " . $e->getMessage();
}
$conn = null;

49
return $result ;
}

function view_product()
{
global $connection;
global $username;
global $password;
$result['status'] = "failed";
$result['data'] =array();
try
{
$conn = new PDO($connection, $username, $password);
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$sql ="select id,pro_name,pro_cat,pro_cost,pro_desc,pro_image,pro_active from
product_table where pro_active=1";
$stmt = $conn->prepare($sql);
$stmt->execute();
$result['data'] = $stmt->fetchAll(PDO::FETCH_ASSOC);
$result['status']='success';
}
catch(PDOException $e)
{
$result['status'] = "Error: " . $e->getMessage();
}
$conn = null;
return $result ;
}

function view_product_cat($cat='indian')
{
global $connection;
global $username;
global $password;
$result['status'] = "failed";
$result['data'] =array();
try
{
$conn = new PDO($connection, $username, $password);
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$sql ="select id,pro_name,pro_cat,pro_cost,pro_desc,pro_image,pro_active from
product_table where pro_active=1 and pro_cat='".$cat."'";
$stmt = $conn->prepare($sql);
$stmt->execute();
$result['data'] = $stmt->fetchAll(PDO::FETCH_ASSOC);
$result['status']='success';
}
catch(PDOException $e)
{

50
$result['status'] = "Error: " . $e->getMessage();
}
$conn = null;
return $result ;
}
function view_product_id($id='0')
{
global $connection;
global $username;
global $password;
$result['status'] = "failed";
$result['data'] =array();
try
{
$conn = new PDO($connection, $username, $password);
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$sql ="select * from product_table where pro_active=1 and id=".$id;
$stmt = $conn->prepare($sql);
$stmt->execute();
$result['data'] = $stmt->fetchAll(PDO::FETCH_ASSOC);
$result['status']='success';
}
catch(PDOException $e)
{
$result['status'] = "Error: " . $e->getMessage();
}
$conn = null;
return $result ;
}

function option_product()
{
global $connection;
global $username;
global $password;
$result =array();
$options ="";
try
{
$conn = new PDO($connection, $username, $password);
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$stmt = $conn->prepare("select * from product_table");
$stmt->execute();
$result = $stmt->fetchAll(PDO::FETCH_ASSOC);
foreach($result as $key=>$row)
{
$options .="<option value='".$row['id']."'>".$row['pro_name']."</option>";
}
}
catch(PDOException $e)

51
{
$result['status'] = "Error: " . $e->getMessage();
}
$conn = null;
return $options ;
}

function get_product()
{
global $connection;
global $username;
global $password;
$result =array();
$allproduct=array();
try
{
$conn = new PDO($connection, $username, $password);
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$stmt = $conn->prepare("select * from product_table");
$stmt->execute();
$result = $stmt->fetchAll(PDO::FETCH_ASSOC);
foreach($result as $key=>$row)
{
$allproduct[$row['id']] = $row['pro_name'];
}
}
catch(PDOException $e)
{
$result['status'] = "Error: " . $e->getMessage();
}
$conn = null;
return $allproduct;
}

function get_users()
{
global $connection;
global $username;
global $password;
$result =array();
$users=array();
try
{
$conn = new PDO($connection, $username, $password);
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$stmt = $conn->prepare("select * from user_table");
$stmt->execute();
$result = $stmt->fetchAll(PDO::FETCH_ASSOC);
foreach($result as $key=>$row)
52
{
$users[$row['email_id']] = $row['user_name'].' ('.$row['mobile_number'].'), '.$row['city'] ;
}
}
catch(PDOException $e)
{
$result['status'] = "Error: " . $e->getMessage();
}
$conn = null;
return $users;
}

function view_orders($email='asasd')
{
global $connection;
global $username;
global $password;
$result['status'] = "failed";
$result['data'] =array();
try
{
$conn = new PDO($connection, $username, $password);
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$sql ="select id,user_id,order_time,pro_count,pro_total, pro_status from order_master where
user_id='".$email."' order by pro_status,id desc";
$stmt = $conn->prepare($sql);
$stmt->execute();
$result['data'] = $stmt->fetchAll(PDO::FETCH_ASSOC);
$result['status']='success';
}
catch(PDOException $e)
{
$result['status'] = "Error: " . $e->getMessage();
}
$conn = null;
return $result ;
}

function orders_status($data)
{
$result['status'] ="failed";
$result['message'] ="No Updation";
global $connection;
global $username;
global $password;
$val = 0;
if($data['status']==0){
$val = 1;
}
53
try
{
$conn = new PDO($connection, $username, $password);
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$stmt = $conn->prepare("update order_master set pro_status=:active where id=:id");
$stmt->bindParam(':id', $data["id"]);
$stmt->bindParam(':active', $data["status"]);
$stmt->execute();
$result['status'] = 'success';
$result['message'] = 'Order Status Changed Succesfully !';
}
catch(PDOException $e)
{
$result['status'] = 'error';
$result['message'] = $e->getMessage();
}
$conn = null;
return $result;
}

function remove_orders($data)
{
$result['status'] ="failed";
$result['message'] ="No Updation";
global $connection;
global $username;
global $password;
try
{
$conn = new PDO($connection, $username, $password);
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$stmt = $conn->prepare("delete from order_master where id=:id");
$stmt->bindParam(':id', $data["id"]);
$stmt->execute();
$result['status'] = 'success';
$result['message'] ="Orders Deleted Successfully";
}
catch(PDOException $e)
{
$result['status'] = 'error';
$result['message'] = $e->getMessage();
}
$conn = null;
return $result;
}

function view_order_details($order_id = 0)
{
global $connection;
54
global $username;
global $password;
$result['status'] = "failed";
$result['data'] =array();
try
{
$conn = new PDO($connection, $username, $password);
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$sql ="select order_id, user_id, pro_id , pro_count from order_details";
$sql .=" where order_id =? order by id asc";
$stmt = $conn->prepare($sql);
$stmt->execute(array($order_id));
$result['data'] = $stmt->fetchAll(PDO::FETCH_ASSOC);
$result['status']='success';
}
catch(PDOException $e)
{
$result['status'] = "Error: " . $e->getMessage();
}
$conn = null;
return $result ;
}
function add_user($data)
{
$result['status'] ="failed";
$result['message'] = 'Nothing Happended!';
global $connection;
global $username;
global $password;
try
{
$conn = new PDO($connection, $username, $password);
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$sql = "insert into user_table";
$sql .="(email_id, user_name, address, city, pincode, mobile_number,password)";
$sql .= " values(:email,:name,:address,:city,:pincode,:mobile,:password)";
$stmt = $conn->prepare($sql);
$stmt->bindParam(':email', $data["email"]);
$stmt->bindParam(':name', $data["username"]);
$stmt->bindParam(':address', $data["address"]);
$stmt->bindParam(':city', $data["city"]);
$stmt->bindParam(':pincode', $data["pincode"]);
$stmt->bindParam(':mobile', $data["mobile"]);
$stmt->bindParam(':password', $data["password"]);
$stmt->execute();
$result['status'] = 'success';
$result['message'] = 'Registeration Successfully!';
}
catch(PDOException $e)
{

55
$result['status'] = "error";
$result['message'] = $e->getMessage();
}
$conn = null;
return $result;
}

function view_users()
{
global $connection;
global $username;
global $password;
$result['status'] = "failed";
$result['data'] =array();
try
{
$conn = new PDO($connection, $username, $password);
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$sql ="select * from user_table";
$stmt = $conn->prepare($sql);
$stmt->execute();
$result['data'] = $stmt->fetchAll(PDO::FETCH_ASSOC);
$result['status']='success';
}
catch(PDOException $e)
{
$result['status'] = "Error: " . $e->getMessage();
}
$conn = null;
return $result ;
}
function valid_user($data)
{
$result['status'] ="failed";
$result['message'] = 'Nothing Happended!';
global $connection;
global $username;
global $password;
try
{
$conn = new PDO($connection, $username, $password);
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$sql = "select * from user_table ";
$sql .="where email_id = :email and password = :password";
$stmt = $conn->prepare($sql);
$stmt->bindParam(':email', $data["email"]);
$stmt->bindParam(':password', $data["password"]);
$stmt->execute();
$result['data'] = $stmt->fetchAll(PDO::FETCH_ASSOC);
if(count($result['data']) > 0 ){

56
$result['status'] = 'success';
$result['message'] = 'Registeration Successfully!';
}
else
{
$result['status'] = 'invalid';
$result['message'] = 'Email / password Incorrect !';
}
}
catch(PDOException $e)
{
$result['status'] = "error";
$result['message'] = $e->getMessage();
}
$conn = null;
return $result;
}
function valid_card($data)
{
$result['status'] ="failed";
$result['message'] = 'Nothing Happended!';
global $connection;
global $username;
global $password;
try
{
$conn = new PDO($connection, $username, $password);
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$sql = "select * from card_table ";
$sql .="where card_no = :cardno and expire = :date and spin=:spin";
$stmt = $conn->prepare($sql);
$stmt->bindParam(':cardno', $data["cardno"]);
$stmt->bindParam(':date', $data["date"]);
$stmt->bindParam(':spin', $data["spin"]);
$stmt->execute();
$result['data'] = $stmt->fetchAll(PDO::FETCH_ASSOC);
if(count($result['data']) > 0 ){
$result['status'] = 'success';
$result['message'] = 'Registeration Successfully!';
}
else
{
$result['status'] = 'invalid';
$result['message'] = 'Invalid Card Details !';
}
}
catch(PDOException $e)
{
$result['status'] = "error";
$result['message'] = $e->getMessage();

57
}
$conn = null;
return $result;
}

function view_comment()
{
global $connection;
global $username;
global $password;
$result['status'] = "failed";
$result['data'] =array();
try
{
$conn = new PDO($connection, $username, $password);
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$sql ="select id, user_id, user_comment from order_master where user_comment='No
Comments'";
$stmt = $conn->prepare($sql);
$stmt->execute();
$result['data'] = $stmt->fetchAll(PDO::FETCH_ASSOC);
$result['status']='success';
}
catch(PDOException $e)
{
$result['status'] = "Error: " . $e->getMessage();
}
$conn = null;
return $result ;
}
function make_order($items,$email)
{
$result['status'] ="failed";
$result['message'] ="No Updation";
global $connection;
global $username;
global $password;
try
{

// id pro_name pro_cat pro_cost pro_count


$tot_pro = 0;
$tot_amt=0;
$status=0;
$date = date("Y-m-d H:i:s");
foreach($items as $item)
{
$tot_pro++;

58
$tot_amt = $tot_amt + ($item['pro_cost']*$item['pro_count']);
}
$conn = new PDO($connection, $username, $password);
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$conn->beginTransaction();

$stmt = $conn->prepare("insert into order_master (user_id, order_time, pro_count, pro_total,


pro_status ) values (:user,:time,:count,:amt,:status)");
$stmt->bindParam(':user', $email);
$stmt->bindParam(':time', $date);
$stmt->bindParam(':count', $tot_pro);
$stmt->bindParam(':amt', $tot_amt);
$stmt->bindParam(':status', $status);
$stmt->execute();
$last_id = $conn->lastInsertId();

foreach($items as $item)
{
$stmt = $conn->prepare("insert into order_details(order_id,user_id, pro_id, pro_count)
values (:order,:user,:prod,:count)");
$stmt->bindParam(':order', $last_id);
$stmt->bindParam(':user', $email);
$stmt->bindParam(':prod', $item["id"]);
$stmt->bindParam(':count', $item["pro_count"]);
$stmt->execute();
}
$conn->commit();
$result['status'] = 'success';
$result['message'] ="Purchase Made Successfully";
}
catch(PDOException $e)
{
$conn->rollback();
$result['status'] = 'error';
$result['message'] = $e->getMessage();
}
$conn = null;
return $result;
}
function view_recommeded($pro_id='0')
{
global $connection;
global $username;
global $password;
$result['status'] = "failed";
$result['data'] =array();
$order_ids = array();
$prod_weights = array();
$order_and_prod = array();

59
try
{
$conn = new PDO($connection, $username, $password);
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$sql ="select * from order_details";
$stmt = $conn->prepare($sql);
$stmt->execute();
$orders_data = $stmt->fetchAll(PDO::FETCH_ASSOC);
foreach($orders_data as $row)
{
$rprd_id = $row['pro_id'];
$r_order_id = $row['order_id'];

if($pro_id == $rprd_id)
array_push($order_ids, $r_order_id);

if(isset($order_and_prod[$r_order_id]))
array_push($order_and_prod[$r_order_id], $rprd_id);
else
$order_and_prod[$r_order_id]=array($rprd_id);
}

$selected_pro = array();
foreach($order_ids as $order)
{
foreach($order_and_prod[$order] as $pro_list)
{
if($pro_list != $pro_id)
{
if(isset($prod_weights[$pro_list]))
$prod_weights[$pro_list] = $prod_weights[$pro_list] + 1;
else
$prod_weights[$pro_list] = 1;
}
}

arsort($prod_weights);
$final_pro = "";
$count = 0;
foreach($prod_weights as $key=>$val)
{
if($count == 0)
$final_pro = $key;
else if($count<3)
$final_pro .= ",". $key;
$count++;
}

60
$sql ="select id,pro_name,pro_cat,pro_cost,pro_desc,pro_image,pro_active from
product_table where pro_active=1 and id in (". $final_pro.")";
$stmt = $conn->prepare($sql);
$stmt->execute();
$result['data'] = $stmt->fetchAll(PDO::FETCH_ASSOC);

}
catch(PDOException $e)
{
$result['status'] = "Error: " . $e->getMessage();
}
$conn = null;
return $result ;
}

?>

<?php

function generate_table($columns, $rows, $css_class, $style,


$actions=array(),$data_convert=array())
{
$table ="<table class='$css_class' style='$style'>";
$table .="<tr>";
foreach($columns as $col=>$span)
{
if($span > 1){
$table .="<th colspan='$span'>".$col."</th>";
}
else{
$table .="<th>".$col."</th>";
}
}
$table .="</tr>";
foreach( $rows as $row)
{
$table .="<tr>";
foreach($row as $key=>$data)
{
if(count($data_convert)>0)
{
if(array_key_exists($key,$data_convert))
{
if(array_key_exists($data, $data_convert[$key]))
{
$table .="<td>".$data_convert[$key][$data]."</td>";
}
else
{
$table .="<td>".$data."</td>";

61
}
}
else
{
$table .="<td>".$data."</td>";
}
}
else{
$table .="<td>".$data."</td>";
}
}
if(isset($actions))
{
foreach($actions as $action)
{
$table .="<td><a class='".$action['class']."'
href='".$action['url']."?id=".$row[$action['id']]."'>".$action['text']."</a></td>";
}
}
$table .="</tr>";
}
$table .="</table>";
return $table;
}

function showMessage($result)
{
if( $result['status'] == 'success')
{
echo "<div class='dCenter'>".$result['message']."</div>";
}
elseif($result['status'] == 'loading'){
echo " ";
}
else
{
echo "<div class='dCenter danger'>".$result['message']."</div>";
}
echo "<script>";
echo "$(document).ready(function(){";
echo "$('form').click(function(){ $('.dCenter').remove(); });";
echo "});";
echo "</script>";

function param_generate_table($columns, $rows, $css_class, $style,


$actions=array(),$data_convert=array())
{

62
$table ="<table class='$css_class' style='$style'>";
$table .="<tr>";
foreach($columns as $col=>$span)
{
if($span > 1){
$table .="<th colspan='$span'>".$col."</th>";
}
else{
$table .="<th>".$col."</th>";
}
}
$table .="</tr>";
foreach( $rows as $row)
{
$table .="<tr>";
foreach($row as $key=>$data)
{
if(count($data_convert)>0)
{
if(array_key_exists($key,$data_convert))
{
if(array_key_exists($data, $data_convert[$key]))
{
$table .="<td>".$data_convert[$key][$data]."</td>";
}
else
{
$table .="<td>".$data."</td>";
}
}
else
{
$table .="<td>".$data."</td>";
}
}
else{
$table .="<td>".$data."</td>";
}
}
if(isset($actions))
{
foreach($actions as $action)
{
$urlParameter="";
$paramCount = count($action['param']);
foreach($action['param'] as $param=>$colname)
{
$paramCount--;
if($paramCount == 0)
{

63
$urlParameter .=$param.'='.$row[$colname]; }
else{
$urlParameter .=$param.'='.$row[$colname].'&';
}
}
$table .="<td><a class='".$action['class']."'
href='".$action['url']."?".$urlParameter."'>".$action['text']."</a></td>";
}
}
$table .="</tr>";
}
$table .="</table>";
return $table;
}

function showMessage2($result,$divclass,$divclass2)
{
if( $result['status'] == 'success')
{
echo "<div class='".$divclass."'>".$result['message']."</div>";
}
elseif($result['status'] == 'loading'){
echo " ";
}
else
{
echo "<div class='".$divclass2."'>".$result['message']."</div>";
}

}
?>

<?php
include_once('header.php');
if(!isset($_SESSION['email']))
header("location:login.php");
?>

<?php
$quantity = 1;
if(isset($_SESSION['cart'][$_GET['pid']]))
$quantity = $_SESSION['cart'][$_GET['pid']];

if(isset($_GET['pid']) && isset($_GET['pqt']))


{
$quantity = $_GET['pqt'];
if(isset($_SESSION['cart']))
{
$_SESSION['cart'][$_GET['pid']] = $_GET['pqt'];

64
}
else
{
$_SESSION['cart'] = array();
$_SESSION['cart'][$_GET['pid']] = $_GET['pqt'];
}
}

?>

<div class="hpad10 pagegrid gap10">


<div class="box">
<div class="bpad10 brdb gray">Category</div>
<div class="sidemenu">
<?php
$cats = get_category();
$categories ="";
foreach($cats['data'] as $cat)
echo "<a
href='view_items.php?cat=".$cat['category_name']."'>".$cat['category_name']."</a>";

?>
</div>
</div>
<div id="sidebox">
<div class="box">
<div class="bpad10 brdb gray">Item Details</div>
<div class="bpad10 pagegrid gap10">
<?php
if(isset($_GET['pid']))
{
$result = view_product_id($_GET['pid']);
if(count($result['data']) > 0 )
{
$product = $result['data'][0];
$item = "<div class='box gray'>";
$item .= " <div class='itemimg'><img src='".$product['pro_image']."' alt=''
/></div>";
$item .= " <div class='itemdesc'>";
//$item .= " <div class='itemname'>".$product['pro_name']."</div>";
//$item .= " <div class='itemcost'>Rs. ".$product['pro_cost'].".00</div>";
$item .= " <div class='itemcost'>";
$item .= " <form method='GET' >";
$item .= " <input type='hidden' name='pid' value='". $_GET['pid'] ."'>";
$item .= " <div class='grid2 bpad10'>";
$item .= " <div><input style='border-right:none;' type='text' name='pqt'
value='". $quantity ."'></div>";
$item .= " <div><input style='margin-top:0px; padding:8px 10px;'
type='submit' value='Add to Cart'></div>";

65
$item .= " </div>";
$item .= " </form>";
$item .= " </div>";
$item .= " </div>";
$item .= "</div>";
$item .= "<div class='box gray bpad20'>";
$item .= " <h1>". $product['pro_name']. "</h1>";
$item .= " <p style='padding:10px 0px'> Cost: Rs.".$product['pro_cost']."</p>";
$item .= " <p>".$product['pro_desc']."</p>";
$item .= "</div>";
echo $item;
}
}
?>
</div>
</div>

<div class="box" style="margin-top:10px;">


<div class="bpad10 brdb gray">Recommendations</div>
<div class="grid3 gap10 bpad10">
<?php
$recommend = array();
$recommend['data'] = array();
if(isset($_GET['pid']))
$recommend = view_recommeded($_GET['pid']);
if(count($recommend['data']) > 0 )
{
$items="";
foreach($recommend['data'] as $product)
{
$item = "<div class='box gray'>";
$item .= " <div class='itemimg'><img src='".$product['pro_image']."' alt='' /></div>";
$item .= " <div class='itemdesc'>";
$item .= " <div class='itemname'>".$product['pro_name']."</div>";
$item .= " <div class='itemcost'>Rs. ".$product['pro_cost'].".00</div>";
$item .= " <div class='itemcost'><a
href='view_details.php?pid=".$product['id']."'>Add Item</a></div>";
$item .= " </div>";
$item .= "</div>";
$items.= $item;
}
echo $items;
}

?>
</div>
</div>
</div>
</div>

66
<?php include_once('footer.php'); ?>

View orders

<?php include 'header.php' ?>


<div class="gray bpad10 brd mrg">
<div class="bpad10 brdb gray">About Project</div>
<?php

$result =view_orders($_SESSION['email']);
$column = array('#'=>'1','Users'=>'1','Order At'=>'1','Items'=>'1','Amount'=>'1','status'=>'1',
'Action'=>'1');
$view = array('id'=>'id');
$actions[0] = array('url'=>'view_order_details.php','param'=> $view, 'class'=>'editbtn',
'text'=>'Details');

$convetions['user_id'] = get_users();
$convetions['pro_status'] = array();
$convetions['pro_status'][0] = "<span class='dangerft'>New_Order</span>";
$convetions['pro_status'][1] = "<span class='dangerft'>On_Process</span>";
$convetions['pro_status'][2] = "<span class='successft'>Packing</span>";
$convetions['pro_status'][3] = "<span class='successft'>Deliveried</span>";

$table = param_generate_table($column,$result['data'],'xtables',"width:90%;", $actions,


$convetions);
echo $table;
?>
</div>
<?php include 'footer.php' ?>

67
PROJECT CONCLUSION

68
CHAPTER 8
CONCLUSION

8.1 PROJECT CONCLUSION


By reviewing our execution result we can conclude that we had developed our
project based on the mentioned system design and according to our requirement.
We had also subjected our project to multiple test by validating the input form with
some random samples of data generate by us. The observed results proofs that our
project is error and bug free and it executes more effectively and efficiently for the
given set of data. It also contains basic authentication process so that it can validate
the person who is using the project so we can say that our project also satisfied the
required basic security.

8.2 PROJECT ENHANCEMENT


In future we will further analyses our project‟s documentation and obtained results
to identify whether we can include more functionality to our project so that the
users using the project can benefit more from it.

69
REFERENCES

70
CHAPTER 9
REFERENCES

9.1 BOOKS REFERENCE


1. “.NET Framework Essentials”, 3rd Edition, Introducing the .NET
Framework, O'Reilly Media Publications, June 2009.
2. “Mastering C# and .NET Framework” by Marino Posadas, Packtpub
Publication December 2016.
3. “Microsoft SQL Server 2008 T-SQL Fundamentals”, Pearson Education
Publications, October 2008.
4. “Learning SQL: Master SQL Fundamentals, 2rd Edition” by Alan Beaulieu,
O'Reilly Media Publications, 2009.
5. “Head First HTML with CSS & XHTML” by Elisabeth Freeman, O'Reilly
Publications, December 2005.
6. “HTML & CSS: The Complete Reference, Fifth Edition”, tata mcgraw hill,
Janauary 2010

9.2 WEB REFERENCE


1. SQl Server Tutorials: W3School, link: https://www.w3schools.com/sql
2. Web Development Tutorial, https://www.tutorialride.com/web-
technologies.htm
3. Relation Database Management, www.tutorialspoint.com/sql/sql-rdbms-
concepts.htm
4. .Net Framework for beginners, www.dotnettricks.com/learn/netframework
5. Learn HTML for free, https://www.codecademy.com/learn/learn-html
6. Learn Cascade Style Sheets, https://www.codecademy.com/learn/learn-css

71

You might also like