0% found this document useful (0 votes)
14 views81 pages

LAST REPORT Obs

Download as pdf or txt
Download as pdf or txt
Download as pdf or txt
You are on page 1/ 81

ABSTRACT

The project's main goal is to develop an online book store where users can search for and make
purchases of books based on title, author, and subject. The user's chosen books are displayed in a
tabular format, and they can order them online using a debit card or credit card. Instead of going
to a bookstore and wasting time, the user can purchase a book on this website.

Many online book retailers, such as MPHOnline and BookDepository were developed using
HTML. I'd like to create a comparable website with.NET and SQL Server.

An online book store is a web application that allows customers to buy books online. Customers
can search for a book by title or author using a web browser, add it to their shopping cart, and then
purchase it using a debit or credit card transaction. The user can log in using his or her account
information, or new customers can swiftly create an account. They should include their full name,
phone number, and shipping address. A user can also provide feedback to a book by rating it on a
scale of one to five. The books are organized into several categories based on the subject matter,
such as Action and Adventure, Classics, Fantasy, Fiction, Non-fiction, Horror etc.

Customers can shop online for books at the Online Book Store using a web browser. A customer
can create an account, sign in, add items to a shopping cart, and make purchases using his or her
debit/credit card information.

When compared to a regular user, the Administrator will have more features. The Administrator
can add, delete, and edit book data, and member information, as well as confirm an order that has
been placed. The Online Book Store is built using the Master page, data sets, data grids, and user
controls.

1
Chapter 1: INTRODUCTION

1.1 Background of Study

COVID-19 is one of most serious crises in modern history, and it came as a shock to medical
professionals, governments, businesses, and individuals all across the world. Many countries
and politicians were adopting bold and strict measures to stop the virus from spreading further
and causing the healthcare system to collapse. Many businesses and industries are
experiencing major problems as a result of people being forced to stay at home and practice
social distance. The spread of digital technologies and the internet, on the other hand, allows
humans to connect and communicate and businesses to interact with their consumers despite
being physically separated. With the advancement of technology, brands and merchants may
continue to sell their products to customers and conduct at least some of their company
operations. Businesses who approach this challenging time of building a strong digital
presence with a long-term strategy will have a much better chance of thriving in the post-
COVID-19 era.

The reason why I selected online book store web services is because everyone must exercise
social distancing, which requires spending the most of the day at home. The objective of this
project is to develop an e-book store where people may buy books from the comfort of their
own homes. A virtual book store on the internet where customers can browse the catalogue
and select books of interest is known as an online book store. A shopping cart can be used to
collect the selected books. The items in the shopping cart will be displayed as an order at the
moment of checkout. More information will be required at that time to complete the
transaction. The customer will generally be required to fill out or select a billing address, a
shipping address, a shipment option, and payment information such as a debit or credit card
number. As soon as the order is placed, the customer receives an email notification.

2
1.2 Problem Statement

Companies all over the world are being impacted by the Covid-19 pandemic. Some of the
world's largest corporations experienced unfavorable consequences, such as empty stores due
to a lack of customers. The COVID-19 epidemic, on the other hand, has encouraged the
growth of the online shopping convenience movement. Starting with an easy-to-use website,
businesses may make it simple for customers to conduct research, compare alternatives and
specifications, and do anything else relevant online.

This project aims to develop an online shopping for customers with the goal so that it is very
easy to shop loved things from an extensive number of online shopping sites available on the
web. The customer simply requires a PC or a laptop and one important payment sending option
to shop online. To get to this online shopping system, all the customers will need to have an
email and password to login and proceed to their shopping. Upon successful login, the
customer can purchase a wide range of books. The customer will pick their favorite books
from the online book store sites. They do not need to go physical shops, instead just need a
computer and a payment making options like net banking, credit card or debit card. If an order
has not yet been shipped out to the customer, the customer may cancel it. The system cancels
the order with the publishers or returns the books to them in the occurrence of a cancellation.
A book can also be returned within a week. The payments will be credited to the customer's
debit or credit card, depending on their preference.

1.3 Objective
1.3.1 Main Objective
An online bookstore software project that serves as a central database for all of the books
in stock, as well as their title, author, and price. The goal of this project is to create a website
that serves as a central book store. This website was built with php on the front end and
SQL on the back end. Various book-related details are stored in the SQL database. A user
visiting the website will find a wide selection of books organized by category. The user can
choose a book and see its price. The user can even utilize the website to look for certain

3
books. After the user chooses a book, he/she must fill out a form before the book is booked
for the user.

Customers may shop for books online using a web browser thanks to the Online Book Store
Project. A customer can create an account, log in, sort books by category, add books to a
shopping basket, and pay their bill using their credit card information. When compared to
a regular user, the Administrator will have more options. He can edit the author, publisher,
book categories, book details, and member information, as well as confirm an order.

The following are the three main components of the software:


I. Allow the user to select any book.
II. Allow the user to purchase books.

1.3.2 Specific Objectives

• To design an online book store management system.


• To analyze the problems in the existing system.
• To analyze the possible requirements for the new system.

1.4 Purpose and Scope of Study


1.4.1 Purpose

The purpose of an online shopping system would be to achieve the following goals:
• Create a web user interface for adding, viewing, and deleting records in
different areas.
• Create a user interface for inputting computer details.
• Provide a user interface for changing computer and accessory details.
• Provide a user interface that allows users to browse the store and select things
to purchase.

4
1.4.2 Scope

The main scope deliverables of the project would be to:


• Analyze and develop detailed specifications and requirements
• Prepare high-level and detailed system design specifications Prepare a test
plan as well as test cases.
• Develop the system and write the code.
• Unit, integration, and system testing should all be performed.
• Demonstrate a bug-free application after making any necessary changes.

5
Chapter 2: LITERATURE REVIEW AND THEORY

2.1 Literature Review

When we use Google to search for educational websites and applications, we will find a lot of
options. However, there is some ambiguity in selecting suitable content at the proper time. Some
websites have been developed that contain stories, novels, essays, and other types of content.
Electronic Commerce (e-commerce) applications allow multiple parties involved in a commerce
transaction to connect in order to shop for new, secondhand, rare, and out-of-print books. Review
of literature for an online bookstore. The prototype serves as a roadmap for establishing a solid
Online Book Ordering System based on user feedback, notably from the perspective of academics,
which will be handled by the university's book store. The arranging, however, is still done
manually.

According to a software development firm, an e-catalogue delivers vital information about product
specifications to potential customers. It makes it easier for potential customers to find the items
they want in the format they want. It is the ideal and ideal product catalogue because it does not
require printing, has no number or color restrictions, and does not require distribution. The system
is described as self-updatable in a few simple clicks, with the content in the e-catalogue always
being accurate and, best of all, requiring no reprinting. Furthermore, the e-catalogue promotes the
products on its own, with greater interactivity, consumer personalization, and even a shopping cart
for inquiries.

MPHOnline, BookDepository, and Amazon are few of the most popular online shopping sites that
employ an e-catalogue to display their products. The website lists the many types of books that are
available. The book cover can be found on the left side of the main frame, as well as the book
description, which includes information such as the title, author, price, and number of volumes left
to be sold, as well as customer ratings.

6
Chapter 3: METHODOLOGY

3.1 Research Methodology

The first step in starting this project is gathering all of the necessary requirements in order to
develop a website that is easy to maintain and meets user needs. The emphasis is primarily on
study into various online bookstores that are already operational. Accordingly, questionnaires and
interviews with target end users have been shown to be the most effective methods for gathering
exact data from them. The design paradigm starts with a prototype of the graphical user interface
(GUI) layer and then outlines the website's back end (database and system architecture) system,
which is only visible to the portal's administrators. The prototype's construction was adjusted in
response to end-user feedback in order to build an online book catalogue that meets the project's
requirements at the completion. Iteration occurs as the prototype is refined to meet the user's needs
while also allowing the developer to gain a better understanding of what needs to be done. The
website is then deployed on a web hosting to make it available via the internet after the GUI design
prototype is finalized.

Within a software project, the Software Development Life Cycle (SDLC) is a process that is
followed for a software project. It is a detailed strategy that describes how to build, maintain,
replace, and change or improve particular software. The life cycle is a mechanism for enhancing
software quality and the development process itself. During the software development process,
numerous software development life cycle models have been established and designed. To assure
success in the software development process, each process model follows a set of stages specific
to its type. Agile Methodology is the model I'm using for this project.

7
Figure 4: Illustration of SDLC

3.2 Agile Methodology

To deliver a smooth execution of the project, a methodology has been chosen to assist in managing
the project phase by phase, beginning with the initiation and ending with the closure. A
methodology is necessary for selecting the best methods, practices, approaches, and procedures
from among the many available. As a result, Agile Methodology was chosen for the development
of the Online Book Store System platform. Agile technique is the ideal strategy to complete this
project because it divides it into phases and requires constant adjustments and input until the final
product is completed.

Agile methodology is an iterative project management strategy that allows a project to adapt to
changing working conditions and develop in a short amount of time. In this method, which is
referred to as "sprint," a project term is divided into shorter and repeatable stages. Sprint lengths
were decided during the project's early planning stages and will be reflected in the final product.

8
Figure 5: Illustration of Agile Methodology

3.3 Process

3.3.1 Research, Analysis and Gathering Requirement

This phase includes conducting literature reviews and analyses of existing systems in order to
determine the requirements and features for an online book system website. Prepare documentation
after evaluating the research study. Surveys and feedback are used to gather requirements.
Requirements are subject to change over time. The prerequisites for the Online Book System
platform are listed below:

1) A product catalogue on the home page


After a successful login, the user will be directed to this page. It will provide all of the book
categories and provide a search keyword option for finding the desired title. It also has
some unique elements, such as recommended titles and weekly special books.
2) Search
Search textbox provides the user with the option of searching by keyword. The book title
should be used as the keyword.

9
3) Advanced Search
The user can utilize advanced search to find a book based on the title, author, category, and
price range. The total number of books that match the specific search criteria will be
presented. The user can choose a book and add it to their shopping cart from here.
4) Book Description
If a user wants more information about a book, he/she can click on the title and be taken
to a Book Description page. It includes annotations on the book's content as well as a link
to Amazon.com where you can read the book review.
5) Voting by users
A user can rate a book based on his or her interests. They can give it a five-star rating if it's
excellent, four if it's very good, three if it's good, two if it's regular, and one if it's deficient.
The final rating of a book is determined by the sum of all user ratings.
6) Shopping Cart
The user can manage a shopping cart that contains all of the books that they had chosen.
The user can change, delete, and update the contents of their shopping cart. A final
shopping cart summary is shown, which includes all of the products selected by the user
as well as the overall cost.
7) Managing User Account
To access all of the website's functions, each user should create an account. The user can
log in and out using the login and logout pages, respectively. The database will save all of
the user sessions.
8) Administration
Special functions for the Administrator will be granted, such as adding or deleting a book
category, adding or deleting a member, managing member orders, adding or deleting a
debit/credit card type, and so on.

10
3.3.2 Planning Phase
Project 1 2 3 4 5 6 7 8 9 10 11 12
Tasks/Weeks

Idea & Title


Proposal

Introduction

Aim & Objective

Analysis & Survey

Methodology

Proposal Defense

Design &
Development

Interim Report
Submission

Table 1: Gantt Chart for FYP 1


11
Project 1 2 3 4 5 6 7 8 9 10 11 12
Tasks/Weeks

Design Phase

Prototype
Development

Prototype Testing &


Maintenance

Prototype
Finalization &
Documentation

Dissertation
Submission

Viva Presentation

Table 2: Gantt Chart for FYP 2

12
3.3.3 Project Design Phase

In order to design a web site, the relational database must be designed first. The data model and
the process model are the two aspects of conceptual design. The data model specifies which data
should be stored in the database, whereas the process model defines how the data should be
handled. To put it another way, the data model is used to construct the relational tables of a
relational database. The process model is used to design the queries that will access those tables
and perform operations on them.

A decomposition diagram illustrates a system's top-down functional decomposition and highlights


its structure. The goal of the Functional Decomposition is to break down a system step by step,
starting with the system's main function and progressing through the intermediate levels to the
level of basic functions. More extensive process diagrams, such as Data Flow Diagrams (DFD)
start with this diagram. Data Flow Diagrams illustrate the flow of data from external entities into
the system, as well as from one process to the next. A DFD can be drawn using four symbols:

i. Rectangles that represent external entities such as data sources and destinations.
ii. Ellipses, which represent processes that receive data as input, validate, process, and output
it.
iii. Data flows are represented by arrows, which can be electronic data or physical items.
iv. Data stores, especially electronic stores such as databases, are represented by openended
rectangles or a Disk symbol.

13
0-Level DFD:

DFD for Admin Process:

14
DFD for User Registration and Profile Update:

DFD for Shopping and Checkout Process:

15
3.3.4 Development, Testing and Review Phase

Development Phase includes writing codes using programming languages. The website will be
programmed using HTML and CSS. In the meantime, MySQL will be used as the database. This
process will be repeated until the client is satisfied with the final product.

Maintaining Phase test the website's functionality. This process will take place in parallel with the
development phase. This is to check that the programmed codes are working properly and that
there are no errors in the coding.

Review Phase includes obtaining feedback from users and testers. This process will be followed
once the finalized website has been created. This process is necessary in order to develop the
platform in the future. For the evaluation process, this website will be shared with a group of users
or testers.

16
Chapter 4: DESIGN

4.1 Introduction

The design phase of the system development process determines the best solution for the problem
that was found during the analysis phase. The suggested system's comprehensive blueprint is
produced at the end of the design phase. This chapter discusses popular software development
processes and the proposed system, alternative solutions, design techniques, and the Web-Based
Book Store System overall design.

4.2 Development Strategy

The development strategy is the path to follow in order to meet the requirements that have been
identified. In terms of the Web Book Store System, numerous strategies have been considered.
Purchasing a set of commercial software can decrease development costs and time while also
providing more quality, but you may have to pay for certain needless features, it may not match all
of your requirements precisely, and it is not configurable. Standalone systems have advantages
such as being simple to set up and maintain, having fewer incompatibilities, and having less
security risks, but they are unable to handle remote users.

The Online Book Store System chose to construct a web-based system from scratch as its
development strategy. When software is built from scratch, the end result is software that is exactly
aligned to the defined requirements. In addition, a highly configurable and upgradeable solution
with few incompatibility difficulties is created. The ability to serve remote users via a web-based
system is critical in order to meet needs such as allowing clients to place orders, searching for
books, and tracking order status.

17
The well-defined methods for the purpose of system design and modelling are known as design
techniques. Each one has its own set of techniques, features, advantages, and disadvantages. As a
result, it should be carefully studied before deciding on a method.

4.3 Why chose the Web-Based System

• From any location, it's simple to keep track of stock processes and provide useful data.
• Because the database is centralized and everything is synchronized, maintenance is simple.
• It is simple to set up.
• Client-server architecture with a web browser as the client interface is possible.
• The user is merely redirected to the proper pages.
• Because model-view-controller has been adapted, future updates and maintenance are
simple.
• By implementing a web-based solution, developer can save money on both hardware and
software.
• Web systems are platform independent, meaning it can run on any platform.

4.4 Design of the Online Book Store System


In order to make the design process and subsequent execution more efficient, Online Book Store
Web-Based System is organized into five parts.

• Purchase Module
• Stock Module
• Financial Module
• Web Module
• Administration Module

Each module's top-level use case diagram is illustrated in the sub sections below. Case narratives
are used in some situations, and additional diagrams are provided as needed.

18
4.4.1 Purchase Module

Only the administrator has access to this module. Requisitions, purchase orders, purchase, purchase
return orders, and purchase returns are all covered in this section. Admin manages requisitions and
purchase orders as completed or cancelled. Before creating a new purchase order, the admin
examines the pending requisitions, checks their availability, and if everything is in order, they can
add it as a new book and place an order. Because the details provided by the customer may vary
and the availability of the agent is uncertain, we cannot use the requisitions automatically for the
purchase order procedure. They should be confirmed before being added as a new book.

Case name Manage purchase orders

Actors Admin

Description Admin manages the purchase orders

Pre-conditions Admin must log in to the system

Main flow 1. Actor navigates to the ‘Purchase’ section.


2. System displays the section.
3. System provide options to add, complete and cancel purchase orders.
4. System updates and confirms.

Post-conditions None

4.4.2 Stock Module

This module contains three sections: Admin - the organization that supplies the books, Books - the
book details, and Stock - the stock details. Stock keep unit (SKU) is a standard term for product
ID, a unique code used to identify products in inventory control. The current status determines the
availability of functionalities such as edit and terminate.

19
Actors Admin

Description Admin manages the books’ details

Pre-conditions Admin must log in to the system

Main flow 1. Admin navigates to the ‘Product’ section.


2. System displays the section with the book details.
3. System provide options to add, update and delete a book.

Post-conditions None

Case name Add Book

Actors Admin

Description Admin adds a new book

Pre-conditions The use case “Manage Books” must have been executed

Main flow 1. Admin navigates to ‘Add Product’ sub section.


2. System displays a form to fill.
3. Admin fills the form and sends.
4. System validates the inputs.
6. System adds the book and conforms.

Post-conditions The new book is added successfully

4.4.3 Financial Module

The function of this module is to manage the Dealers' credits and debits connected to sales and
purchases, not to track the financial position of the business. As a result, it does not comply to any
standard accounting principles. On-the-spot cash sales in retail.

Case name View Orders

20
Actors Admin

Description Admin views the orders and transactions

Pre-conditions Admin must log in to the system

Main flow 1. Admin navigates to the ‘Orders’ section.


2. System displays the section with the recent orders and transactions
details.
3. Admin updates the orders by pending or completed.

Post-conditions None

4.4.4 Web Module

The Web module is the front-end of the Web-Based System, and it is in charge of making it easier
for customers and suppliers to engage with the business. This handles a variety of functions,
including making purchases online, viewing order history, and so on.

21
Figure 6: Use case diagram for Web Module

4.4.5 Administration Module

This module is responsible for managing the Web-Based System. This includes managing system
users, access levels, system log management, and data backup compilation. If required, the
administrator can deactivate or reactivate the users. The data backup is also generated at the
administrator's request. Super admin is a virtual administrator who has complete control over all
modules. However, it is only recommended that a new administrator be created. Operators and
managers are created by the administrator.

Case name Manage Users

Actors Admin

Description Admin updates users

Pre-conditions Admin must log in to the system

Main flow 1. Admin navigates to the user administration section of the system.

2. System displays the user’s details.


3. System allows admin to edit, deactivate or reactivate the user based
on the user’s current status.
4. System updates the user and confirms.

Post-conditions None

4.5 Database Design

One of the most important components of any data-driven application, such as a Web-Based
System, is the database. As a result, appropriate approaches are used to ensure the database's
integrity. MySQL is used as the backend database in this project. MySQL is a database
management system that is free and open source. The following are some of MySQL's features:
22
• MySQL is a database management system that uses a relational model. Rather than one big
table, a relational database stores data in multiple tables. These tables can be linked together
to make it easier to access and manage data.
• MySQL is a free and open-source database management system. Anyone can use and
modify the database software to meet their specific needs. It's quick, dependable, and
simple to use to enhance the level of performance.
• MySQL is a database engine that runs in several threads. A multithreaded application
accomplishes multiple tasks at once, as if multiple instances of the application were
executing at the same time.
• MySQL provides a lot of advantages because it is multithreaded. Each incoming
connection is managed by a single thread, with an additional thread that is always running
to manage the connections. Multiple clients can perform read operations at the same time,
but only one client can access the data being modified while writing. Despite the fact that
the threads share the same process space, they operate separately, allowing multiprocessor
machines to spread the thread across many CPUs as long as the host operating system
supports multiple CPUs. Multithreading is a critical component for MySQL's performance
goals. It is the foundation upon which MySQL is based.
• An ODBC driver is used to link the MySQL database to Java. Open Database Connectivity
(ODBC) is a frequently used database access Application Programming Interface (API).
The ODBC driver is a library that implements the ODBC API's functions. It handles ODBC
function calls, sends SQL requests to the MySQL server, and then returns the results to the
application. If necessary, the driver alters an application's request so that it is compatible
with MySQL's syntax.

4.6 User Interface Design

One of the most important factors in determining an application's user friendliness is its user
interface. Because it is the component with which the user interacts. The following are some of the
guidelines that were followed:

23
• Colors, text styles, component structure, and functionality, such as navigations, should all
be consistent across all interfaces.
• All interface effects and dynamic changes should have a clear meaning for the user, such
as links with a red pointer cursor for deletion or deletion warning, and so on.
• It should be simple for users to understand. Interfaces should be as basic as possible, with
helpful features such as tool tips, popup messages, and notifications recommended.
• Error and confirmation messages, for example, should be consistent, straightforward, and
free of technical terms.
• For interfaces such as forms, the data input process should be improved and as many errors
as possible detected. It would be helpful to provide default values and watermarks, as well
as to use lists and option buttons instead of text boxes for selecting data rather than typing.

The sections that follow illustrate some of the main interfaces and components of the Online
Book Store Web System in order to give a sense of the WBBM's overall interfaces.

4.6.1 Register and Login Interface

The system registers and login page, which is part of the developed system, is the primary
interface for logging into the system. Both pages are the initial interface a user encounters in
any computerized system. As a result, by properly designing and managing errors, the user
might develop a positive attitude toward the rest of the system. The main register and login
interface for Web-Based Book Store System .

4.6.2 Administration Home Page

Figure 8 shows the home page of the administrator's account. The final output was developed
based on the research into other similar web-based system interfaces. It displays the user's
basic information, including login history. Web-Based Book Store System Admin page is
shown in Figure

24
Figure : Admin Home Page

4.6.3 User Home Page

Since first impressions can influence how many people perceive your company, the web
homepage is typically the first opportunity to hook a potential customer. The homepage of the
website should be well-designed because it is the anchor that ties the rest of the website
together.

Figure : User Home Page

25
4.6.4 Shopping Cart Page

The aim of this program is to give users with an online store where they would purchase books
from the comfort of their own homes. For this purpose, a shopping cart is implemented. The
customer can choose the books they want, add them to their shopping cart, and pay for them
with a debit or credit card. The user's order will be shipped based on the delivery method
selected at the time of purchase. Figure 10 illustrate the main shopping cart page.

Figure : Shopping Cart Page

Figure : Form Interface (user)

26
Chapter 5: IMPLEMENTATION AND EVALUATION

5.1 Introduction

The implementation phase entails the development of an executable program based on the design
created during the design phase. Selecting programming languages, additional tools and
technologies like as frameworks, selecting hardware platforms, and coding the system are some of
the main activities carried out during this phase.

The system is evaluated against multiple factors such as functional and non-functional
requirements in order to guarantee that it is working properly and meets all of its specified
standards during the evaluation phase of the software development process. This chapter discusses
the web-based system testing methodologies, test plan, and test cases, as well as test data and
outputs and acceptance testing.

This chapter covers the application's implementation environment, the framework, the
development tools used, the application's structure, and an explanation of the key code segments.

5.2 Development Tools and Technologies

• Visual Studio Code for coding.


• XAMPP for local host and server connectivity with MySQL database. Refer to appendix
A.
• phpMyAdmin for database manipulation.

The Web-Based Book Store System was built using the following technologies:

27
• The web pages were developed using Visual Studio Code. The new features that were
added in the new version are developed to increase the semantics of web pages. This is the
most basic web-related language, and it assists in maintaining a clear and conscious system
structure.
• The pages were styled with CSS3. It makes it possible to create a unified design for the
entire system in an easy-to-manage manner.
• When developing the system, PHP was employed as the server-side object-oriented
programming language.
• The application's database was implemented using MySQL.
• The client-side scripting was implemented with JavaScript. Especially for the form
validation process on the client side. It is a scripting language that allows the system
components to be continuously changed.
• • JQuery was used to improve the JavaScript development process and to provide various
effects on webpages.
• Bootstrap – It’s a free framework for developing websites and online apps. It includes
design templates that are based on HTML and CSS. With a single code base, Bootstrap
easily and efficiently scales the application. Bootstrap speeds up and simplifies frontend
web development.

5.3 System Testing

The planning of a testing phase is critical for both the development and completion of a system.
The test plan should be able to test the overall system's functionality. By extensively testing a
system, it is possible to identify and fix errors that occur as a result of the system. Multiple test
scenarios were used to evaluate the implemented system. The test plan has continued to test the
system units since the development began. Upon completing the system, it was thoroughly
evaluated to determine whether it could execute as planned. As a result, this testing stage assisted
in the early detection of errors.

28
Following the system unit testing, integration testing was conducted, which allowed for the
detection of errors. To evaluate the functionality of the fully developed web-based application,
system testing was performed as the final stage.

5.4 Testing Methods

In software engineering, a number of software testing methodologies and styles have been
introduced to test various features of various systems. The major testing methodologies utilized
widely in the software testing process are Black Box testing and White Box testing. In Black Box
testing, the function is evaluated by comparing the output to the input without taking into account
the inner structure of the function, whereas in White Box testing, each of the function's logical
routes is evaluated while taking into account the inner structure of the function.

Various styles of testing were utilized at various stages of the web-based system's development.
During the design phase, unit testing was performed on each individual function of each module
to check that they were correct. Following the completion of unit testing, integration testing was
performed to check that the functionality of the modules when they interacted with one another
was correct. Following the conclusion of the integration testing, system testing was performed on
the entire system to guarantee its reliability.

Do refer the results on Appendix A – Output Screenshot below.

5.4.1 Purchase Module

The following table list a relevant test case for the Purchase Module.

Test Test Description Testing Procedures Expected Result


No.

29
1. View purchases / Navigate to Orders section. Display the sets of recent
orders purchases and placed
orders.

2. Delete purchase Click ‘Delete Order’ button in Update the placed order
order particular placed order. as deleted.

3. Complete purchase Click ‘Update’ button in particular Update the purchase


order placed order. Fill the relevant details order as confirmed.
in the dropdown bar as pending or
completed and click ‘Update’
button.

5.4.2 Stock Module

The following table list a relevant test case for the Stock Module.

Test Test Description Testing Procedures Expected Result


No.

1. Add new book Go to Products, add details and click Book is added and
‘Add Book’ button. confirmed.

2. Edit book Click the ‘Update’ button in front of Update the details and
the particular book record, edit confirm.
relevant fields and confirm.

3. Delete book Click the ‘Delete’ button in front of Book is deleted from the
the particular book record and record.
confirm.

5.4.3 Financial Module

The following table list a relevant test case for the Financial Module.

30
Test Test Description Testing Procedures Expected Result
No.

1. View transactions Navigate to Dashboard section. Display most recent set of


transactions.

5.4.4 Web Module

The following table lists the most relevant test cases for the Web Module.

Test Test Description Testing Procedures Expected Result


No.

1. Main menu Click each menu item of the main Load the relevant page.
navigation menu.

2. Place inquiry Fill in the form in the contact page. Add the inquiry entry &
display confirmation.
Press send button.

3. Customer / admin Enter id and password of the customer customer / admin is able
login / admin. Click login. to login.

4. Add books to the Clicks ‘Add to Cart’ button of the Update the shopping
shopping cart particular product. cart.

5. View shopping cart Click the shopping cart button. Display the shopping
cart.

8. Place order Click ‘Proceed to Checkout’ button. Add the new order entry,
redirected to the orders
page & display
confirmation.

31
5.4.5 Administration Module

5.5 Test Data and Results

Test data is a collection of information that is used in the testing process. When preparing test data,
some of the requirements were carefully followed, such as collecting not only valid but also invalid
datasets to cover all parts of the testing process and selecting the smallest data set possible to
reduce extra complexity. In unit and integration testing, dummy datasets were utilized, but in Web-
Based system testing, datasets retrieved from the current system were used. The test results
generated during the execution of the test cases were also documented, which will come in handy
for future review and maintenance. Do refer to appendix B – Coding Lists.

5.6 Acceptance Testing

After the system testing was completed, the users were chosen to reflect the WB's whole business
operation. After that, all of the input was collected and analyzed, and slight changes were made in
response to the users' requests.

User Acceptance Testing was entered into the developed system to begin testing. There were a few
small changes that needed to be made to the system. The client tested the entire system by
modifying the user's rights. Following the system's testing, it was requested that the system be
tested with staff members. Under the instruction of the Administrators, they had tested the system
by logging onto their user accounts. The admin pointed up a few minor changes that needed to be
made. When they finished their session, they expressed satisfaction with the system. All of the
users who recommended minor changes after completing the user acceptance testing gave a
positive response. Rather of continuing to use the old way, the client indicated that the newly
designed system would allow the business to operate more efficiently and smoothly.

32
Chapter 6: CODING LISTS

This part contains several Web-Based Book Store System codes that has been explained in the
design and implementation chapter.

General components of the program

33
➢ Database:-
-- phpMyAdmin SQL Dump
-- version 5.1.3
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Jun 21, 2022 at 10:46 AM
-- Server version: 10.4.24-MariaDB
-- PHP Version: 8.1.5

SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";


START TRANSACTION;
SET time_zone = "+00:00";

--
-- Database: `obs_db`
--

-- --------------------------------------------------------

--
-- Table structure for table `admin`
--

CREATE TABLE `admin` (


`name` varchar(20) COLLATE latin1_general_ci NOT NULL,
`pass` varchar(40) COLLATE latin1_general_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `admin`
--

INSERT INTO `admin` (`name`, `pass`) VALUES


('admin', 'f865b53623b121fd34ee5426c792e5c33af8c227');

-- --------------------------------------------------------

34
--
-- Table structure for table `books`
--

CREATE TABLE `books` (


`book_isbn` varchar(20) COLLATE latin1_general_ci NOT NULL,
`book_title` varchar(60) COLLATE latin1_general_ci DEFAULT NULL,
`book_author` varchar(60) COLLATE latin1_general_ci DEFAULT NULL,
`book_image` varchar(40) COLLATE latin1_general_ci DEFAULT NULL,
`book_descr` text COLLATE latin1_general_ci DEFAULT NULL,
`book_price` decimal(6,2) NOT NULL,
`publisherid` int(10) UNSIGNED NOT NULL,
`created_at` datetime NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

-- --------------------------------------------------------

--
-- Table structure for table `customers`
--

CREATE TABLE `customers` (


`customerid` int(10) UNSIGNED NOT NULL,
`name` varchar(60) COLLATE latin1_general_ci NOT NULL,
`address` varchar(80) COLLATE latin1_general_ci NOT NULL,
`city` varchar(30) COLLATE latin1_general_ci NOT NULL,
`zip_code` varchar(10) COLLATE latin1_general_ci NOT NULL,
`country` varchar(60) COLLATE latin1_general_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `customers`
--

INSERT INTO `customers` (`customerid`, `name`, `address`, `city`, `zip_code`, `country`) VALUES

35
(1, 'a', 'a', 'a', 'a', 'a'),
(2, 'b', 'b', 'b', 'b', 'b'),
(3, 'test', '123 test', '12121', 'test', 'test'),
(4, 'Mark Cooper', 'Sample Street', 'Here', '2306', 'Sampple'),
(5, 'Mark Cooper', 'Sample Street', 'Sample City', '2306', 'Philippines'),
(6, 'Mark Cooper', 'Here City There Province, 2306', 'Here', '2306', 'Philippines'),
(7, 'Mark Cooper', 'Here City There Province, 2306', 'Sample City', '2306', 'Philippines'),
(8, 'Samantha Jane Miller', 'Sample Street', 'Sample City', '2306', 'Sampple');

-- --------------------------------------------------------

--
-- Table structure for table `orders`
--

CREATE TABLE `orders` (


`orderid` int(10) UNSIGNED NOT NULL,
`customerid` int(10) UNSIGNED NOT NULL,
`amount` decimal(6,2) DEFAULT NULL,
`date` timestamp NOT NULL DEFAULT current_timestamp(),
`ship_name` char(60) COLLATE latin1_general_ci NOT NULL,
`ship_address` char(80) COLLATE latin1_general_ci NOT NULL,
`ship_city` char(30) COLLATE latin1_general_ci NOT NULL,
`ship_zip_code` char(10) COLLATE latin1_general_ci NOT NULL,
`ship_country` char(20) COLLATE latin1_general_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `orders`
--

INSERT INTO `orders` (`orderid`, `customerid`, `amount`, `date`, `ship_name`, `ship_address`, `ship_city`,
`ship_zip_code`, `ship_country`) VALUES
(1, 1, '60.00', '2015-12-03 13:30:12', 'a', 'a', 'a', 'a', 'a'),
(2, 2, '60.00', '2015-12-03 13:31:12', 'b', 'b', 'b', 'b', 'b'),
(3, 3, '20.00', '2015-12-03 19:34:21', 'test', '123 test', '12121', 'test', 'test'),
(4, 1, '20.00', '2015-12-04 10:19:14', 'a', 'a', 'a', 'a', 'a'),

36
(5, 4, '80.00', '2022-06-21 00:09:36', 'Mark Cooper', 'Sample Street', 'Here', '2306', 'Sampple'),
(6, 5, '220.00', '2022-06-21 01:35:16', 'Mark Cooper', 'Sample Street', 'Sample City', '2306', 'Philippines'),
(7, 6, '20.00', '2022-06-21 01:38:20', 'Mark Cooper', 'Here City There Province, 2306', 'Here', '2306',
'Philippines'),
(8, 7, '20.00', '2022-06-21 01:40:28', 'Mark Cooper', 'Here City There Province, 2306', 'Sample City', '2306',
'Philippines'),
(9, 8, '80.00', '2022-06-21 01:42:56', 'Samantha Jane Miller', 'Sample Street', 'Sample City', '2306', 'Sampple');

-- --------------------------------------------------------

--
-- Table structure for table `order_items`
--

CREATE TABLE `order_items` (


`orderid` int(10) UNSIGNED NOT NULL,
`book_isbn` varchar(20) COLLATE latin1_general_ci NOT NULL,
`item_price` decimal(6,2) NOT NULL,
`quantity` tinyint(3) UNSIGNED NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `order_items`
--

INSERT INTO `order_items` (`orderid`, `book_isbn`, `item_price`, `quantity`) VALUES


(1, '978-1-118-94924-5', '20.00', 1),
(1, '978-1-44937-019-0', '20.00', 1),
(1, '978-1-49192-706-9', '20.00', 1),
(2, '978-1-118-94924-5', '20.00', 1),
(2, '978-1-44937-019-0', '20.00', 1),
(2, '978-1-49192-706-9', '20.00', 1),
(3, '978-0-321-94786-4', '20.00', 1),
(1, '978-1-49192-706-9', '20.00', 1),
(5, '978-1-4571-0402-2', '20.00', 2),
(5, '978-1-44937-075-6', '20.00', 1),
(5, '978-0-321-94786-4', '20.00', 1),

37
(6, '978-1-4571-0402-2', '20.00', 10),
(6, '978-1-44937-075-6', '20.00', 1),
(7, '978-0-7303-1484-4', '20.00', 1),
(8, '978-1-1180-2669-4', '20.00', 1),
(9, '978-1-44937-019-0', '20.00', 4);

-- --------------------------------------------------------

--
-- Table structure for table `publisher`
--

CREATE TABLE `publisher` (


`publisherid` int(10) UNSIGNED NOT NULL,
`publisher_name` varchar(60) COLLATE latin1_general_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `publisher`
--

INSERT INTO `publisher` (`publisherid`, `publisher_name`) VALUES


(1, 'Publisher 1'),
(2, 'Publisher 2'),
(3, 'Publisher 3'),
(4, 'Publisher 4'),
(5, 'Publisher 5'),
(6, 'Publisher 6');

--
-- Indexes for dumped tables
--

--
-- Indexes for table `admin`
--
ALTER TABLE `admin`

38
ADD PRIMARY KEY (`name`,`pass`);

--
-- Indexes for table `books`
--
ALTER TABLE `books`
ADD PRIMARY KEY (`book_isbn`);

--
-- Indexes for table `customers`
--
ALTER TABLE `customers`
ADD PRIMARY KEY (`customerid`);

--
-- Indexes for table `orders`
--
ALTER TABLE `orders`
ADD PRIMARY KEY (`orderid`);

--
-- Indexes for table `publisher`
--
ALTER TABLE `publisher`
ADD PRIMARY KEY (`publisherid`);

--
-- AUTO_INCREMENT for dumped tables
--

--
-- AUTO_INCREMENT for table `customers`
--
ALTER TABLE `customers`
MODIFY `customerid` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=9;

--

39
-- AUTO_INCREMENT for table `orders`
--
ALTER TABLE `orders`
MODIFY `orderid` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=10;

--
-- AUTO_INCREMENT for table `publisher`
--
ALTER TABLE `publisher`
MODIFY `publisherid` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=7;
COMMIT;

➢ Index.php:-
<?php
session_start();
$count = 0;
// connecto database

$title = "Home";
require_once "./template/header.php";
require_once "./functions/database_functions.php";
$conn = db_connect();
$row = select4LatestBook($conn);
?>
<!-- Example row of columns -->
<div class="lead text-center text-dark fw-bolder h4">Latest books</div>
<center>
<hr class="bg-warning" style="width:5em;height:3px;opacity:1">
</center>
<div class="row">
<?php foreach($row as $book) { ?>
<div class="col-lg-3 col-md-4 col-sm-6 col-xs-12 py-2 mb-2">
<a href="book.php?bookisbn=<?php echo $book['book_isbn']; ?>" class="card rounded-0
shadow book-item text-reset text-decoration-none">
<div class="img-holder overflow-hidden">
<img class="img-top" src="./bootstrap/img/<?php echo $book['book_image']; ?>">
</div>

40
<div class="card-body">
<div class="card-title fw-bolder h5 text-center"><?= $book['book_title'] ?></div>
</div>
</a>
</div>
<?php } ?>
</div>
<?php
if(isset($conn)) {mysqli_close($conn);}
require_once "./template/footer.php";
?>

➢ Admin.php
<?php
session_start();
$count = 0;
// connecto database

$title = "Home";
require_once "./template/header.php";
require_once "./functions/database_functions.php";
$conn = db_connect();
$row = select4LatestBook($conn);
?>
<!-- Example row of columns -->
<div class="lead text-center text-dark fw-bolder h4">Latest books</div>
<center>
<hr class="bg-warning" style="width:5em;height:3px;opacity:1">
</center>
<div class="row">
<?php foreach($row as $book) { ?>
<div class="col-lg-3 col-md-4 col-sm-6 col-xs-12 py-2 mb-2">
<a href="book.php?bookisbn=<?php echo $book['book_isbn']; ?>" class="card rounded-0
shadow book-item text-reset text-decoration-none">
<div class="img-holder overflow-hidden">
<img class="img-top" src="./bootstrap/img/<?php echo $book['book_image']; ?>">
</div>
<div class="card-body">

41
<div class="card-title fw-bolder h5 text-center"><?= $book['book_title'] ?></div>
</div>
</a>
</div>
<?php } ?>
</div>
<?php
if(isset($conn)) {mysqli_close($conn);}
require_once "./template/footer.php";
?>

➢ Book.php:-
<?php
session_start();
$book_isbn = $_GET['bookisbn'];
// connecto database
require_once "./functions/database_functions.php";
$conn = db_connect();

$query = "SELECT * FROM books WHERE book_isbn = '$book_isbn'";


$result = mysqli_query($conn, $query);
if(!$result){
echo "Can't retrieve data " . mysqli_error($conn);
exit;
}

$row = mysqli_fetch_assoc($result);
if(!$row){
echo "Empty book";
exit;
}

$title = $row['book_title'];
require "./template/header.php";
?>
<!-- Example row of columns -->
<nav aria-label="breadcrumb">
<ol class="breadcrumb">

42
<li class="breadcrumb-item"><a href="books.php" class="text-decoration-none text-muted fw-
light">PublBooksishers</a></li>
<li class="breadcrumb-item active" aria-current="page"><?php echo $row['book_title']; ?></li>
</ol>
</nav>
<div class="row">
<div class="col-md-3 text-center book-item">
<div class="img-holder overflow-hidden">
<img class="img-top" src="./bootstrap/img/<?php echo $row['book_image']; ?>">
</div>
</div>
<div class="col-md-9">
<div class="card rounded-0 shadow">
<div class="card-body">
<div class="container-fluid">
<h4><?= $row['book_title'] ?></h4>
<hr>
<p><?php echo $row['book_descr']; ?></p>
<h4>Details</h4>
<table class="table">
<?php foreach($row as $key => $value){
if($key == "book_descr" || $key == "book_image" || $key == "publisherid" || $key ==
"book_title"){
continue;
}
switch($key){
case "book_isbn":
$key = "ISBN";
break;
case "book_title":
$key = "Title";
break;
case "book_author":
$key = "Author";
break;
case "book_price":
$key = "Price";

43
break;
}
?>
<tr>
<td><?php echo $key; ?></td>
<td><?php echo $value; ?></td>
</tr>
<?php
}
if(isset($conn)) {mysqli_close($conn); }
?>
</table>
<form method="post" action="cart.php">
<input type="hidden" name="bookisbn" value="<?php echo $book_isbn;?>">
<div class="text-center">
<input type="submit" value="Purchase / Add to cart" name="cart" class="btn btn-primary
rounded-0">
</div>
</form>
</div>
</div>
</div>
</div>
</div>
<?php
require "./template/footer.php";
?>

➢ Process.php:-
<?php
session_start();

$_SESSION['err'] = 1;
foreach($_POST as $key => $value){
if(trim($value) == ''){
$_SESSION['err'] = 0;
}
break;

44
}

if($_SESSION['err'] == 0){
header("Location: purchase.php");
} else {
unset($_SESSION['err']);
}

require_once "./functions/database_functions.php";
// print out header here
$title = "Purchase Process";
require "./template/header.php";
// connect database
$conn = db_connect();
extract($_SESSION['ship']);

// validate post section


$card_number = $_POST['card_number'];
$card_PID = $_POST['card_PID'];
$card_expire = strtotime($_POST['card_expire']);
$card_owner = $_POST['card_owner'];

// find customer
$customerid = getCustomerId($name, $address, $city, $zip_code, $country);
if($customerid == null) {
// insert customer into database and return customerid
$customerid = setCustomerId($name, $address, $city, $zip_code, $country);
}
$date = date("Y-m-d H:i:s");
insertIntoOrder($conn, $customerid, $_SESSION['total_price'], $date, $name, $address, $city,
$zip_code, $country);

// take orderid from order to insert order items


$orderid = getOrderId($conn, $customerid);

foreach($_SESSION['cart'] as $isbn => $qty){


$bookprice = getbookprice($isbn);

45
$query = "INSERT INTO order_items VALUES
('$orderid', '$isbn', '$bookprice', '$qty')";
$result = mysqli_query($conn, $query);
if(!$result){
echo "Insert value false!" . mysqli_error($conn2);
exit;
}
}

session_unset();
?>
<div class="alert alert-success rounded-0 my-4">Your order has been processed sucessfully. We'll
be reaching you out to confirm your order. Thanks!</div>

<?php
if(isset($conn)){
mysqli_close($conn);
}
require_once "./template/footer.php";
?>

➢ Cart.php:-
<?php
// the shopping cart needs sessions, to start one
/*
Array of session(
cart => array (
book_isbn (get from $_POST['book_isbn']) => number of books
),
items => 0,
total_price => '0.00'
)
*/
session_start();
require_once "./functions/database_functions.php";
require_once "./functions/cart_functions.php";

// book_isbn got from form post method, change this place later.
46
if(isset($_POST['bookisbn'])){
$book_isbn = $_POST['bookisbn'];
}

if(isset($book_isbn)){
// new iem selected
if(!isset($_SESSION['cart'])){
// $_SESSION['cart'] is associative array that bookisbn => qty
$_SESSION['cart'] = array();

$_SESSION['total_items'] = 0;
$_SESSION['total_price'] = '0.00';
}

if(!isset($_SESSION['cart'][$book_isbn])){
$_SESSION['cart'][$book_isbn] = 1;
} elseif(isset($_POST['cart'])){
$_SESSION['cart'][$book_isbn]++;
unset($_POST);
}
}

// if save change button is clicked , change the qty of each bookisbn


if(isset($_POST['save_change'])){
foreach($_SESSION['cart'] as $isbn =>$qty){
if($_POST[$isbn] == '0'){
unset($_SESSION['cart']["$isbn"]);
} else {
$_SESSION['cart']["$isbn"] = $_POST["$isbn"];
}
}
}

// print out header here


$title = "Your shopping cart";
require "./template/header.php";
?>

47
<h4 class="fw-bolder text-center">Cart List</h4>
<center>
<hr class="bg-warning" style="width:5em;height:3px;opacity:1">
</center>
<?php
if(isset($_SESSION['cart']) && (array_count_values($_SESSION['cart']))){
$_SESSION['total_price'] = total_price($_SESSION['cart']);
$_SESSION['total_items'] = total_items($_SESSION['cart']);
?>
<div class="card rounded-0 shadow">
<div class="card-body">
<div class="container-fluid">
<form action="cart.php" method="post" id="cart-form">
<table class="table">
<tr>
<th>Item</th>
<th>Price</th>
<th>Quantity</th>
<th>Total</th>
</tr>
<?php
foreach($_SESSION['cart'] as $isbn =>
$qty){
$conn = db_connect();
$book =
mysqli_fetch_assoc(getBookByIsbn($conn, $isbn));
?>
<tr>
<td><?php echo $book['book_title'] . " by " .
$book['book_author']; ?></td>
<td><?php echo "$" . $book['book_price'];
?></td>
<td><input type="text" value="<?php echo
$qty; ?>" size="2" name="<?php echo $isbn; ?>"></td>
<td><?php echo "$" . $qty *
$book['book_price']; ?></td>
</tr>

48
<?php } ?>
<tr>
<th>&nbsp;</th>
<th>&nbsp;</th>
<th><?php echo $_SESSION['total_items'];
?></th>
<th><?php echo "$" .
$_SESSION['total_price']; ?></th>
</tr>
</table>
</form>
</div>
</div>
<div class="card-footer text-end">
<input type="submit" class="btn btn-primary rounded-0" name="save_change"
value="Save Changes" form="cart-form">
<a href="checkout.php" class="btn btn-dark rounded-0">Go To Checkout</a>
<a href="books.php" class="btn btn-warning rounded-0">Continue
Shopping</a>

</div>
</div>

<?php
} else {
?>
<div class="alert alert-warning rounded-0">Your cart is empty! Please add atleast 1 book to purchase
first.</div>
<?php

}
if(isset($conn)){ mysqli_close($conn); }
require_once "./template/footer.php";
?>

49
➢ Checkout.php:-
<?php
// the shopping cart needs sessions, to start one
/*
Array of session(
cart => array (
book_isbn (get from $_GET['book_isbn']) => number of books
),
items => 0,
total_price => '0.00'
)
*/
session_start();
require_once "./functions/database_functions.php";
// print out header here
$title = "Checking out";
require "./template/header.php";
?>
<h4 class="fw-bolder text-center">Checkout</h4>
<center>
<hr class="bg-warning" style="width:5em;height:3px;opacity:1">
</center>
<?php
if(isset($_SESSION['cart']) && (array_count_values($_SESSION['cart']))){
?>
<div class="card rounded-0 shadow mb-3">
<div class="card-body">
<div class="container-fluid">
<table class="table">
<tr>
<th>Item</th>
<th>Price</th>
<th>Quantity</th>
<th>Total</th>
</tr>
<?php
foreach($_SESSION['cart'] as $isbn => $qty){

50
$conn = db_connect();
$book =
mysqli_fetch_assoc(getBookByIsbn($conn, $isbn));
?>
<tr>
<td><?php echo $book['book_title'] . " by " .
$book['book_author']; ?></td>
<td><?php echo "$" . $book['book_price']; ?></td>
<td><?php echo $qty; ?></td>
<td><?php echo "$" . $qty * $book['book_price']; ?></td>
</tr>
<?php } ?>
<tr>
<th>&nbsp;</th>
<th>&nbsp;</th>
<th><?php echo $_SESSION['total_items']; ?></th>
<th><?php echo "$" . $_SESSION['total_price']; ?></th>
</tr>
</table>
</div>
</div>
</div>
<div class="row justify-content-center">
<div class="col-lg-5 col-md-8 col-sm-10 col-xs-12">
<div class="card rounded-0 shadow">
<div class="card-header">
<div class="card-title h6 fw-bold">Please Fill the following
form</div>
</div>
<div class="card-body container-fluid">
<form method="post" action="purchase.php" class="form-
horizontal">
<?php if(isset($_SESSION['err']) &&
$_SESSION['err'] == 1){ ?>
<p class="text-danger">All fields have to be
filled</p>
<?php } ?>

51
<div class="mb-3">
<label for="name" class="control-
label">Name</label>
<input type="text" name="name"
class="form-control rounded-0">
</div>
<div class="mb-3">
<label for="address" class="control-
label">Address</label>
<input type="text" name="address"
class="form-control rounded-0">
</div>
<div class="mb-3">
<label for="city" class="control-
label">City</label>
<input type="text" name="city"
class="form-control rounded-0">
</div>
<div class="mb-3">
<label for="zip_code" class="control-
label">Zip Code</label>
<input type="text" name="zip_code"
class="form-control rounded-0">
</div>
<div class="mb-3">
<label for="country" class="control-
label">Country</label>
<input type="text" name="country"
class="form-control rounded-0">
</div>
<div class="mb-3 d-grid">
<input type="submit" name="submit"
value="Purchase" class="btn btn-primary rounded-0">
</div>
</form>

52
<p class="fw-light fst-italic"><small class="text-
muted">Please press Purchase to confirm your purchase, or Continue Shopping to add or remove
items.</small></p>
</div>
</div>
</div>
</div>

<?php
} else {
echo "<p class=\"text-warning\">Your cart is empty! Please make sure you add some books
in it!</p>";
}
if(isset($conn)){ mysqli_close($conn); }
require_once "./template/footer.php";
?>

➢ Publisher-list.php:-
<?php
session_start();
require_once "./functions/database_functions.php";
$conn = db_connect();

$query = "SELECT * FROM publisher ORDER BY publisherid";


$result = mysqli_query($conn, $query);
if(!$result){
echo "Can't retrieve data " . mysqli_error($conn);
exit;
}
if(mysqli_num_rows($result) == 0){
echo "Empty publisher ! Something wrong! check again";
exit;
}

$title = "List Of Publishers";


require "./template/header.php";
?>
<div class="h5 fw-bolder text-center">List of Publisher</div>

53
<hr>
<div class="list-group">
<a class="list-group-item list-group-item-action" href="books.php">
List of All Books
</a>
<?php
while($row = mysqli_fetch_assoc($result)){
$count = 0;
$query = "SELECT publisherid FROM books";
$result2 = mysqli_query($conn, $query);
if(!$result2){
echo "Can't retrieve data " . mysqli_error($conn);
exit;
}
while ($pubInBook = mysqli_fetch_assoc($result2)){
if($pubInBook['publisherid'] == $row['publisherid']){
$count++;
}
}
?>
<a class="list-group-item list-group-item-action" href="bookPerPub.php?pubid=<?php
echo $row['publisherid']; ?>">
<span class="badge badge-primary bg-primary rounded-pill"><?php echo
$count; ?></span>
<?php echo $row['publisher_name']; ?>
</a>
<?php } ?>
</div>
<?php
mysqli_close($conn);
require "./template/footer.php";
?>

54
➢ Edit-book.php:-
<?php
// if save change happen
if(!isset($_POST['save_change'])){
echo "Something wrong!";
exit;
}

$isbn = trim($_POST['isbn']);
$title = trim($_POST['title']);
$author = trim($_POST['author']);
$descr = trim($_POST['descr']);
$price = floatval(trim($_POST['price']));
$publisher = trim($_POST['publisher']);

if(isset($_FILES['image']) && $_FILES['image']['name'] != ""){


$image = $_FILES['image']['name'];
$directory_self = str_replace(basename($_SERVER['PHP_SELF']), '',
$_SERVER['PHP_SELF']);
$uploadDirectory = $_SERVER['DOCUMENT_ROOT'] . $directory_self .
"bootstrap/img/";
$uploadDirectory .= $image;
move_uploaded_file($_FILES['image']['tmp_name'], $uploadDirectory);
}

require_once("./functions/database_functions.php");
$conn = db_connect();

// if publisher is not in db, create new


$findPub = "SELECT * FROM publisher WHERE publisher_name = '$publisher'";
$findResult = mysqli_query($conn, $findPub);
if(!$findResult){
// insert into publisher table and return id
$insertPub = "INSERT INTO publisher(publisher_name) VALUES ('$publisher')";
$insertResult = mysqli_query($conn, $insertPub);
if(!$insertResult){
echo "Can't add new publisher " . mysqli_error($conn);

55
exit;
}
}

$query = "UPDATE books SET


book_title = '$title',
book_author = '$author',
book_descr = '$descr',
book_price = '$price'";
if(isset($image)){
$query .= ", book_image='$image' WHERE book_isbn = '$isbn'";
} else {
$query .= " WHERE book_isbn = '$isbn'";
}
// two cases for fie , if file submit is on => change a lot
$result = mysqli_query($conn, $query);
if(!$result){
echo "Can't update data " . mysqli_error($conn);
exit;
} else {
header("Location: admin_edit.php?bookisbn=$isbn");
}
?>

➢ Database Connection:-
<?php
function db_connect(){
$conn = mysqli_connect("localhost", "root", "", "obs_db");
if(!$conn){
echo "Can't connect database " . mysqli_connect_error($conn);
exit;
}
return $conn;
}

function select4LatestBook($conn){
$row = array();

56
$query = "SELECT book_isbn, book_image, book_title FROM books ORDER BY
abs(unix_timestamp(created_at)) DESC";
$result = mysqli_query($conn, $query);
if(!$result){
echo "Can't retrieve data " . mysqli_error($conn);
exit;
}
for($i = 0; $i < 4; $i++){
array_push($row, mysqli_fetch_assoc($result));
}
return $row;
}

function getBookByIsbn($conn, $isbn){


$query = "SELECT book_title, book_author, book_price FROM books WHERE
book_isbn = '$isbn'";
$result = mysqli_query($conn, $query);
if(!$result){
echo "Can't retrieve data " . mysqli_error($conn);
exit;
}
return $result;
}

function getOrderId($conn, $customerid){


$query = "SELECT orderid FROM orders WHERE customerid = '$customerid'";
$result = mysqli_query($conn, $query);
if(!$result){
echo "retrieve data failed!" . mysqli_error($conn);
exit;
}
$row = mysqli_fetch_assoc($result);
return $row['orderid'];
}

function insertIntoOrder($conn, $customerid, $total_price, $date, $ship_name, $ship_address,


$ship_city, $ship_zip_code, $ship_country){

57
$query = "INSERT INTO orders VALUES
('', '" . $customerid . "', '" . $total_price . "', '" . $date . "', '" . $ship_name . "', '" .
$ship_address . "', '" . $ship_city . "', '" . $ship_zip_code . "', '" . $ship_country . "')";
$result = mysqli_query($conn, $query);
if(!$result){
echo "Insert orders failed " . mysqli_error($conn);
exit;
}
}

function getbookprice($isbn){
$conn = db_connect();
$query = "SELECT book_price FROM books WHERE book_isbn = '$isbn'";
$result = mysqli_query($conn, $query);
if(!$result){
echo "get book price failed! " . mysqli_error($conn);
exit;
}
$row = mysqli_fetch_assoc($result);
return $row['book_price'];
}

function getCustomerId($name, $address, $city, $zip_code, $country){


$conn = db_connect();
$query = "SELECT customerid from customers WHERE
`name` = '$name' AND
`address`= '$address' AND
city = '$city' AND
zip_code = '$zip_code' AND
country = '$country'";
$result = mysqli_query($conn, $query);
// if there is customer in db, take it out
if($result->num_rows > 0){
$row = mysqli_fetch_assoc($result);
return $row['customerid'];
} else {
return null;

58
}
}

function setCustomerId($name, $address, $city, $zip_code, $country){


$conn = db_connect();
$query = "INSERT INTO customers VALUES
('', '" . $name . "', '" . $address . "', '" . $city . "', '" . $zip_code . "', '" . $country .
"')";

$result = mysqli_query($conn, $query);


if(!$result){
echo "insert false !" . mysqli_error($conn);
exit;
}
$customerid = mysqli_insert_id($conn);
return $customerid;
}

function getPubName($conn, $pubid){


$query = "SELECT publisher_name FROM publisher WHERE publisherid = '$pubid'";
$result = mysqli_query($conn, $query);
if(!$result){
echo "Can't retrieve data " . mysqli_error($conn);
exit;
}
if(mysqli_num_rows($result) == 0){
echo "Empty books ! Something wrong! check again";
exit;
}

$row = mysqli_fetch_assoc($result);
return $row['publisher_name'];
}

function getAll($conn){
$query = "SELECT * from books ORDER BY book_isbn DESC";
$result = mysqli_query($conn, $query);

59
if(!$result){
echo "Can't retrieve data " . mysqli_error($conn);
exit;
}
return $result;
}
?>

➢ Address.php:-
<?php

spl_autoload_register(function ($class){
$arr=['goods','interfaces','orders','reviews','serve'];
foreach ($arr as $val) {
$path=__DIR__."/../$val/$class.php";
if (file_exists($path))
require_once $path;
}
});

class Address
{
private $country;
private $city;
private $street;
private $buildNo;

/**
* Address constructor.
* @param $country
* @param $city
* @param $street
* @param $buildNo
*/
public function __construct($country, $city, $street, $buildNo)
{
$this->country = $country;

60
$this->city = $city;
$this->street = $street;
$this->buildNo = $buildNo;
}

/**
* @return mixed
*/
public function getCountry ()
{
return $this->country;
}

/**
* @return mixed
*/
public function getCity ()
{
return $this->city;
}

/**
* @return mixed
*/
public function getStreet ()
{
return $this->street;
}

/**
* @return mixed
*/
public function getBuildNo ()
{
return $this->buildNo;
}

61
public function __toString ()
{
return<<<EOD
the country is $this->country , city is $this->city, street is $this->street and build NO is
$this->buildNo
EOD;

}
}

➢ Style.css:-
.book-item .img-holder {
width: 100%;
height: 25em;
}

.book-item .img-holder>img.img-top {
width: 100%;
height: 100%;
object-fit: cover;
object-position: center center;
transition: all .2s ease-in-out;
}

.book-item:hover .img-holder>img.img-top {
transform: scale(1.2);
}

.truncate-5 {
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 5;
-webkit-box-orient: vertical;
}

62
➢ Header.php:-
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">

<title><?php echo $title; ?></title>

<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.1.1/css/all.min.css"


integrity="sha512-
KfkfwYDsLkIlwQp6LFnl8zNdLGxu9YAA1QvwINks4PhcElQSvqcyVLLD9aMhXd13uQjoXtEKNosOW
aZqXgel0g==" crossorigin="anonymous" referrerpolicy="no-referrer" />

<link href="./bootstrap/css/bootstrap.min.css" rel="stylesheet">


<link href="./bootstrap/css/styles.css" rel="stylesheet">
<!-- Bootstrap core JavaScript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<script type="text/javascript" src="./bootstrap/js/jquery-3.6.0.min.js"></script>
<script type="text/javascript" src="./bootstrap/js/bootstrap.bundle.min.js"></script>
</head>

<body>
<div class="clear-fix pt-5 pb-3"></div>
<nav class="navbar navbar-expand-lg navbar-expand-md navbar-light bg-warning bg-gradient fixed-
top">
<div class="container">
<div class="navbar-header">
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#topNav"
aria-controls="topNav" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<a class="navbar-brand" href="index.php">Simple Online Book Store</a>
</div>

63
<!--/.navbar-collapse -->
<div class="collapse navbar-collapse" id="topNav">
<ul class="nav navbar-nav">
<?php if(isset($_SESSION['admin']) && $_SESSION['admin'] == true): ?>
<li class="nav-item"><a class="nav-link" href="admin_book.php"><span class="fa fa-th-
list"></span> Book List</a></li>
<li class="nav-item"><a class="nav-link" href="admin_add.php"><span class="far fa-plus-
square"></span> Add New Book</a></li>
<li class="nav-item"><a class="nav-link" href="admin_signout.php"><span class="fa fa-sign-
out-alt"></span> Logout</a></li>
<?php else: ?>
<!-- link to publiser_list.php -->
<li class="nav-item"><a class="nav-link" href="publisher_list.php"><span class="fa fa-
paperclip"></span> Publisher</a></li>
<!-- link to books.php -->
<li class="nav-item"><a class="nav-link" href="books.php"><span class="fa fa-book"></span>
Books</a></li>
<!-- link to shopping cart -->
<li class="nav-item"><a class="nav-link" href="cart.php"><span class="fa fa-shopping-
cart"></span> My Cart</a></li>
<?php endif; ?>
</ul>
</div>
</div>
</nav>
<?php
if(isset($title) && $title == "Home") {
?>
<!-- Main jumbotron for a primary marketing message or call to action -->
<div class="container">
<h1>Welcome to Simple Online Book Store</h1>
<hr>
</div>
<?php } ?>
<div class="container" id="main">

➢ Footer.php:-
64
<hr>

<footer class="fixed-bottom bg-light bg-gradient border py-3 px-2">


<div class="container">
<div class="d-flex justify-content-between">
<div class="">
<a href="https://sourcecodester.com" target="_blank"
class="text-decoration-none text-muted fw-bold"> Simple Online Book Stores Site &copy; <?= date('Y') ?>
</a>
</div>
<div class="">
<a href="admin.php" class="text-decoration-none
text-dark fw-bolder">Login as Admin</a>
</div>
</div>
</div>
</footer>
<div class="clear-fix py-4"></div>
</div> <!-- /container -->

</body>
</html>

➢ Cart-function.php:-

<?php

/*

loop through array of $_SESSION['cart'][book_isbn] => number

get isbn => take from database => take book price

price * number (quantity)

return sum of price

*/

function total_price($cart){

$price = 0.0;

65
if(is_array($cart)){

foreach($cart as $isbn => $qty){

$bookprice = getbookprice($isbn);

if($bookprice){

$price += $bookprice * $qty;

return $price;

/*

loop through array of $_SESSION['cart'][book_isbn] => number

$_SESSION['cart'] is associative array which is [book_isbn] => number of books for each book_isbn

calculate sum of books

*/

function total_items($cart){

$items = 0;

if(is_array($cart)){

foreach($cart as $isbn => $qty){

$items += $qty;

return $items;

?>

66
➢ Mysql:-

67
Book Details:-

Customer Details:-

Orders:-

68
Chapter 7: FUTURE WORK

Online shopping has gained importance not only from the standpoint of the entrepreneur, but also
from the standpoint of the customer, since the Internet has become a vital resource in modern
business. Electronic shopping opens up new business prospects for the entrepreneur, and it allows
customers to compare prices. According to a report, most online shoppers are impulsive and decide
whether or not to stay on a site within the first few seconds. "Website design is similar to the
interior design of a store." If the shop appears to be run-down or similar to hundreds of other shops,
the customer is likely to move on to the next site." As a result, I created the project to give the user
as much ease of navigation, data retrieval, and essential feedback as possible. The user is given
with an ecommerce web site that can be utilized to purchase books online in this project.

I utilized PHP to make this a web application. PHP (XAMPP) has a number of advantages,
including improved performance, scalability, security, and simplicity. To create a web application
with PHP, I'll need a programming language like JAVA, HTML, or anything similar. The language
used to develop this application was JAVA. PHP connects with the database using the MySQL
server because it offers in-memory caching, which reduces the need to visit the database server
frequently, and it is simple to deploy and manage. MySQL was chosen as the back-end database
because it is one of the most widely used open-source databases, with rapid data access, ease of
installation, and simplicity.

❖ Recommendation for Future Work

Software development is a never-ending process that maintains the software's life based on the
changing needs of the user throughout time. The project will undoubtedly be designed with easy
modification and enhancement in mind, which may be required from time to time. This project, on
the other hand, can be modified in a variety of ways. Because of limited a time frame, I am unable
to incorporate many things here. But I will attempt to cover all of the existing system that the
Online Book Store should consist.

During the development phase, various improvements were found that would be considered in
future versions of the Web-Based Online Book Store System:

69
• Introduce the Barcode System
Adding an effective Bar Cord Reader helps to improve data capture reliability at the
operational level. The accuracy of data entry for sales and purchasing activities can be
improved by employing system-generated barcodes for items' SKUs.
• To manage the business in the future, integrate application and back-office operations
connected to the technology of the existing website and internal system as Enterprise
Resource Planning (ERP).

• Provide an SMS service when orders are processed and for special jobs. By implementing
this recommendation, users will be able to acquire relevant information from the system
without having to enter the system or their email account.
• As the Intranet deals with a considerable amount of sensitive information, improve security
by putting in a standardized Firewall and Gateways methods to tighten security even more.
• Obtain an SSL Certificate to ensure that all transactions are conducted over a secure
channel using https.
• Make plans to secure an Intellectual Property (IPR) for the company's website.

6.3 Lessons Learnt

As a student participating in a degree program, this was a fantastic opportunity for me to put what
I had learned in class into practice. Because the domain area was so extensive, it allowed me to get
experience in a variety of business strategies and broadened my understanding of how to map
connected business operations into a computerized system. It also gives me an excellent
opportunity to put everything I've learned into practice. The creation of the Web-Based Online
Book Store System helps in gaining valuable knowledge in system development throughout the
SDLC.

70
Various software engineering approaches, such as requirement collecting techniques, OOD
techniques, and designing systems using UML, are practiced during the analysis and design phases,
which will be useful in my future job. This phase also assists me in improving my knowledge of
PHP, AJAX, JQuery, and other programming languages. The evaluation phase provided a great
opportunity for me to practice evaluating systems, particularly on the user side. A better
understanding of how to communicate with a real customer was gained. In addition, the working
environment included web-related languages.

71
OUTPUT SCREENSHOT

View purchases / orders

72
Add new book

Complete purchase order


73
Edit book

74
75
76
XAMPP

77
Conclusion

Online shopping has gained importance not only from the standpoint of the entrepreneur, but also
from the standpoint of the customer, since the Internet has become a vital resource in modern
business. Electronic shopping opens up new business prospects for the entrepreneur, and it allows
customers to compare prices. According to a report, most online shoppers are impulsive and decide
whether or not to stay on a site within the first few seconds. "Website design is similar to the
interior design of a store." If the shop appears to be run-down or similar to hundreds of other shops,
the customer is likely to move on to the next site." As a result, I created the project to give the user
as much ease of navigation, data retrieval, and essential feedback as possible. The user is given
with an ecommerce web site that can be utilized to purchase books online in this project.

I utilized PHP to make this a web application. PHP (XAMPP) has a number of advantages,
including improved performance, scalability, security, and simplicity. To create a web application
with PHP, I'll need a programming language like JAVA, HTML, or anything similar. The language
used to develop this application was JAVA. PHP connects with the database using the MySQL
server because it offers in-memory caching, which reduces the need to visit the database server
frequently, and it is simple to deploy and manage. MySQL was chosen as the back-end database
because it is one of the most widely used open-source databases, with rapid data access, ease of
installation, and simplicity.

A user-friendly shopping cart functionality must match a solid shopping cart design. Viewing the
contents of the customer's cart and being able to remove or add items to the cart should be easy.

This project's shopping cart application includes a variety of features aimed at making the
customer's experience more pleasant. This project will help me understand how to make an
interactive web page and the tools that go into making it. The project's architecture, which contains
a Data Model and a Process Model, shows how the database is constructed with various tables, as
well as how data is accessed and processed from the tables. The project's development has provided
me a thorough understanding of how

PHP is utilized to develop a website, how it connects to a database to obtain data, and how the data
and web pages are modified to provide a shopping cart application to the user.
78
REFERENCES

➢ L. T. T. Tran (2021, January). Managing the effectiveness of e-commerce platforms in a


pandemic.
https://www.sciencedirect.com/science/article/pii/S0969698920312959

➢ Essay Sauce (2019, August). Analyze the website requirements both functional and
nonfunctional of the XYZ bookstore.
https://www.essaysauce.com/information-technology-essays/analyze-the-websiterequirements-
both-functional-and-non-functional-of-the-xyz-bookstore/

➢ Shirley R. (2009, April). The System Development Life Cycle (SDLC).


https://csrc.nist.gov/csrc/media/publications/shared/documents/itl-bulletin/itlbul200904.pdf

➢ Gaurav K. (2012, August). Impact of Agile Methodology on Software Development


Process.
https://www.researchgate.net/profile/Gaurav-Kumar-
175/publication/255707851_Impact_of_Agile_Methodology_on_Software_Developmen
t_Process/links/00b49520489442e12d000000/Impact-of-Agile-Methodology-onSoftware-
Development-Process.pdf

➢ Verma A. (2017, November). A Comparative Study of Black Box Testing and White Box
Testing.
https://www.researchgate.net/profile/Sarika-
Chaudhary/publication/325816726_A_Comparative_Study_of_Black_Box_Testing_and_
White_Box_Testing/links/5d289f29458515c11c2a99b6/A-Comparative-Study-of-Black-
Box-Testing-and-White-Box-Testing.pdf

79
➢ Leonidio, U. da C., Montezano, R. M. da S., Carvalho, F. A. de (2017, November).
Evaluation of Perceived Quality of The Website of An Online Bookstore: An Empirical
Application of The Barnes and Vidgen Model.
https://www.scielo.br/j/jistm/a/cHf5LJhTf7sQnByJn5zgSPp/?format=pdf&lang=en

➢ Huang, L. C. (2017, November). Customer Relationship Management (CRM) in


Businessto-Business(B2B)e-commerce.
https://www.emerald.com/insight/content/doi/10.1108/IntR-05-2016-0142/full/html

➢ Hsu, C.L., Wu, C.C. and Chen, M.C. (2013, April). How social shopping retain customers?
Capturing the essence of website quality and relationship quality
https://www.researchgate.net/publication/299442291_How_social_shopping_retain_c
ustomers_Capturing_the_essence_of_website_quality_and_relationship_quality

80
81

You might also like