0% found this document useful (0 votes)
59 views94 pages

Om Final

final year coffee web

Uploaded by

sudhirwadekar93
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
59 views94 pages

Om Final

final year coffee web

Uploaded by

sudhirwadekar93
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

ACADEMIC YEAR 2023 – 2024

DEPARTMENT OF COMPUTER
ENGINEERING

“GROCERY WEBSITE”

GUIDED BY
Prof. Pranita Awari

SUBMITTED BY

Om Painjane
Sudhir Wadekar
Shreyash Tukrul
MAHARASHTRA STATE BOARD
OF TECHNICAL EDUCATION

CERTIFICATE
This is to certify the following students of final year semester of Diploma in “Computer
Engineering” of Institute, Viva college of Diploma Engineering and Technology (1508)
have carried out the project entitled in academic year 2023 – 2024

“GROCERY WEBSITE”
GROUP MEMBERS
62 – Om Painjane
65 – Sudhir Wadekar
70 – Shreyash Tukrul

This Project has been Approved for the Final Semester


in “COMPUTER ENGINEERING”

Project Guide H. O. D Principal


Miss. Pranita Awari Miss. Poonam Jadhav Mr. Surendra Ghatol

(Internal Examiner) (External Examiner)


ACKNOWLEDGEMENT

Before presenting our project work entitled Grocery Website, we would like to convey
our sincere thanks to the people who guided us throughout the course of this project
work.
First, we would like to express our sincere thanks to our beloved Principal
Mr. Surendra D. Ghatol for providing various facilities to carry out this
report.

We would like to express our immense gratitude towards our Project Guide
Miss. Pranita Awari for the constant encouragement, support, guidance, and mentoring
at the ongoing stages of the project and report.

We would like to express our sincere thanks to our H.O.D. Miss. Poonam Jadhav, for
the encouragement, co-operation, and suggestions progressing stages of the report.

Finally, we would like to thank all the teaching and non-teaching staff of the college,
and our friends, for their moral support rendered during the course of the reported work,
and for their direct and indirect involvement in the completion of our report work, which
made our endeavor fruitful.
ABSTRACT

Our project is a website which is an online grocery store. The Internet has made all of our
lives easier. You can do almost anything online anymore, including purchasing your
groceries. A lot of people have come to prefer buying their groceries online today. This
website allows users to buy groceries online which are needed in day-to-day life. This
includes fruits, vegetables, pulses, household etc. This is a user-friendly website in which
customers can view the item and the price of the item it is buying. Whenever you
purchase your groceries online you will be able to shop any time of the day or night, at
your convenience, regardless of what the weather outside may be, and still get everything
that you need and want.

The purpose of an online grocery ordering system is to automate the existing manual
system with the help of computerized equipment and fully-fledged computer software
fulfilling their requirement so that their value data/information can be stored for a longer
period with easy accessing and manipulation of the same required software and hardware
are easily available and work to work on. The languages we have used to develop our
project are HTML, CSS, and Javascript and for the backend, we have used MySQL and
PHP.
INDEX

Sr. No. Chapter Name Page No.


1 Introduction 1
1.1 Project Overview 2
1.2 Project Specification 3
1.3 Project Structure 5
1.4 Aim and Objective 7
2 Literature Survey 8
2.1 Literature Review of the Project 8
2.2 Systematic Literature Review 9
2.3 Further Work 11
3 Scope of the Project 12
4 Methodology 14
4.1 Propose Method 14
4.2 Block Diagram and Block Diagram Explanation 16
4.2.1 Block Diagram 16
4.2.2 Block Diagram Explanation 17
4.3 Software and Hardware Requirements 19
4.3.1 Software Requirements 19
4.3.2 Hardware Requirements 20
4.3.3 Languages used 21
4.3.3.1 Front-end 22
4.3.3.2 Back-end 25
5 Details of Design, Working, and Processes 27
5.1 Designing Process 27
5.2 Use Case Diagram 28
5.3 ER Diagram 29
5.4 DFD Diagram 30
5.5 Algorithm and Flowchart 31
5.5.1 Algorithm 31
5.5.2 Flowchart 33
5.6 Project Source Code 35
6 Results and Applications 80
6.1 Output 80
6.4 Application of Digital Voting System 83
7 Conclusion and Future Scope 85
7.1 Conclusion 85
7.2 Future Scope 86
8 References and Bibliography 87
Chapter 1: Introduction

A grocery website is an online store that lets clients buy food and other household
necessities while relaxing in their own homes. These websites often provide a wide range
of goods, such as fresh fruit, fresh vegetables, and household. Customers can browse the
different categories, perform a search for particular goods, and then add those goods to
their virtual shopping basket. After that, they can use a safe online payment method to
check out and pay for their products.
The advantages of supermarket websites over conventional brick-and-mortar stores are
numerous. They mostly provide convenience. Customers don't need to leave their homes
to shop for groceries; they may do so from anywhere, at any time of the day or night.
Those who are time-constrained, old, or incapacitated will find this very helpful.
Grocery websites frequently have a larger assortment of products than physical stores, in
addition to being more convenient. They have access to a wide range of local and
worldwide vendors and may frequently provide specialty or difficult-to-find items.
Finally, because they have lower overhead costs than traditional stores, grocery websites
frequently offer competitive prices and discounts. Additionally, they might provide free
delivery or pick-up services, which can lower the price and hassle of grocery shopping.
Overall, a grocery website is a practical and simple option for modern consumers seeking
a quick and stress-free way to buy food and other necessities.

VIVA COLLEGE OF DIPLOMA ENGG & TECH, COMPUTER 1


ENGG.
1.1 Project Overview

"Grocery Gurus" is set to redefine the grocery shopping experience by offering an


innovative online platform where customers can effortlessly purchase food and household
necessities from the comfort of their homes. With an extensive selection of products
ranging from fresh produce to specialty items, "Grocery Gurus" aims to provide
convenience, affordability, and quality service to modern consumers.

The primary objective of the "Grocery Gurus" project is to develop a user-friendly and
intuitive website interface that simplifies the shopping process. Customers will have the
ability to browse different categories, perform searches for specific items, and add
products to their virtual shopping cart seamlessly. Integration of secure online payment
methods will ensure safe transactions, while partnerships with local and global vendors
will enable access to a diverse range of products.

The "Grocery Gurus" website will offer a range of key features designed to enhance the
shopping experience. These include a comprehensive product catalog with a wide variety
of options, robust search and filtering functionalities for easy navigation, and a secure
checkout process. The platform will also provide flexible delivery options, including free
delivery or pick-up services, to cater to the diverse needs of customers. Additionally,
regular promotions, discounts, and loyalty programs will be implemented to provide
added value to shoppers.

VIVA COLLEGE OF DIPLOMA ENGG & TECH, COMPUTER 2


ENGG.
1.2 Project Specification:

1. User-Friendly Platform:
- Ensure easy navigation and search for products.
- Streamline the ordering process for hassle-free shopping.
- Prioritize mobile responsiveness for accessibility.

2. Wide Range of Products:


- Offer diverse products including fresh produce, pantry staples, and household items.
- Organize products into clear categories for easy browsing.

3. Personalized Recommendations:
- Utilize customer data for tailored product suggestions.
- Display recommendations prominently to encourage additional sales.

4. Efficient Inventory Management:


- Implement real-time inventory tracking to prevent out-of-stock orders.
- Utilize automated alerts for low stock levels and restocking needs.

Technical Considerations:
- Frontend: HTML5, CSS3, JavaScript (React.js)
- Backend: Node.js, Express.js
- Database: MongoDB
- Payment Gateway: Stripe, PayPal
- Security Measures: SSL encryption, secure authentication.

VIVA COLLEGE OF DIPLOMA ENGG & TECH, COMPUTER 3


ENGG.
Compliance and Regulations:
- Ensure compliance with e-commerce and data protection laws.
- Provide accessible legal documents like Terms of Service and Privacy Policy.

Testing and Deployment:


- Conduct thorough testing including unit, integration, and user acceptance testing.
- Follow a phased deployment approach with regular updates and maintenance.

VIVA COLLEGE OF DIPLOMA ENGG & TECH, COMPUTER 4


ENGG.
1.3 Project Structure:

The project structure for a software system adhering to Unified Modeling Language
(UML) principles encompasses various directories and files to organize the codebase
effectively.

Within the src directory, components are categorized based on different views of the
system as outlined by UML. The User Model View directory contains components
representing the system from the users' perspective, including features like user
dashboard, profile management, and preferences. In contrast, the Structural Model View
directory focuses on data and functionality within the system, containing components
related to static structures such as product listings, shopping cart management, and
product details. Finally, the Behavioural Model View directory captures the dynamic
interactions within the system, comprising components that depict user actions, product
interactions, and the checkout process.

The services directory hosts service files responsible for handling backend logic and
integrating with external APIs or databases. These services include user service, product
service, and checkout service, among others. The utils directory contains utility functions
and helpers used throughout the codebase for tasks like data validation and formatting.

In the public directory, static assets like images and favicon.ico are stored, along with the
main index.html file serving as the entry point for the web application.

The server directory houses backend server-related files, including controllers, models,
routes, middleware, configuration, and the main server file. These files handle server-side
logic, database interactions, and routing for API endpoints.

VIVA COLLEGE OF DIPLOMA ENGG & TECH, COMPUTER 5


ENGG.
Test cases and suites are organized within the tests directory, with subdirectories for unit
tests, integration tests, and end-to-end tests.

Documentation and project guides are stored in the docs directory, with markdown files
providing user guides, API references, and deployment instructions.

Configuration files, such as database configuration, API endpoint configuration, and


constants, reside in the config directory.

Automation scripts for tasks like starting the development server, building the production
version, and running tests are located in the scripts directory.

VIVA COLLEGE OF DIPLOMA ENGG & TECH, COMPUTER 6


ENGG.
1.4 Aims and Objectives:

To develop an efficient and user-friendly online platform for purchasing groceries,


providing customers with a convenient and seamless shopping experience.

1. Enhance User Experience:


- Develop an intuitive and visually appealing interface for easy navigation.
- Ensure responsiveness across various devices for seamless browsing.

2. Expand Product Offerings:


- Curate a diverse product catalog, including fresh produce and household essentials.
- Regularly update inventory to meet customer demands and preferences.

3. Streamline Shopping Process:


- Implement a user-friendly search feature and efficient checkout process.
- Provide secure payment options and real-time updates on orders.

4. Ensure Data Security and Privacy:


- Employ robust security measures to protect customer information.
- Comply with data protection regulations to safeguard user privacy.

5. Provide Exceptional Customer Service:


- Offer multiple support channels for prompt assistance and issue resolution.
- Personalize the shopping experience with tailored recommendations.

6. Foster Community Engagement:


- Engage customers through promotions, loyalty programs, and social media
interactions.

VIVA COLLEGE OF DIPLOMA ENGG & TECH, COMPUTER 7


ENGG.
- Support community initiatives to build trust and loyalty among customers.

Chapter 2: Literature Survey

2.1 Literature Review of the Project:

A literature survey is an essential component of any research project, including the


development of a Grocery website. The purpose of the literature survey is to identify and
analyze relevant academic and industry publications related to the development, design,
and implementation of grocery websites. The literature survey will help to identify the
best practices, common challenges, and emerging trends in Grocery development. It will
provide insights into the most effective strategies and tools for creating an engaging and
user-friendly website that meets the needs of both product and customer.
Some of the key areas that will be covered in the literature survey include website
design, usability, search engine optimization, mobile optimization, security, data
management, and user experience. The survey will also examine case studies of
successful grocery websites, analyzing their features and functionalities to identify the
elements that contribute to their success.
Overall, the literature survey is a critical step in the development of a Grocery website,
providing valuable insights into the best practices and strategies that can be used to create
a successful online platform for buying products. A literature survey of a grocery website
would involve researching and analyzing the existing literature, research papers, and case
studies related to real estate websites. The goal of the literature survey would be to gain
insights into the latest trends, features, and technologies used in grocery websites, which
can help in making the website more competitive and user-friendly.

VIVA COLLEGE OF DIPLOMA ENGG & TECH, COMPUTER 8


ENGG.
2.2 Systematic Literature Review:

The development of a grocery website requires a comprehensive understanding of best


practices, challenges, and emerging trends in website design, usability, optimization,
security, data management, and user experience. A systematic literature review is
conducted to analyze academic and industry publications related to the development,
design, and implementation of grocery websites. This review aims to identify key areas
of focus, successful case studies, and effective strategies for creating engaging and user-
friendly platforms for buying products online.

Methodology:
The literature search was conducted using academic databases, industry journals,
conference proceedings, and online repositories. Keywords such as "grocery website
development," "e-commerce best practices," "user experience," "search engine
optimization," "mobile optimization," "security," and "data management" were used to
identify relevant publications. Inclusion criteria included publications published within
the last five years, written in English, and focusing on topics directly related to grocery
website development.

The systematic literature review identified several key areas of focus in the development
of grocery websites. These include:
1. Website Design: Studies emphasized the importance of intuitive navigation, visually
appealing interfaces, and responsive design to enhance user experience and engagement.
2. Usability: Research highlighted the significance of user-centered design principles and
usability testing to optimize website functionality and ease of use.

VIVA COLLEGE OF DIPLOMA ENGG & TECH, COMPUTER 9


ENGG.
3. Search Engine Optimization (SEO): Publications discussed strategies for improving
search engine rankings, such as keyword optimization, content relevance, and link
building.
4. Mobile Optimization: Studies emphasized the need for mobile-friendly design and
responsive layouts to accommodate users accessing the website from smartphones and
tablets.
5. Security: Research addressed security concerns such as data encryption, secure
payment gateways, and protection against cyber threats to ensure customer trust and
confidentiality.
6. Data Management: Publications discussed data collection, storage, and analysis
techniques to leverage customer insights for personalized marketing and product
recommendations.
7. User Experience (UX): Studies emphasized the importance of intuitive interfaces,
streamlined checkout processes, and personalized recommendations to enhance user
satisfaction and loyalty.

Case Studies:
Analysis of successful grocery websites revealed common features and functionalities
contributing to their success. These include:
- Comprehensive product catalogs with detailed descriptions and images.
- Advanced search and filtering options for easy product discovery.
- Seamless checkout processes with multiple payment options and secure transactions.
- Integration with third-party logistics providers for efficient order fulfillment and
delivery.
- Personalized user accounts with order history, preferences, and recommendations.

VIVA COLLEGE OF DIPLOMA ENGG & TECH, COMPUTER 10


ENGG.
2.3 Further Work:

1. Usability Testing:
Conduct comprehensive usability testing with target users to evaluate the
effectiveness of the website design and functionality. Gather feedback to identify
areas for improvement and refine the user experience.

2. Continuous Optimization:
Implement a strategy for ongoing optimization, focusing on areas such as SEO,
mobile responsiveness, security enhancements, and overall performance
improvements to ensure the website remains competitive and up-to-date.

3. Integration of Advanced Technologies:


Explore the integration of advanced technologies such as AI-driven personalization,
chatbots for customer support, and AR for immersive product experiences to enhance
engagement and user satisfaction.

4. Expansion of Product Offerings:


Diversify the product catalog to include a broader range of items, including specialty
products, organic options, and locally sourced goods, to cater to diverse customer
preferences and increase market reach.

5. Data Analysis and Insights:

VIVA COLLEGE OF DIPLOMA ENGG & TECH, COMPUTER 11


ENGG.
Utilize data analytics tools to analyze customer behavior, purchase patterns, and
preferences. Use insights gained to optimize marketing strategies, improve product
offerings, and enhance overall customer satisfaction.

VIVA COLLEGE OF DIPLOMA ENGG & TECH, COMPUTER 12


ENGG.
Chapter 3: Scope of the Project

The project aims to develop a comprehensive grocery website that offers users a seamless
and efficient online shopping experience. This involves creating a fully functional
platform with features such as a well-organized product catalog, intuitive search
functionality, a user-friendly shopping cart, and a secure checkout process.

The design and user experience of the website will be carefully crafted to ensure ease of
navigation, visually appealing layouts, and responsiveness across various devices. Special
attention will be given to mobile optimization, ensuring that users can access and
navigate the website seamlessly from smartphones and tablets.

In addition to basic functionalities, the project will focus on implementing essential


security measures to protect user data and ensure secure transactions. This includes SSL
encryption, secure authentication methods, and compliance with industry standards such
as PCI DSS.

Payment gateway integration will be a crucial aspect of the project, enabling users to
make purchases using various payment methods securely. The website will also feature
user account management functionalities, allowing users to register, log in, manage their
profiles, view order history, and track shipments.

An efficient order management system will be developed to handle order processing,


generate invoices, manage order status updates, and facilitate communication with
customers regarding order fulfillment and delivery.

VIVA COLLEGE OF DIPLOMA ENGG & TECH, COMPUTER 13


ENGG.
Furthermore, the project will incorporate analytics tools to track website performance,
monitor user behavior, and generate reports for decision-making and optimization. The
website architecture will be designed to be scalable and flexible, allowing for future
growth and technological advancements.

Compliance with relevant regulations and legal considerations, such as GDPR and PCI
DSS, will be ensured throughout the development process to maintain data privacy and
consumer protection standards.

VIVA COLLEGE OF DIPLOMA ENGG & TECH, COMPUTER 14


ENGG.
Chapter 4: Methodology

4.1 Proposed Method:

1. Front-End Development:

- Utilize HTML, CSS, and JavaScript to design and develop the user interface (UI) of the
website.

- Focus on creating an intuitive and visually appealing layout with easy navigation for
browsing products.

2. Back-End Development:

- Use PHP for server-side scripting and MySQL for database management to handle
dynamic content and user data.

- Implement user authentication and session management functionalities to secure user


accounts.

3. Product Management:

- Develop a robust product management system to organize and display a wide range of
grocery items.

- Include features for adding, editing, and removing products, as well as managing
inventory and pricing.

4. Shopping Features:

- Enable users to browse products by categories, search for specific items, and add them
to a shopping cart.
VIVA COLLEGE OF DIPLOMA ENGG & TECH, COMPUTER 15
ENGG.
- Implement a secure checkout process with multiple payment options for seamless
transactions.

5. User Interaction:

- Incorporate interactive features such as user reviews, ratings, and recommendations to


enhance engagement.

- Provide a feedback mechanism for users to report issues, suggest improvements, and
share their shopping experience.

6. Testing and Quality Assurance:

- Conduct thorough testing, including functional testing, usability testing, and cross-
browser compatibility testing

- Address any issues or bugs identified during testing to ensure a smooth and error-free
user experience.

7. Deployment and Maintenance:

- Deploy the website to a reliable web hosting server and ensure continuous availability
and performance.

- Provide ongoing maintenance and support to address any issues, implement updates,
and enhance features based on user feedback and evolving requirements.

VIVA COLLEGE OF DIPLOMA ENGG & TECH, COMPUTER 16


ENGG.
4.2 Block Diagram and Block Diagram Explanation:

4.2.1 Block Diagram:

Request for login Request for registration


Online
ADMIN grocery
Website USER
Response Response

login
Add
Grocery product
User website

Registration

Search View
product product

VIVA COLLEGE OF DIPLOMA ENGG & TECH, COMPUTER 17


ENGG.
4.2.2 Block Diagram Explanation:
The block diagram illustrates the interactions between different entities in an online
grocery website system, specifically focusing on the processes of user login and
registration.

1. Entities:
- Admin: Represents the administrator or system manager responsible for managing the
online grocery website.
- Online Grocery Website: Represents the main system or platform where users can
access and interact with the website's features.
- User: Represents the individuals accessing the online grocery website to browse
products, make purchases, etc.

2. Processes:
- Request for Login: This process signifies a user's request to log in to the online
grocery website. It involves providing credentials such as a username and password to
access their account.
- Request for Registration: This process represents a user's request to create a new
account on the online grocery website. It typically involves providing necessary
information such as name, email address, and password to register as a new user.

3. Responses:
- Response (Login): After receiving a login request from the user, the system processes
the provided credentials. If the credentials are valid, the system responds with access to
the user's account/dashboard. If the credentials are invalid, the system may respond with
an error message indicating authentication failure.
- Response (Registration): After receiving a registration request from the user, the

VIVA COLLEGE OF DIPLOMA ENGG & TECH, COMPUTER 18


ENGG.
system processes the provided information. If the registration is successful and the
provided details meet the requirements, the system responds with a confirmation message
indicating successful registration. If there are errors or missing information, the system
may respond with prompts to correct the registration details.

VIVA COLLEGE OF DIPLOMA ENGG & TECH, COMPUTER 19


ENGG.
4.3 Software and Hardware Requirements:
4.3.1 Software Requirements:
1. Web Browser:
- Requirement: Google Chrome for optimal user experience.

2. Operating System Compatibility:


- Requirement: Compatibility with Windows, macOS, and Linux.

3. Internet Connection:
- Requirement: Reliable internet connection with sufficient bandwidth.

4. Responsive Design:
- Requirement: Responsive design for seamless user experience across devices.

5. SSL Certificate:
- Requirement: SSL encryption for secure HTTPS connection.

6. Content Management System (CMS):


- Requirement: Integration with a CMS for easy website management.

7. Database Management System (DBMS):


- Requirement: Integration with MySQL for secure data storage.

8. Web Development Frameworks and Libraries:


- Requirement: Utilization of frameworks like Bootstrap and libraries like jQuery.

VIVA COLLEGE OF DIPLOMA ENGG & TECH, COMPUTER 20


ENGG.
4.3.2 Hardware Requirements:
a. Device: Laptop/PC:
- Requirement: Laptop or desktop computer.
- Justification: A laptop or desktop computer is necessary for accessing and interacting
with the online grocery website. It serves as the primary device for browsing products,
adding items to the cart, and completing transactions.

b. Operating System: Recommended Windows 7, 8, 10, 11:


- Requirement: Windows 7, 8, 10, or 11 operating system.
- Justification: Windows operating systems are widely used and provide compatibility
with a vast array of software applications, including web browsers and productivity tools.
Users are recommended to use one of these versions for optimal performance and
compatibility with the online grocery website.

c. RAM: Recommended 8GB and above:


- Requirement: Minimum 8GB of RAM (Random Access Memory).
- Justification: RAM is essential for multitasking and system responsiveness. With 8GB
or more of RAM, users can efficiently run multiple applications simultaneously,
including web browsers, without experiencing slowdowns or performance issues while
using the online grocery website.

d. Storage (ROM): Minimum 10 GB:


- Requirement: Minimum of 10GB of storage space (ROM - Read-Only Memory).
- Justification: Storage space is required for storing the operating system, installed
applications, temporary files, and user data. With a minimum of 10GB of storage space
available, users can install the necessary software and store files without running out of
space.

VIVA COLLEGE OF DIPLOMA ENGG & TECH, COMPUTER 21


ENGG.
4.3.3 Languages used:

FRONTEND: 1.HTML
2.CSS
3.Java script
BACKEND: MySQL, PHP

VIVA COLLEGE OF DIPLOMA ENGG & TECH, COMPUTER 22


ENGG.
4.3.3.1 Front-end:
HTML:
1. Semantic HTML: Proper use of semantic HTML elements (``, ``, ``, ``, ``, etc.) for
better accessibility, SEO, and structure.
2. HTML Forms: Utilized for user input and interaction, such as login forms, registration
forms, and various input fields throughout the application.
3. HTML Images: Used to display images such as user avatars, icons, and other visual
elements.

VIVA COLLEGE OF DIPLOMA ENGG & TECH, COMPUTER 23


ENGG.
CSS:
1. Bootstrap CSS: The CSS files of the Bootstrap framework provide pre-styled
components, a grid system, and responsive design utilities.
2. Custom CSS: Additional CSS files for custom styling, overriding default Bootstrap
styles, and adding unique visual enhancements to the application.
3. Font Icon Libraries: CSS files for font icon libraries like Font Awesome and Elegant
Icons, are used for displaying scalable vector icons in the application.
4. Responsive Design: Media queries and responsive CSS techniques ensure that the
application layout adapts seamlessly to different screen sizes and devices.

VIVA COLLEGE OF DIPLOMA ENGG & TECH, COMPUTER 24


ENGG.
JavaScript:
1. jQuery: A fast, small, and feature-rich JavaScript library. It simplifies HTML
document traversing, event handling, animating, and Ajax interactions for rapid web
development.
2. Bootstrap JavaScript Components: The JavaScript components of the Bootstrap
framework enhance the user experience by adding interactive features like dropdowns,
modals, carousels, tooltips, and more.
3. FullCalendar.js: A JavaScript event calendar library that provides a full-sized, drag-
and-drop calendar UI component.
4. jQuery Easy Pie Chart: A lightweight jQuery plugin that uses the HTML5 canvas
element to draw simple animated pie charts.
5. Owl Carousel: A touch-enabled jQuery plugin that allows you to create responsive
carousel sliders with various customization options.

VIVA COLLEGE OF DIPLOMA ENGG & TECH, COMPUTER 25


ENGG.
4.3.3.2 Back-end:
MySQL:
MySQL is a widely used open-source relational database management system (RDBMS)
that is highly suitable for the online grocery website project. It offers a robust and
scalable platform for efficiently storing, organizing, and retrieving data required for
various aspects of the website. MySQL provides:
1. Reliability: MySQL ensures data integrity and reliability, making it suitable for storing
critical information such as product details, user accounts, and transaction records.

2. Performance: It delivers high performance even with large datasets, ensuring fast data
access and query execution. This is essential for maintaining responsiveness and
providing a smooth user experience on the website.

3. Security: MySQL offers robust security features, including user authentication, access
control, and data encryption, to protect sensitive data from unauthorized access and
ensure compliance with data protection regulations.

4. Scalability: The scalability of MySQL allows the website to handle increasing volumes
of data and traffic over time. It supports features such as replication and clustering,
enabling horizontal and vertical scaling as needed.

5. Compatibility: MySQL is compatible with various programming languages, web


development frameworks, and operating systems, making it easy to integrate with the
technologies used in the website's development stack.

VIVA COLLEGE OF DIPLOMA ENGG & TECH, COMPUTER 26


ENGG.
PHP:
PHP is renowned for its simplicity, making it accessible to developers of varying skill
levels. Its syntax resembles C and Java, facilitating quick adoption for those familiar with
these languages. PHP's versatility extends to its seamless integration with databases and
web servers, such as MySQL and Apache, respectively. Its scalability enables the
handling of high traffic volumes, ensuring optimal performance for dynamic web
applications. Supported by a robust community, PHP continues to be a prominent choice
for web development, powering numerous websites and applications across the internet
landscape

VIVA COLLEGE OF DIPLOMA ENGG & TECH, COMPUTER 27


ENGG.
Chapter 5: Details of Design, working, and process

5.1 Designing process

Unified Modelling Language Diagrams (UML):


➢ The unified modeling language allows the software engineer to express an analysis
model using the modeling notation that is governed by a set of syntactic-semantic and
pragmatic rules.
➢ A UML system is represented using five different views that describe the system
from distinctly different perspectives. Each view is defined by a set of diagrams, which
are as follows.
❖ User Model View
➢ This view represents the system from the user's perspective.
➢ The analysis representation describes a usage scenario from the end-user's
perspective.
❖ Structural model view
➢ In this model the data and functionality are arrived from inside the system.
➢ This model view the static structures
Behavioral Model View
➢ It represents the dynamic of behavioral as parts of the system, depicting the
interactions of collection between various structural elements described in the user
model and structural model view

VIVA COLLEGE OF DIPLOMA ENGG & TECH, COMPUTER 28


ENGG.
5.2 Use Case Diagram:

VIVA COLLEGE OF DIPLOMA ENGG & TECH, COMPUTER 29


ENGG.
5.3 ER Diagram:

VIVA COLLEGE OF DIPLOMA ENGG & TECH, COMPUTER 30


ENGG.
5.4 DFD Diagram:

VIVA COLLEGE OF DIPLOMA ENGG & TECH, COMPUTER 31


ENGG.
5.5 Algorithm and Flowchart:
5.5.1 Algorithm:
Step 1: Authentication & Session:
- Begin session, check login status, redirect if not logged in.

Step 2: Login (`login.php`):


- Get email and password, hash password, query DB for match.
- Set session variables upon successful login.

Step 3: Registration (`register.php`):


- Collect user input, sanitize, hash password.
- Insert user into DB, handle image upload.

Step 4: Home (`home.php`):


- Check login, display main content, products.
- Allow adding to wishlist/cart, handle errors.

Step 5: Orders (`orders.php`):


- Check login, retrieve user's orders, display.

Step 6: Search (`search_page.php`):


- Check login, implement search, display results.
- Allow adding to wishlist/cart from search.

Step 7: Shop Category (`shop_category.php`):


- Check login, and display shop categories.
- Allow users to browse products by category.
- Add products to wishlist/cart from category view.

Step 8: Category (`category.php`):


- Check login, retrieve products by category, and display.
- Allow adding to wishlist/cart from the category page.

VIVA COLLEGE OF DIPLOMA ENGG & TECH, COMPUTER 32


ENGG.
- Add to wishlist/cart.

Step 9: Cart (`cart.php`):


- Check login, retrieve cart items, display.
- Provide update/remove options, and calculate the total. Of course! Here's the
revised

Step 10: Checkout Module (`checkout.php`):


- Check login, display cart items, and total price.
- Collect shipping details and payment method.
- Validate inputs, process orders, and update DB.
- Show success/error message.

VIVA COLLEGE OF DIPLOMA ENGG & TECH, COMPUTER 33


ENGG.
5.5.2 Flowchart:
Authentication &
Session

Login

Registration

Home

Orders

Search

x
VIVA COLLEGE OF DIPLOMA ENGG & TECH, COMPUTER 34
ENGG.
x

Shop Category

Category

Cart

Checkout

VIVA COLLEGE OF DIPLOMA ENGG & TECH, COMPUTER 35


ENGG.
5.6 Project Source Code:

Login.php
<?php
@include 'config.php';
session_start();
if(isset($_POST['submit'])){
$email = $_POST['email'];
$email = filter_var($email, FILTER_SANITIZE_STRING);
$pass = md5($_POST['pass']);
$pass = filter_var($pass, FILTER_SANITIZE_STRING);
$sql = "SELECT * FROM `users` WHERE email = ? AND password = ?";
$stmt = $conn->prepare($sql);
$stmt->execute([$email, $pass]);
$rowCount = $stmt->rowCount();
$row = $stmt->fetch(PDO::FETCH_ASSOC);
if($rowCount > 0){

if($row['user_type'] == 'admin'){
$_SESSION['admin_id'] = $row['id'];
header('location:admin_page.php'); }elseif($row['user_type'] == 'user'){

$_SESSION['user_id'] = $row['id'];
header('location:home.php');

}else{
$message[] = 'no user found!';
}

}else{
$message[] = 'incorrect email or password!';
}

?>

<!DOCTYPE html>
<html lang="en">
<head>
VIVA COLLEGE OF DIPLOMA ENGG & TECH, COMPUTER 36
ENGG.
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>login</title>

<!-- font awesome cdn link -->


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

<!-- custom css file link -->


<link rel="stylesheet" href="css/components.css">

</head>
<body>

<?php

if(isset($message)){
foreach($message as $message){
echo '
<div class="message">
<span>'.$message.'</span>
<i class="fas fa-times" onclick="this.parentElement.remove();"></i>
</div>
';
}
}

?>

<section class="form-container">

<form action="" method="POST">


<h3>login now</h3>
<input type="email" name="email" class="box" placeholder="enter your email"
required>
<input type="password" name="pass" class="box" placeholder="enter your
password" required>
<input type="submit" value="login now" class="btn" name="submit">
<p>don't have an account? <a href="register.php">register now</a></p>

VIVA COLLEGE OF DIPLOMA ENGG & TECH, COMPUTER 37


ENGG.
</form>

</section>

</body>
</html>

Logout.php
<?php

@include 'config.php';

session_start();
session_unset();
session_destroy();

header('location:login.php');

?>

Register
<?php

include 'config.php';

if(isset($_POST['submit'])){

$name = $_POST['name'];
$name = filter_var($name, FILTER_SANITIZE_STRING);
$email = $_POST['email'];
$email = filter_var($email, FILTER_SANITIZE_STRING);
$pass = md5($_POST['pass']);
$pass = filter_var($pass, FILTER_SANITIZE_STRING);
$cpass = md5($_POST['cpass']);
$cpass = filter_var($cpass, FILTER_SANITIZE_STRING);

$select = $conn->prepare("SELECT * FROM `users` WHERE email = ?");


$select->execute([$email]);

VIVA COLLEGE OF DIPLOMA ENGG & TECH, COMPUTER 38


ENGG.
if($select->rowCount() > 0){
$message[] = 'user email already exist!';
}else{
if($pass != $cpass){
$message[] = 'confirm password not matched!';
}else{
$insert = $conn->prepare("INSERT INTO `users`(name, email, password, image)
VALUES(?,?,?,?)");
$insert->execute([$name, $email, $pass, $image]);

if($insert){
if($image_size > 2000000){
$message[] = 'image size is too large!';
}else{
move_uploaded_file($image_tmp_name, $image_folder);
$message[] = 'registered successfully!';
header('location:login.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.0">
<title>register</title>

<!-- font awesome cdn link -->


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

<!-- custom css file link -->

VIVA COLLEGE OF DIPLOMA ENGG & TECH, COMPUTER 39


ENGG.
<link rel="stylesheet" href="css/components.css">

</head>
<body>

<?php

if(isset($message)){
foreach($message as $message){
echo '
<div class="message">
<span>'.$message.'</span>
<i class="fas fa-times" onclick="this.parentElement.remove();"></i>
</div>
';
}
}

?>

<section class="form-container">
<form action="" enctype="multipart/form-data" method="POST">
<h3>register now</h3>
<input type="text" name="name" class="box" placeholder="enter your name"
required>
<input type="email" name="email" class="box" placeholder="enter your email"
required>
<input type="password" name="pass" class="box" placeholder="enter your
password" required>
<input type="password" name="cpass" class="box" placeholder="confirm your
password" required>

<input type="submit" value="register now" class="btn" name="submit">


<p>already have an account? <a href="login.php">login now</a></p>
</form>

</section>
</body>
</html>

VIVA COLLEGE OF DIPLOMA ENGG & TECH, COMPUTER 40


ENGG.
Home page
<?php

@include 'config.php';

session_start();

$user_id = $_SESSION['user_id'];

if(!isset($user_id)){
header('location:login.php');
};

if(isset($_POST['add_to_wishlist'])){

$pid = $_POST['pid'];
$pid = filter_var($pid, FILTER_SANITIZE_STRING);
$p_name = $_POST['p_name'];
$p_name = filter_var($p_name, FILTER_SANITIZE_STRING);
$p_price = $_POST['p_price'];
$p_price = filter_var($p_price, FILTER_SANITIZE_STRING);
$p_image = $_POST['p_image'];
$p_image = filter_var($p_image, FILTER_SANITIZE_STRING);

$check_wishlist_numbers = $conn->prepare("SELECT * FROM `wishlist` WHERE


name = ? AND user_id = ?");
$check_wishlist_numbers->execute([$p_name, $user_id]);

$check_cart_numbers = $conn->prepare("SELECT * FROM `cart` WHERE name = ?


AND user_id = ?");
$check_cart_numbers->execute([$p_name, $user_id]);

if($check_wishlist_numbers->rowCount() > 0){


$message[] = 'already added to wishlist!';
}elseif($check_cart_numbers->rowCount() > 0){
$message[] = 'already added to cart!';
}else{
$insert_wishlist = $conn->prepare("INSERT INTO `wishlist`(user_id, pid, name,
price, image) VALUES(?,?,?,?,?)");
$insert_wishlist->execute([$user_id, $pid, $p_name, $p_price, $p_image]);

VIVA COLLEGE OF DIPLOMA ENGG & TECH, COMPUTER 41


ENGG.
$message[] = 'added to wishlist!';
}

if(isset($_POST['add_to_cart'])){

$pid = $_POST['pid'];
$pid = filter_var($pid, FILTER_SANITIZE_STRING);
$p_name = $_POST['p_name'];
$p_name = filter_var($p_name, FILTER_SANITIZE_STRING);
$p_price = $_POST['p_price'];
$p_price = filter_var($p_price, FILTER_SANITIZE_STRING);
$p_image = $_POST['p_image'];
$p_image = filter_var($p_image, FILTER_SANITIZE_STRING);
$p_qty = $_POST['p_qty'];
$p_qty = filter_var($p_qty, FILTER_SANITIZE_STRING);

$check_cart_numbers = $conn->prepare("SELECT * FROM `cart` WHERE name = ?


AND user_id = ?");
$check_cart_numbers->execute([$p_name, $user_id]);

if($check_cart_numbers->rowCount() > 0){


$message[] = 'already added to cart!';
}else{

$check_wishlist_numbers = $conn->prepare("SELECT * FROM `wishlist` WHERE


name = ? AND user_id = ?");
$check_wishlist_numbers->execute([$p_name, $user_id]);

if($check_wishlist_numbers->rowCount() > 0){


$delete_wishlist = $conn->prepare("DELETE FROM `wishlist` WHERE name = ?
AND user_id = ?");
$delete_wishlist->execute([$p_name, $user_id]);
}

$insert_cart = $conn->prepare("INSERT INTO `cart`(user_id, pid, name, price,


quantity, image) VALUES(?,?,?,?,?,?)");
$insert_cart->execute([$user_id, $pid, $p_name, $p_price, $p_qty, $p_image]);
$message[] = 'added to cart!';

VIVA COLLEGE OF DIPLOMA ENGG & TECH, COMPUTER 42


ENGG.
}

?>

<!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.0">
<title>home page</title>

<!-- font awesome cdn link -->


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

<!-- custom css file link -->


<link rel="stylesheet" href="css/style.css">

</head>
<body>

<?php include 'header.php'; ?>

<div class="home-bg">

<section class="home">

<div class="content">

<a href="about.php" class="btn">about us</a>


</div>

</section>

</div>

<section class="home-category">

VIVA COLLEGE OF DIPLOMA ENGG & TECH, COMPUTER 43


ENGG.
<h1 class="title">shop by category</h1>

<div class="box-container">

<div class="box">
<img src="images/cat-1.png" alt="">
<h3>fruits</h3>

<a href="category.php?category=fruits" class="btn">fruits</a>


</div>

<div class="box">
<img src="images/cat-5.jpeg" alt="">
<h3>Household</h3>

<a href="category.php?category=Household" class="btn">Household</a>


</div>

<div class="box">
<img src="images/cat-3.png" alt="">
<h3>vegitables</h3>

<a href="category.php?category=vegitables" class="btn">vegitables</a>


</div>

<div class="box">
<img src="images/cat-6.png" alt="">
<h3>DAL AND PULESES </h3>

<a href="category.php?category=DAL AND PULESES " class="btn">DAL AND


PULESES </a>
</div>

</div>

</section>

<section class="products">

VIVA COLLEGE OF DIPLOMA ENGG & TECH, COMPUTER 44


ENGG.
<h1 class="title">latest products</h1>

<div class="box-container">

<?php
$select_products = $conn->prepare("SELECT * FROM `products` LIMIT 6");
$select_products->execute();
if($select_products->rowCount() > 0){
while($fetch_products = $select_products->fetch(PDO::FETCH_ASSOC)){
?>
<form action="" class="box" method="POST">
<div class="price">Rs<span><?= $fetch_products['price']; ?></span>/-</div>
<a href="view_page.php?pid=<?= $fetch_products['id']; ?>" class="fas fa-eye"></a>
<img src="<?= $fetch_products['image']; ?>" alt="">
<div class="name"><?= $fetch_products['name']; ?></div>
<input type="hidden" name="pid" value="<?= $fetch_products['id']; ?>">
<input type="hidden" name="p_name" value="<?= $fetch_products['name']; ?>">
<input type="hidden" name="p_price" value="<?= $fetch_products['price']; ?>">
<input type="hidden" name="p_image" value="<?= $fetch_products['image']; ?>">
<input type="number" min="1" value="1" name="p_qty" class="qty">
<input type="submit" value="add to wishlist" class="option-btn"
name="add_to_wishlist">
<input type="submit" value="add to cart" class="btn" name="add_to_cart">
</form>
<?php
}
}else{
echo '<p class="empty">no products added yet!</p>';
}
?>

</div>

</section>

<?php include 'footer.php'; ?>

<script src="js/script.js"></script>

</body>

VIVA COLLEGE OF DIPLOMA ENGG & TECH, COMPUTER 45


ENGG.
</html>
Orders
+-<?php

@include 'config.php';

session_start();

$user_id = $_SESSION['user_id'];

if(!isset($user_id)){
header('location:login.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.0">
<title>orders</title>

<!-- font awesome cdn link -->


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

<!-- custom css file link -->


<link rel="stylesheet" href="css/style.css">

</head>
<body>

<?php include 'header.php'; ?>

<section class="placed-orders">

<h1 class="title">placed orders</h1>

VIVA COLLEGE OF DIPLOMA ENGG & TECH, COMPUTER 46


ENGG.
<div class="box-container">

<?php
$select_orders = $conn->prepare("SELECT * FROM `orders` WHERE user_id = ?");
$select_orders->execute([$user_id]);
if($select_orders->rowCount() > 0){
while($fetch_orders = $select_orders->fetch(PDO::FETCH_ASSOC)){
?>
<div class="box">
<p> placed on : <span><?= $fetch_orders['placed_on']; ?></span> </p>
<p> name : <span><?= $fetch_orders['name']; ?></span> </p>
<p> number : <span><?= $fetch_orders['number']; ?></span> </p>
<p> email : <span><?= $fetch_orders['email']; ?></span> </p>
<p> address : <span><?= $fetch_orders['address']; ?></span> </p>
<p> payment method : <span><?= $fetch_orders['method']; ?></span> </p>
<p> your orders : <span><?= $fetch_orders['total_products']; ?></span> </p>
<p> total price : <span>Rs:<?= $fetch_orders['total_price']; ?>/-</span> </p>
<p> payment status : <span style="color:<?php if($fetch_orders['payment_status'] ==
'pending'){ echo 'red'; }else{ echo 'green'; }; ?>"><?= $fetch_orders['payment_status']; ?
></span> </p>
</div>
<?php
}
}else{
echo '<p class="empty">no orders placed yet!</p>';
}
?>

</div>

</section>

<?php include 'footer.php'; ?>

<script src="js/script.js"></script>
</body>
</html>

Search_Page

VIVA COLLEGE OF DIPLOMA ENGG & TECH, COMPUTER 47


ENGG.
<?php

@include 'config.php';

session_start();

$user_id = $_SESSION['user_id'];

if(!isset($user_id)){
header('location:login.php');
};

if(isset($_POST['add_to_wishlist'])){

$pid = $_POST['pid'];
$pid = filter_var($pid, FILTER_SANITIZE_STRING);
$p_name = $_POST['p_name'];
$p_name = filter_var($p_name, FILTER_SANITIZE_STRING);
$p_price = $_POST['p_price'];
$p_price = filter_var($p_price, FILTER_SANITIZE_STRING);
$p_image = $_POST['p_image'];
$p_image = filter_var($p_image, FILTER_SANITIZE_STRING);

$check_wishlist_numbers = $conn->prepare("SELECT * FROM `wishlist` WHERE


name = ? AND user_id = ?");
$check_wishlist_numbers->execute([$p_name, $user_id]);

$check_cart_numbers = $conn->prepare("SELECT * FROM `cart` WHERE name = ?


AND user_id = ?");
$check_cart_numbers->execute([$p_name, $user_id]);

if($check_wishlist_numbers->rowCount() > 0){


$message[] = 'already added to wishlist!';
}elseif($check_cart_numbers->rowCount() > 0){
$message[] = 'already added to cart!';
}else{
$insert_wishlist = $conn->prepare("INSERT INTO `wishlist`(user_id, pid, name,
price, image) VALUES(?,?,?,?,?)");
$insert_wishlist->execute([$user_id, $pid, $p_name, $p_price, $p_image]);
$message[] = 'added to wishlist!';

VIVA COLLEGE OF DIPLOMA ENGG & TECH, COMPUTER 48


ENGG.
}

if(isset($_POST['add_to_cart'])){

$pid = $_POST['pid'];
$pid = filter_var($pid, FILTER_SANITIZE_STRING);
$p_name = $_POST['p_name'];
$p_name = filter_var($p_name, FILTER_SANITIZE_STRING);
$p_price = $_POST['p_price'];
$p_price = filter_var($p_price, FILTER_SANITIZE_STRING);
$p_image = $_POST['p_image'];
$p_image = filter_var($p_image, FILTER_SANITIZE_STRING);
$p_qty = $_POST['p_qty'];
$p_qty = filter_var($p_qty, FILTER_SANITIZE_STRING);

$check_cart_numbers = $conn->prepare("SELECT * FROM `cart` WHERE name = ?


AND user_id = ?");
$check_cart_numbers->execute([$p_name, $user_id]);

if($check_cart_numbers->rowCount() > 0){


$message[] = 'already added to cart!';
}else{

$check_wishlist_numbers = $conn->prepare("SELECT * FROM `wishlist` WHERE


name = ? AND user_id = ?");
$check_wishlist_numbers->execute([$p_name, $user_id]);

if($check_wishlist_numbers->rowCount() > 0){


$delete_wishlist = $conn->prepare("DELETE FROM `wishlist` WHERE name = ?
AND user_id = ?");
$delete_wishlist->execute([$p_name, $user_id]);
}

$insert_cart = $conn->prepare("INSERT INTO `cart`(user_id, pid, name, price,


quantity, image) VALUES(?,?,?,?,?,?)");
$insert_cart->execute([$user_id, $pid, $p_name, $p_price, $p_qty, $p_image]);
$message[] = 'added to cart!';
}

VIVA COLLEGE OF DIPLOMA ENGG & TECH, COMPUTER 49


ENGG.
}

?>

<!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.0">
<title>search page</title>

<!-- font awesome cdn link -->


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

<!-- custom css file link -->


<link rel="stylesheet" href="css/style.css">

</head>
<body>

<?php include 'header.php'; ?>

<section class="search-form">

<form action="" method="POST">


<input type="text" class="box" name="search_box" placeholder="search
products...">
<input type="submit" name="search_btn" value="search" class="btn">
</form>

</section>

<?php

?>

VIVA COLLEGE OF DIPLOMA ENGG & TECH, COMPUTER 50


ENGG.
<section class="products" style="padding-top: 0; min-height:100vh;">

<div class="box-container">

<?php
if(isset($_POST['search_btn'])){
$search_box = $_POST['search_box'];
$search_box = filter_var($search_box, FILTER_SANITIZE_STRING);
$select_products = $conn->prepare("SELECT * FROM `products` WHERE name
LIKE '%{$search_box}%' OR category LIKE '%{$search_box}%'");
$select_products->execute();
if($select_products->rowCount() > 0){
while($fetch_products = $select_products->fetch(PDO::FETCH_ASSOC)){
?>
<form action="" class="box" method="POST">
<div class="price">$<span><?= $fetch_products['price']; ?></span>/-</div>
<a href="view_page.php?pid=<?= $fetch_products['id']; ?>" class="fas fa-eye"></a>
<img src="uploaded_img/<?= $fetch_products['image']; ?>" alt="">
<div class="name"><?= $fetch_products['name']; ?></div>
<input type="hidden" name="pid" value="<?= $fetch_products['id']; ?>">
<input type="hidden" name="p_name" value="<?= $fetch_products['name']; ?>">
<input type="hidden" name="p_price" value="<?= $fetch_products['price']; ?>">
<input type="hidden" name="p_image" value="<?= $fetch_products['image']; ?>">
<input type="number" min="1" value="1" name="p_qty" class="qty">
<input type="submit" value="add to wishlist" class="option-btn"
name="add_to_wishlist">
<input type="submit" value="add to cart" class="btn" name="add_to_cart">
</form>
<?php
}
}else{
echo '<p class="empty">no result found!</p>';
}

};
?>

</div>

</section>

VIVA COLLEGE OF DIPLOMA ENGG & TECH, COMPUTER 51


ENGG.
<?php include 'footer.php'; ?>

<script src="js/script.js"></script>

</body>
</html>

Footer
<footer class="footer">

<section class="box-container">

<div class="box">
<h3>quick links</h3>
<a href="home.php"> <i class="fas fa-angle-right"></i> home</a>
<a href="shop.php"> <i class="fas fa-angle-right"></i> shop</a>
<a href="about.php"> <i class="fas fa-angle-right"></i> about</a>
<a href="contact.php"> <i class="fas fa-angle-right"></i> contact</a>
</div>

<div class="box">
<h3>extra links</h3>
<a href="cart.php"> <i class="fas fa-angle-right"></i> cart</a>
<a href="wishlist.php"> <i class="fas fa-angle-right"></i> wishlist</a>
<a href="login.php"> <i class="fas fa-angle-right"></i> login</a>
<a href="register.php"> <i class="fas fa-angle-right"></i> register</a>
</div>

<div class="box">
<h3>contact info</h3>
<p> <i class="fas fa-phone"></i> +123-456-7890 </p>
<p> <i class="fas fa-phone"></i> +111-222-3333 </p>
<p> <i class="fas fa-envelope"></i> [email protected]</p>
<p> <i class="fas fa-map-marker-alt"></i> mumbai, india - 400104 </p>
</div>

VIVA COLLEGE OF DIPLOMA ENGG & TECH, COMPUTER 52


ENGG.
<div class="box">
<h3>follow us</h3>
<a href="#"> <i class="fab fa-facebook-f"></i> facebook </a>
<a href="#"> <i class="fab fa-twitter"></i> twitter </a>
<a href="#"> <i class="fab fa-instagram"></i> instagram </a>
<a href="#"> <i class="fab fa-linkedin"></i> linkedin </a>
</div></section>
</footer>

Header
<?php

if(isset($message)){
foreach($message as $message){
echo '
<div class="message">
<span>'.$message.'</span>
<i class="fas fa-times" onclick="this.parentElement.remove();"></i>
</div>
';
}
}

?>

<header class="header">

<div class="flex">

<a href="admin_page.php" class="logo"><span>The Grocery Gurus</span></a>

<nav class="navbar">
<a href="home.php">home</a>
<a href="shop.php">shop</a>
<a href="orders.php">orders</a>
<a href="about.php">about</a>
<a href="contact.php">contact</a>
</nav>

VIVA COLLEGE OF DIPLOMA ENGG & TECH, COMPUTER 53


ENGG.
<div class="icons">
<div id="menu-btn" class="fas fa-bars"></div>
<div id="user-btn" class="fas fa-user"></div>
<a href="search_page.php" class="fas fa-search"></a>
<?php
$count_cart_items = $conn->prepare("SELECT * FROM `cart` WHERE user_id
= ?");
$count_cart_items->execute([$user_id]);
$count_wishlist_items = $conn->prepare("SELECT * FROM `wishlist` WHERE
user_id = ?");
$count_wishlist_items->execute([$user_id]);
?>
<a href="wishlist.php"><i class="fas fa-heart"></i><span>(<?=
$count_wishlist_items->rowCount(); ?>)</span></a>
<a href="cart.php"><i class="fas fa-shopping-cart"></i><span>(<?=
$count_cart_items->rowCount(); ?>)</span></a>
</div>

<div class="profile">
<?php
$select_profile = $conn->prepare("SELECT * FROM `users` WHERE id = ?");
$select_profile->execute([$user_id]);
$fetch_profile = $select_profile->fetch(PDO::FETCH_ASSOC);
?>
<img src="uploaded_img/<?= $fetch_profile['image']; ?>" alt="">
<p><?= $fetch_profile['name']; ?></p>
<a href="user_profile_update.php" class="btn">update profile</a>
<a href="logout.php" class="delete-btn">logout</a>
<div class="flex-btn">
<a href="login.php" class="option-btn">login</a>
<a href="register.php" class="option-btn">register</a>
</div>
</div>

</div>

</header>

VIVA COLLEGE OF DIPLOMA ENGG & TECH, COMPUTER 54


ENGG.
Cart
<?php

@include 'config.php';

session_start();

$user_id = $_SESSION['user_id'];

if(!isset($user_id)){
header('location:login.php');
};

if(isset($_GET['delete'])){
$delete_id = $_GET['delete'];
$delete_cart_item = $conn->prepare("DELETE FROM `cart` WHERE id = ?");
$delete_cart_item->execute([$delete_id]);
header('location:cart.php');
}

if(isset($_GET['delete_all'])){
$delete_cart_item = $conn->prepare("DELETE FROM `cart` WHERE user_id = ?");
$delete_cart_item->execute([$user_id]);
header('location:cart.php');
}

if(isset($_POST['update_qty'])){
$cart_id = $_POST['cart_id'];
$p_qty = $_POST['p_qty'];
$p_qty = filter_var($p_qty, FILTER_SANITIZE_STRING);
$update_qty = $conn->prepare("UPDATE `cart` SET quantity = ? WHERE id = ?");
$update_qty->execute([$p_qty, $cart_id]);
$message[] = 'cart quantity updated';
}

?>

<!DOCTYPE html>
<html lang="en">
<head>

VIVA COLLEGE OF DIPLOMA ENGG & TECH, COMPUTER 55


ENGG.
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>shopping cart</title>

<!-- font awesome cdn link -->


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

<!-- custom css file link -->


<link rel="stylesheet" href="css/style.css">

</head>
<body>

<?php include 'header.php'; ?>

<section class="shopping-cart">

<h1 class="title">products added</h1>

<div class="box-container">

<?php
$grand_total = 0;
$select_cart = $conn->prepare("SELECT * FROM `cart` WHERE user_id = ?");
$select_cart->execute([$user_id]);
if($select_cart->rowCount() > 0){
while($fetch_cart = $select_cart->fetch(PDO::FETCH_ASSOC)){
?>
<form action="" method="POST" class="box">
<a href="cart.php?delete=<?= $fetch_cart['id']; ?>" class="fas fa-times"
onclick="return confirm('delete this from cart?');"></a>
<a href="view_page.php?pid=<?= $fetch_cart['pid']; ?>" class="fas fa-eye"></a>
<img src="<?= $fetch_cart['image']; ?>" alt="">
<div class="name"><?= $fetch_cart['name']; ?></div>
<div class="price">Rs<?= $fetch_cart['price']; ?>/-</div>
<input type="hidden" name="cart_id" value="<?= $fetch_cart['id']; ?>">
<div class="flex-btn">
<input type="number" min="1" value="<?= $fetch_cart['quantity']; ?>" class="qty"

VIVA COLLEGE OF DIPLOMA ENGG & TECH, COMPUTER 56


ENGG.
name="p_qty">
<input type="submit" value="update" name="update_qty" class="option-btn">
</div>
<div class="sub-total"> sub total : <span>Rs<?= $sub_total = ($fetch_cart['price'] *
$fetch_cart['quantity']); ?>/-</span> </div>
</form>
<?php
$grand_total += $sub_total;
}
}else{
echo '<p class="empty">your cart is empty</p>';
}
?>
</div>

<div class="cart-total">
<p>grand total : <span>Rs<?= $grand_total; ?>/-</span></p>
<a href="shop.php" class="option-btn">continue shopping</a>
<a href="cart.php?delete_all" class="delete-btn <?= ($grand_total > 1)?'':'disabled'; ?
>">delete all</a>
<a href="checkout.php" class="btn <?= ($grand_total > 1)?'':'disabled'; ?>">proceed
to checkout</a>
</div>

</section>

<?php include 'footer.php'; ?>

<script src="js/script.js"></script>

</body></html>

Category
<?php

@include 'config.php';

session_start();

$user_id = $_SESSION['user_id'];

VIVA COLLEGE OF DIPLOMA ENGG & TECH, COMPUTER 57


ENGG.
if(!isset($user_id)){
header('location:login.php');
};

if(isset($_POST['add_to_wishlist'])){

$pid = $_POST['pid'];
$pid = filter_var($pid, FILTER_SANITIZE_STRING);
$p_name = $_POST['p_name'];
$p_name = filter_var($p_name, FILTER_SANITIZE_STRING);
$p_price = $_POST['p_price'];
$p_price = filter_var($p_price, FILTER_SANITIZE_STRING);
$p_image = $_POST['p_image'];
$p_image = filter_var($p_image, FILTER_SANITIZE_STRING);

$check_wishlist_numbers = $conn->prepare("SELECT * FROM `wishlist` WHERE


name = ? AND user_id = ?");
$check_wishlist_numbers->execute([$p_name, $user_id]);

$check_cart_numbers = $conn->prepare("SELECT * FROM `cart` WHERE name = ?


AND user_id = ?");
$check_cart_numbers->execute([$p_name, $user_id]);

if($check_wishlist_numbers->rowCount() > 0){


$message[] = 'already added to wishlist!';
}elseif($check_cart_numbers->rowCount() > 0){
$message[] = 'already added to cart!';
}else{
$insert_wishlist = $conn->prepare("INSERT INTO `wishlist`(user_id, pid, name,
price, image) VALUES(?,?,?,?,?)");
$insert_wishlist->execute([$user_id, $pid, $p_name, $p_price, $p_image]);
$message[] = 'added to wishlist!';
}

if(isset($_POST['add_to_cart'])){

$pid = $_POST['pid'];

VIVA COLLEGE OF DIPLOMA ENGG & TECH, COMPUTER 58


ENGG.
$pid = filter_var($pid, FILTER_SANITIZE_STRING);
$p_name = $_POST['p_name'];
$p_name = filter_var($p_name, FILTER_SANITIZE_STRING);
$p_price = $_POST['p_price'];
$p_price = filter_var($p_price, FILTER_SANITIZE_STRING);
$p_image = $_POST['p_image'];
$p_image = filter_var($p_image, FILTER_SANITIZE_STRING);
$p_qty = $_POST['p_qty'];
$p_qty = filter_var($p_qty, FILTER_SANITIZE_STRING);

$check_cart_numbers = $conn->prepare("SELECT * FROM `cart` WHERE name = ?


AND user_id = ?");
$check_cart_numbers->execute([$p_name, $user_id]);

if($check_cart_numbers->rowCount() > 0){


$message[] = 'already added to cart!';
}else{

$check_wishlist_numbers = $conn->prepare("SELECT * FROM `wishlist` WHERE


name = ? AND user_id = ?");
$check_wishlist_numbers->execute([$p_name, $user_id]);

if($check_wishlist_numbers->rowCount() > 0){


$delete_wishlist = $conn->prepare("DELETE FROM `wishlist` WHERE name = ?
AND user_id = ?");
$delete_wishlist->execute([$p_name, $user_id]);
}

$insert_cart = $conn->prepare("INSERT INTO `cart`(user_id, pid, name, price,


quantity, image) VALUES(?,?,?,?,?,?)");
$insert_cart->execute([$user_id, $pid, $p_name, $p_price, $p_qty, $p_image]);
$message[] = 'added to cart!';
}

?>

<!DOCTYPE html>
<html lang="en">

VIVA COLLEGE OF DIPLOMA ENGG & TECH, COMPUTER 59


ENGG.
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>category</title>

<!-- font awesome cdn link -->


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

<!-- custom css file link -->


<link rel="stylesheet" href="css/style.css">

</head>
<body>

<?php include 'header.php'; ?>

<section class="products">

<h1 class="title">products categories</h1>

<div class="box-container">

<?php
$category_name = $_GET['category'];
$select_products = $conn->prepare("SELECT * FROM `products` WHERE category
= ?");
$select_products->execute([$category_name]);
if($select_products->rowCount() > 0){
while($fetch_products = $select_products->fetch(PDO::FETCH_ASSOC)){
?>
<form action="" class="box" method="POST">
<div class="price">Rs:-<span><?= $fetch_products['price']; ?></span>/-</div>
<a href="view_page.php?pid=<?= $fetch_products['id']; ?>" class="fas fa-eye"></a>
<img src="<?= $fetch_products['image']; ?>" alt="">
<div class="name"><?= $fetch_products['name']; ?></div>
<input type="hidden" name="pid" value="<?= $fetch_products['id']; ?>">
<input type="hidden" name="p_name" value="<?= $fetch_products['name']; ?>">
<input type="hidden" name="p_price" value="<?= $fetch_products['price']; ?>">

VIVA COLLEGE OF DIPLOMA ENGG & TECH, COMPUTER 60


ENGG.
<input type="hidden" name="p_image" value="<?= $fetch_products['image']; ?>">
<input type="number" min="1" value="1" name="p_qty" class="qty">
<input type="submit" value="add to wishlist" class="option-btn"
name="add_to_wishlist">
<input type="submit" value="add to cart" class="btn" name="add_to_cart">
</form>
<?php
}
}else{
echo '<p class="empty">no products available!</p>';
}
?>

</div>

</section>

<?php include 'footer.php'; ?>

<script src="js/script.js"></script>

</body>
</html>

Checkout
<?php

@include 'config.php';

session_start();

$user_id = $_SESSION['user_id'];

if(!isset($user_id)){
header('location:login.php');

VIVA COLLEGE OF DIPLOMA ENGG & TECH, COMPUTER 61


ENGG.
};

if(isset($_POST['order'])){

$name = $_POST['name'];
$name = filter_var($name, FILTER_SANITIZE_STRING);
$number = $_POST['number'];
$number = filter_var($number, FILTER_SANITIZE_STRING);
$email = $_POST['email'];
$email = filter_var($email, FILTER_SANITIZE_STRING);
$method = $_POST['method'];
$method = filter_var($method, FILTER_SANITIZE_STRING);
$address = 'flat no. '. $_POST['flat'] .' '. $_POST['street'] .' '. $_POST['city'] .' '.
$_POST['state'] .' '. $_POST['country'] .' - '. $_POST['pin_code'];
$address = filter_var($address, FILTER_SANITIZE_STRING);
$placed_on = date('d-M-Y');

$cart_total = 0;
$cart_products[] = '';

$cart_query = $conn->prepare("SELECT * FROM `cart` WHERE user_id = ?");


$cart_query->execute([$user_id]);
if($cart_query->rowCount() > 0){
while($cart_item = $cart_query->fetch(PDO::FETCH_ASSOC)){
$cart_products[] = $cart_item['name'].' ( '.$cart_item['quantity'].' )';
$sub_total = ($cart_item['price'] * $cart_item['quantity']);
$cart_total += $sub_total;
};
};

$total_products = implode(', ', $cart_products);

$order_query = $conn->prepare("SELECT * FROM `orders` WHERE name = ? AND


number = ? AND email = ? AND method = ? AND address = ? AND total_products = ?
AND total_price = ?");
$order_query->execute([$name, $number, $email, $method, $address, $total_products,
$cart_total]);

if($cart_total == 0){
$message[] = 'your cart is empty';

VIVA COLLEGE OF DIPLOMA ENGG & TECH, COMPUTER 62


ENGG.
}elseif($order_query->rowCount() > 0){
$message[] = 'order placed already!';
}else{
$insert_order = $conn->prepare("INSERT INTO `orders`(user_id, name, number,
email, method, address, total_products, total_price, placed_on)
VALUES(?,?,?,?,?,?,?,?,?)");
$insert_order->execute([$user_id, $name, $number, $email, $method, $address,
$total_products, $cart_total, $placed_on]);
$delete_cart = $conn->prepare("DELETE FROM `cart` WHERE user_id = ?");
$delete_cart->execute([$user_id]);
$message[] = 'order placed successfully!';
}

?>

<!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.0">
<title>checkout</title>

<!-- font awesome cdn link -->


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

<!-- custom css file link -->


<link rel="stylesheet" href="css/style.css">

</head>
<body>

<?php include 'header.php'; ?>

<section class="display-orders">

<?php

VIVA COLLEGE OF DIPLOMA ENGG & TECH, COMPUTER 63


ENGG.
$cart_grand_total = 0;
$select_cart_items = $conn->prepare("SELECT * FROM `cart` WHERE user_id
= ?");
$select_cart_items->execute([$user_id]);
if($select_cart_items->rowCount() > 0){
while($fetch_cart_items = $select_cart_items->fetch(PDO::FETCH_ASSOC)){
$cart_total_price = ($fetch_cart_items['price'] * $fetch_cart_items['quantity']);
$cart_grand_total += $cart_total_price;
?>
<p> <?= $fetch_cart_items['name']; ?> <span>(<?= 'Rs'.$fetch_cart_items['price'].'/- x
'. $fetch_cart_items['quantity']; ?>)</span> </p>
<?php
}
}else{
echo '<p class="empty">your cart is empty!</p>';
}
?>
<div class="grand-total">grand total : <span>Rs<?= $cart_grand_total;
?>/-</span></div>
</section>

<section class="checkout-orders">

<form action="" method="POST">

<h3>place your order</h3>

<div class="flex">
<div class="inputBox">
<span>your name :</span>
<input type="text" name="name" placeholder="enter your name" class="box"
required>
</div>
<div class="inputBox">
<span>your number :</span>
<input type="number" name="number" placeholder="enter your number"
class="box" required>
</div>
<div class="inputBox">
<span>your email :</span>

VIVA COLLEGE OF DIPLOMA ENGG & TECH, COMPUTER 64


ENGG.
<input type="email" name="email" placeholder="enter your email" class="box"
required>
</div>
<div class="inputBox">
<span>payment method :</span>
<select name="method" class="box" required>
<option value="cash on delivery">cash on delivery</option>
<option value="credit card">credit card</option>
<option value="paytm">paytm</option>
<option value="paypal">paypal</option>
</select>
</div>
<div class="inputBox">
<span>address line 01 :</span>
<input type="text" name="flat" placeholder="e.g. flat number" class="box"
required>
</div>
<div class="inputBox">
<span>address line 02 :</span>
<input type="text" name="street" placeholder="e.g. street name" class="box"
required>
</div>
<div class="inputBox">
<span>city :</span>
<input type="text" name="city" placeholder="e.g. mumbai" class="box"
required>
</div>
<div class="inputBox">
<span>state :</span>
<input type="text" name="state" placeholder="e.g. maharashtra" class="box"
required>
</div>
<div class="inputBox">
<span>country :</span>
<input type="text" name="country" placeholder="e.g. India" class="box"
required>
</div>
<div class="inputBox">
<span>pin code :</span>
<input type="number" min="0" name="pin_code" placeholder="e.g. 123456"

VIVA COLLEGE OF DIPLOMA ENGG & TECH, COMPUTER 65


ENGG.
class="box" required>
</div>
</div>

<input type="submit" name="order" class="btn <?= ($cart_grand_total >


1)?'':'disabled'; ?>" value="place order">

</form></section>

<?php include 'footer.php'; ?>

<script src="js/script.js"></script>

</body>
</html>

Config
<?php

$db_name = "mysql:host=localhost;dbname=shop_db";
$username = "root";
$password = "";

$conn = new PDO($db_name, $username, $password);

?>

Contact
<?php

@include 'config.php';

session_start();

$user_id = $_SESSION['user_id'];

if(!isset($user_id)){
header('location:login.php');

VIVA COLLEGE OF DIPLOMA ENGG & TECH, COMPUTER 66


ENGG.
};

if(isset($_POST['send'])){

$name = $_POST['name'];
$name = filter_var($name, FILTER_SANITIZE_STRING);
$email = $_POST['email'];
$email = filter_var($email, FILTER_SANITIZE_STRING);
$number = $_POST['number'];
$number = filter_var($number, FILTER_SANITIZE_STRING);
$msg = $_POST['msg'];
$msg = filter_var($msg, FILTER_SANITIZE_STRING);

$select_message = $conn->prepare("SELECT * FROM `message` WHERE name = ?


AND email = ? AND number = ? AND message = ?");
$select_message->execute([$name, $email, $number, $msg]);

if($select_message->rowCount() > 0){


$message[] = 'already sent message!';
}else{

$insert_message = $conn->prepare("INSERT INTO `message`(user_id, name, email,


number, message) VALUES(?,?,?,?,?)");
$insert_message->execute([$user_id, $name, $email, $number, $msg]);

$message[] = 'sent message successfully!';

?>

<!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.0">
<title>contact</title>

VIVA COLLEGE OF DIPLOMA ENGG & TECH, COMPUTER 67


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

<!-- custom css file link -->


<link rel="stylesheet" href="css/style.css">

</head>
<body>

<?php include 'header.php'; ?>

<section class="contact">

<h1 class="title">get in touch</h1>

<form action="" method="POST">


<input type="text" name="name" class="box" required placeholder="enter your
name">
<input type="email" name="email" class="box" required placeholder="enter your
email">
<input type="number" name="number" min="0" class="box" required
placeholder="enter your number">
<textarea name="msg" class="box" required placeholder="enter your message"
cols="30" rows="10"></textarea>
<input type="submit" value="send message" class="btn" name="send">
</form>

</section>

<?php include 'footer.php'; ?>

<script src="js/script.js"></script>

</body>
</html>

About

VIVA COLLEGE OF DIPLOMA ENGG & TECH, COMPUTER 68


ENGG.
<?php

@include 'config.php';

session_start();

$user_id = $_SESSION['user_id'];

if(!isset($user_id)){
header('location:login.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.0">
<title>about</title>

<!-- font awesome cdn link -->


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

<!-- custom css file link -->


<link rel="stylesheet" href="css/style.css">

</head>
<body>

<?php include 'header.php'; ?>

<section class="about">

<div class="row">

<div class="box">
<img src="images/about-img-1.png" alt="">

VIVA COLLEGE OF DIPLOMA ENGG & TECH, COMPUTER 69


ENGG.
<h3>why choose us?</h3>
<p>Lorem, ipsum dolor sit amet consectetur adipisicing elit. Quisquam, a quod,
quis alias eius dignissimos pariatur laborum dolorem ad ullam iure, consequatur autem
animi illo odit! Atque quia minima voluptatibus.</p>
<a href="contact.php" class="btn">contact us</a>
</div>

<div class="box">
<img src="images/about-img-2.png" alt="">
<h3>what we provide?</h3>
<p>Lorem, ipsum dolor sit amet consectetur adipisicing elit. Quisquam, a quod,
quis alias eius dignissimos pariatur laborum dolorem ad ullam iure, consequatur autem
animi illo odit! Atque quia minima voluptatibus.</p>
<a href="shop.php" class="btn">our shop</a>
</div>

</div>

</section>

<?php include 'footer.php'; ?>

<script src="js/script.js"></script>

</body>
</html>
Shop
<?php

@include 'config.php';

session_start();

$user_id = $_SESSION['user_id'];

if(!isset($user_id)){
header('location:login.php');
};

VIVA COLLEGE OF DIPLOMA ENGG & TECH, COMPUTER 70


ENGG.
if(isset($_POST['add_to_wishlist'])){

$pid = $_POST['pid'];
$pid = filter_var($pid, FILTER_SANITIZE_STRING);
$p_name = $_POST['p_name'];
$p_name = filter_var($p_name, FILTER_SANITIZE_STRING);
$p_price = $_POST['p_price'];
$p_price = filter_var($p_price, FILTER_SANITIZE_STRING);
$p_image = $_POST['p_image'];
$p_image = filter_var($p_image, FILTER_SANITIZE_STRING);

$check_wishlist_numbers = $conn->prepare("SELECT * FROM `wishlist` WHERE


name = ? AND user_id = ?");
$check_wishlist_numbers->execute([$p_name, $user_id]);

$check_cart_numbers = $conn->prepare("SELECT * FROM `cart` WHERE name = ?


AND user_id = ?");
$check_cart_numbers->execute([$p_name, $user_id]);

if($check_wishlist_numbers->rowCount() > 0){


$message[] = 'already added to wishlist!';
}elseif($check_cart_numbers->rowCount() > 0){
$message[] = 'already added to cart!';
}else{
$insert_wishlist = $conn->prepare("INSERT INTO `wishlist`(user_id, pid, name,
price, image) VALUES(?,?,?,?,?)");
$insert_wishlist->execute([$user_id, $pid, $p_name, $p_price, $p_image]);
$message[] = 'added to wishlist!';
}

if(isset($_POST['add_to_cart'])){

$pid = $_POST['pid'];
$pid = filter_var($pid, FILTER_SANITIZE_STRING);
$p_name = $_POST['p_name'];
$p_name = filter_var($p_name, FILTER_SANITIZE_STRING);
$p_price = $_POST['p_price'];
$p_price = filter_var($p_price, FILTER_SANITIZE_STRING);

VIVA COLLEGE OF DIPLOMA ENGG & TECH, COMPUTER 71


ENGG.
$p_image = $_POST['p_image'];
$p_image = filter_var($p_image, FILTER_SANITIZE_STRING);
$p_qty = $_POST['p_qty'];
$p_qty = filter_var($p_qty, FILTER_SANITIZE_STRING);

$check_cart_numbers = $conn->prepare("SELECT * FROM `cart` WHERE name = ?


AND user_id = ?");
$check_cart_numbers->execute([$p_name, $user_id]);

if($check_cart_numbers->rowCount() > 0){


$message[] = 'already added to cart!';
}else{

$check_wishlist_numbers = $conn->prepare("SELECT * FROM `wishlist` WHERE


name = ? AND user_id = ?");
$check_wishlist_numbers->execute([$p_name, $user_id]);

if($check_wishlist_numbers->rowCount() > 0){


$delete_wishlist = $conn->prepare("DELETE FROM `wishlist` WHERE name = ?
AND user_id = ?");
$delete_wishlist->execute([$p_name, $user_id]);
}

$insert_cart = $conn->prepare("INSERT INTO `cart`(user_id, pid, name, price,


quantity, image) VALUES(?,?,?,?,?,?)");
$insert_cart->execute([$user_id, $pid, $p_name, $p_price, $p_qty, $p_image]);
$message[] = 'added to cart!';
}

?>

<!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.0">
<title>shop</title>

VIVA COLLEGE OF DIPLOMA ENGG & TECH, COMPUTER 72


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

<!-- custom css file link -->


<link rel="stylesheet" href="css/style.css">

</head>
<body>

<?php include 'header.php'; ?>

<section class="p-category">

<a href="category.php?category=fruits">fruits</a>
<a href="category.php?category=vegitables">vegitables</a>
<a href="category.php?category=DAL AND PULESES">DAL AND PULESES</a>
<a href="category.php?category=Household">Household</a>

</section>

<section class="products">

<h1 class="title">latest products</h1>

<div class="box-container">

<?php
$select_products = $conn->prepare("SELECT * FROM `products`");
$select_products->execute();
if($select_products->rowCount() > 0){
while($fetch_products = $select_products->fetch(PDO::FETCH_ASSOC)){
?>
<form action="" class="box" method="POST">
<div class="price">Rs<span><?= $fetch_products['price']; ?></span>/-</div>
<a href="view_page.php?pid=<?= $fetch_products['id']; ?>" class="fas fa-eye"></a>
<img src="<?= $fetch_products['image']; ?>" alt="">
<div class="name"><?= $fetch_products['name']; ?></div>
<input type="hidden" name="pid" value="<?= $fetch_products['id']; ?>">

VIVA COLLEGE OF DIPLOMA ENGG & TECH, COMPUTER 73


ENGG.
<input type="hidden" name="p_name" value="<?= $fetch_products['name']; ?>">
<input type="hidden" name="p_price" value="<?= $fetch_products['price']; ?>">
<input type="hidden" name="p_image" value="<?= $fetch_products['image']; ?>">
<input type="number" min="1" value="1" name="p_qty" class="qty">
<input type="submit" value="add to wishlist" class="option-btn"
name="add_to_wishlist">
<input type="submit" value="add to cart" class="btn" name="add_to_cart">
</form>
<?php
}
}else{
echo '<p class="empty">no products added yet!</p>';
}
?>

</div>

</section>

<?php include 'footer.php'; ?>

<script src="js/script.js"></script>

</body>
</html>
<?php

Wishlist
@include 'config.php';

session_start();

$user_id = $_SESSION['user_id'];

if(!isset($user_id)){
header('location:login.php');
};

if(isset($_POST['add_to_cart'])){

VIVA COLLEGE OF DIPLOMA ENGG & TECH, COMPUTER 74


ENGG.
$pid = $_POST['pid'];
$pid = filter_var($pid, FILTER_SANITIZE_STRING);
$p_name = $_POST['p_name'];
$p_name = filter_var($p_name, FILTER_SANITIZE_STRING);
$p_price = $_POST['p_price'];
$p_price = filter_var($p_price, FILTER_SANITIZE_STRING);
$p_image = $_POST['p_image'];
$p_image = filter_var($p_image, FILTER_SANITIZE_STRING);
$p_qty = $_POST['p_qty'];
$p_qty = filter_var($p_qty, FILTER_SANITIZE_STRING);

$check_cart_numbers = $conn->prepare("SELECT * FROM `cart` WHERE name = ?


AND user_id = ?");
$check_cart_numbers->execute([$p_name, $user_id]);

if($check_cart_numbers->rowCount() > 0){


$message[] = 'already added to cart!';
}else{

$check_wishlist_numbers = $conn->prepare("SELECT * FROM `wishlist` WHERE


name = ? AND user_id = ?");
$check_wishlist_numbers->execute([$p_name, $user_id]);

if($check_wishlist_numbers->rowCount() > 0){


$delete_wishlist = $conn->prepare("DELETE FROM `wishlist` WHERE name = ?
AND user_id = ?");
$delete_wishlist->execute([$p_name, $user_id]);
}

$insert_cart = $conn->prepare("INSERT INTO `cart`(user_id, pid, name, price,


quantity, image) VALUES(?,?,?,?,?,?)");
$insert_cart->execute([$user_id, $pid, $p_name, $p_price, $p_qty, $p_image]);
$message[] = 'added to cart!';
}

if(isset($_GET['delete'])){

VIVA COLLEGE OF DIPLOMA ENGG & TECH, COMPUTER 75


ENGG.
$delete_id = $_GET['delete'];
$delete_wishlist_item = $conn->prepare("DELETE FROM `wishlist` WHERE id = ?");
$delete_wishlist_item->execute([$delete_id]);
header('location:wishlist.php');

if(isset($_GET['delete_all'])){

$delete_wishlist_item = $conn->prepare("DELETE FROM `wishlist` WHERE user_id


= ?");
$delete_wishlist_item->execute([$user_id]);
header('location:wishlist.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.0">
<title>wishlist</title>

<!-- font awesome cdn link -->


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

<!-- custom css file link -->


<link rel="stylesheet" href="css/style.css">

</head>
<body>

<?php include 'header.php'; ?>

<section class="wishlist">

VIVA COLLEGE OF DIPLOMA ENGG & TECH, COMPUTER 76


ENGG.
<h1 class="title">products added</h1>

<div class="box-container">

<?php
$grand_total = 0;
$select_wishlist = $conn->prepare("SELECT * FROM `wishlist` WHERE user_id
= ?");
$select_wishlist->execute([$user_id]);
if($select_wishlist->rowCount() > 0){
while($fetch_wishlist = $select_wishlist->fetch(PDO::FETCH_ASSOC)){
?>
<form action="" method="POST" class="box">
<a href="wishlist.php?delete=<?= $fetch_wishlist['id']; ?>" class="fas fa-times"
onclick="return confirm('delete this from wishlist?');"></a>
<a href="view_page.php?pid=<?= $fetch_wishlist['pid']; ?>" class="fas fa-eye"></a>
<img src="<?= $fetch_wishlist['image']; ?>" alt="">
<div class="name"><?= $fetch_wishlist['name']; ?></div>
<div class="price">Rs:<?= $fetch_wishlist['price']; ?>/-</div>
<input type="number" min="1" value="1" class="qty" name="p_qty">
<input type="hidden" name="pid" value="<?= $fetch_wishlist['pid']; ?>">
<input type="hidden" name="p_name" value="<?= $fetch_wishlist['name']; ?>">
<input type="hidden" name="p_price" value="<?= $fetch_wishlist['price']; ?>">
<input type="hidden" name="p_image" value="<?= $fetch_wishlist['image']; ?>">
<input type="submit" value="add to cart" name="add_to_cart" class="btn">
</form>
<?php
$grand_total += $fetch_wishlist['price'];
}
}else{
echo '<p class="empty">your wishlist is empty</p>';
}
?>
</div>

<div class="wishlist-total">
<p>grand total : <span>Rs:<?= $grand_total; ?>/-</span></p>
<a href="shop.php" class="option-btn">continue shopping</a>
<a href="wishlist.php?delete_all" class="delete-btn <?= ($grand_total >
1)?'':'disabled'; ?>">delete all</a>

VIVA COLLEGE OF DIPLOMA ENGG & TECH, COMPUTER 77


ENGG.
</div>

</section>

<?php include 'footer.php'; ?>

<script src="js/script.js"></script>

</body>
</html>

admin_contacts
<?php

@include 'config.php';

session_start();

$admin_id = $_SESSION['admin_id'];

if(!isset($admin_id)){
header('location:login.php');
};

if(isset($_GET['delete'])){

$delete_id = $_GET['delete'];
$delete_message = $conn->prepare("DELETE FROM `message` WHERE id = ?");
$delete_message->execute([$delete_id]);
header('location:admin_contacts.php');

?>

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">

VIVA COLLEGE OF DIPLOMA ENGG & TECH, COMPUTER 78


ENGG.
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>messages</title>

<!-- font awesome cdn link -->


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

<!-- custom css file link -->


<link rel="stylesheet" href="css/admin_style.css">

</head>
<body>

<?php include 'admin_header.php'; ?>

<section class="messages">

<h1 class="title">messages</h1>

<div class="box-container">

<?php
$select_message = $conn->prepare("SELECT * FROM `message`");
$select_message->execute();
if($select_message->rowCount() > 0){
while($fetch_message = $select_message->fetch(PDO::FETCH_ASSOC)){
?>
<div class="box">
<p> user id : <span><?= $fetch_message['user_id']; ?></span> </p>
<p> name : <span><?= $fetch_message['name']; ?></span> </p>
<p> number : <span><?= $fetch_message['number']; ?></span> </p>
<p> email : <span><?= $fetch_message['email']; ?></span> </p>
<p> message : <span><?= $fetch_message['message']; ?></span> </p>
<a href="admin_contacts.php?delete=<?= $fetch_message['id']; ?>" onclick="return
confirm('delete this message?');" class="delete-btn">delete</a>
</div>
<?php
}
}else{
echo '<p class="empty">you have no messages!</p>';

VIVA COLLEGE OF DIPLOMA ENGG & TECH, COMPUTER 79


ENGG.
}
?> </div>

</section>
<script src="js/script.js"></script>
</body></html>

VIVA COLLEGE OF DIPLOMA ENGG & TECH, COMPUTER 80


ENGG.
Chapter 6: Results and Application

6.1 Login Module:

6.2 Register Module:

VIVA COLLEGE OF DIPLOMA ENGG & TECH, COMPUTER 81


ENGG.
6.3 Home Page Module:

6.4 Shop Module:

VIVA COLLEGE OF DIPLOMA ENGG & TECH, COMPUTER 82


ENGG.
6.5 Category Module:

6.6 Checkout Module:

VIVA COLLEGE OF DIPLOMA ENGG & TECH, COMPUTER 83


ENGG.
6.2 Application of Digital Voting System:

1. Sign Up or Log In:


- Users can create a new account or log in with their existing credentials.
2. Browse Products:
- Users can explore different categories of grocery items like fruits, vegetables, dairy,
etc.
3. Add to Cart or Wishlist:
- Users can add products they like to their cart for immediate purchase or to their
wishlist for future reference.
4. Search for Products:
- Users can search for specific products by typing keywords or product names.
5. View and Manage Cart:
- Users can view the items in their cart, adjust quantities, and remove items if needed.
6. Checkout Process:
- Users enter their shipping details and select a payment method to complete their
purchase.
7. Order Confirmation:
- After checkout, users receive confirmation of their order with details like order
number and estimated delivery time.
8. Manage Account:
- Users can update their profile information and view their order history.
9. Customer Support:
- Users can contact customer support for assistance with orders or product inquiries.

VIVA COLLEGE OF DIPLOMA ENGG & TECH, COMPUTER 84


ENGG.
10. Promotions and Discounts:
- Users may receive special offers or discounts on certain products to encourage
purchases.

VIVA COLLEGE OF DIPLOMA ENGG & TECH, COMPUTER 85


ENGG.
Chapter 7: Conclusion and Future Scope

7.1 Conclusion:
In conclusion, grocery websites have try to revolutionized the way people shop for
groceries. With the advent of e-commerce, customers can now browse and purchase
groceries from the comfort of their own homes. This convenience has resulted in an
increase in online grocery shopping, particularly in the wake of the COVID-19 pandemic.

Grocery websites offer a wide range of products at competitive prices, making it easy for
customers to find what they need. Additionally, many sites offer features such as
personalized recommendations, online coupons, and subscription services, making it
easier than ever for customers to save time and money. Overall, grocery websites have
become an essential part of modern life, providing a convenient and efficient way to shop
for groceries. As technology continues to advance, we can expect grocery websites to
become even more user-friendly and personalized, further enhancing the customer
experience.

VIVA COLLEGE OF DIPLOMA ENGG & TECH, COMPUTER 86


ENGG.
7.2 Future scope:

Expansion of product offerings: As the website gains popularity, it can expand its product
offerings to include a wider range of grocery items, such as organic foods, international
foods, and specialty products.

Integration of delivery services: The website can partner with delivery services or
establish its own delivery system to offer customers a more convenient and seamless
shopping experience.

Implementation of AI: With the help of AI the website can provide personalized
recommendations to customers based on their past shopping behavior and preferences.

Subscription model: The website can introduce a subscription model where customers
can sign up for regular deliveries of their preferred grocery items.

VIVA COLLEGE OF DIPLOMA ENGG & TECH, COMPUTER 87


ENGG.
Chapter 8: References and Bibliography

1. https://youtu.be/lCCN_lkl3Xw
2. https://www.slideshare.net
3. https://en.wikipedia.org.
4. https://www.freeprojectz.com

VIVA COLLEGE OF DIPLOMA ENGG & TECH, COMPUTER 88


ENGG.

You might also like