0% found this document useful (0 votes)
107 views62 pages

Farm To Table PDF

Uploaded by

mahimawaghmare16
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)
107 views62 pages

Farm To Table PDF

Uploaded by

mahimawaghmare16
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
You are on page 1/ 62

Table of Contents

Declaration of Authorship ii

Letter of Acceptance iii

Abstract iv

Acknowledgment v

Table of Contents vi

List of Figures 1

Chapter 1 Introduction
1.1 Motivation ............................................................................................................... 2
1.2 Objective ............................................................................................................ 3
1.3 Outline of The Report ............................................................................................. 3

Chapter 2 Background Study


2.1 Existing Agricultural Sites……………………………………………………………4
2.2 Technological Background……………………………………………………………4
2.2.1 HTML 5
2.2.2 CSS 5
2.2.3 JavaScript 5
2.2.4 PHP 5
2.2.5 PHP CodeIgniter Framework 5
2.2.5 Apache Server (XAMPP) 6
2.2.6 Editor (NetBeans IDE 8.0.1) 6

Chapter 3 System Analysis and Design


3.1 Requirement Analysis…………………………………………………………………7
3.1.1 Data Requirement 7
3.1.2 Process Requirement 8

3.2 Use Case Diagram……………………………………………………………………...9


3.2.1 Use Case Diagram for Administrative Management 9
ii
3.2.2 Use Case Diagram for Farmer Management 10
3.2.3 Use Case Diagram for Customer Management 11
3.2.4 Use Case Diagram for Dealer Management 12
3.3 ER Diagram…………………………………………………………………………...13

Chapter 4 Implementation
4.1 Database Implementation…………………………………………………………...14
4.1.1 Database of User 14
4.1.2 Database of Products 15
4.1.3 Database of Contact 15
4.1.4 Database of Shipping 16
4.1.5 Database of Wish List 16
4.1.6 Database of Order 17
4.1.7 Database of Admin 17
4.1.8 Database of Category 18
4.1.9 Database of Manufacturer 18
4.1.10 Database of Payment 19
4.1.11 Database of Order Details 19
4.1.12 Database of Payments with Stripe 20
4.2 Interfaces……………………………………………………………………………...20
4.2.1 Home Page 21
4.2.2 About Us Page 21
4.2.3 Wish List Page 22
4.2.4 Account Login Page 23
4.2.5 Registration Page 23
4.2.6 Shipping Info Page 24
4.2.7 Shopping Cart Page 25
4.2.8 Payment Info Page 25
4.2.9 Successful Order Mail Page 26
4.2.10 Manage Category Page 27
4.2.11 Category Page 27

vii
4.2.12 Manage Manufacturer Page 28
4.2.13 Product Page 29
4.2.14 Manage Product Page 29
4.2.15 Manage Order Page 30
4.2.16 Stripe Payment Page 31
4.2.17 Stripe Payment Successful Page 31
4.2.18 Stripe Payment details Page 32
Chapter 5 Conclusion and Future Work
5.1 Interface…………………………………………………………………………….33
5.1 Future Work………………………………………………………………………...33

References 34
Appendix A List of Acronyms 35
Appendix B Source Code 36
viii
List of Figures

Figure-3.1: Use Case Diagram for Admin ...................................................... 09


Figure-3.2: Use Case Diagram for Farmer ...................................................... 10
Figure-3.3: Use Case Diagram for Customer .................................................. 11
Figure-3.4: Use Case Diagram for Dealer ....................................................... 12
Figure-3.5: ER Diagram of the system ........................................................... 13
Figure-4.1: Databases for User ........................................................................ 14
Figure-4.2: Databases for Products ................................................................. 15
Figure-4.3: Databases for Contact ................................................................... 15
Figure-4.4: Databases for Shipping ................................................................. 16
Figure-4.5: Databases for Wish List ............................................................... 16
Figure-4.6: Databases for Order ...................................................................... 17
Figure-4.7: Databases for Admin .................................................................... 17
Figure-4.8: Databases for Category ................................................................ 18
Figure-4.9: Databases for Manufacturer ......................................................... 18
Figure-4.10: Databases for Payment ............................................................... 19
Figure-4.11: Databases for Order Details ....................................................... 19
Figure-4.12: Databases for Payment with Stripe ............................................ 20
Figure-4.13: Home Page .................................................................................. 21
Figure-4.14: About Us Page ............................................................................ 22
Figure-4.15: Wish List Page ............................................................................ 22
Figure-4.16: Account Login Page ................................................................... 23
Figure-4.17: Registration Page ........................................................................ 24
Figure-4.18: Shipping Info Page ..................................................................... 24
Figure-4.19: Shopping Cart Page .................................................................... 25
Figure-4.20: Payment Info Page ...................................................................... 26
Figure-4.21: Successful Order Mail Page ....................................................... 26
Figure-4.22: Manage Category Page ............................................................... 27
Figure-4.23: Category Page ............................................................................. 28
Figure-4.24: Manage Manufacturer Page ....................................................... 28
Figure-4.25: Product Page ............................................................................... 29
Figure-4.26: Manage Product Page ................................................................. 30
Figure-4.27: Manage Order Page .................................................................... 30
Figure-4.28: Stripe Payment Page ................................................................... 31
Figure-4.29: Stripe Payment Successful Page ................................................ 32
Figure-4.30: Stripe Payment Details Page ...................................................... 32

1
Chapter 1
Introduction

Ecommerce is fast gaining ground as an accepted and used business paradigm. More and
more business houses are implementing web sites providing functionality for performing
commercial transactions over the web. It is reasonable to say that the process of shopping on
the web is becoming common place. It is the buying and selling of goods and services, or the
transmitting of funds or data, over an electronic network, primarily the internet. These
business transactions occur either as business-to-business, business-to-consumer, consumer-
to-consumer or consumerto-business. The terms e-commerce and e-business are often used
interchangeably.

The main objective of this project is to help farmers ensure greater profitability through direct
farmer to farmer, farmer to customer & farmer to dealer communication. Our project deals
with respect to the farmers benefit of getting their products sale at a best price online. Here,
the main users of this website are farmer, customer, dealer and admin. Farmers will get
unique interface where they can perform marketing, get the correct rates of the market, get in
touch with SMS or Email and gather knowledge of different schemes and get pay online. It
will provide market wise, commodity wise report to the farmer in interactive way. The
centralized market committee will control all business activities.

Agricultural E-commerce enables good trading possibilities by supporting different business


models such as multi-suppliers, e-sales and several types of auctions. It can blur the physical
existence of agro-allied stores, the integrity of products is ensured no paper money involved
in the process, distance doesn’t exist and so on. Today E-commerce lacks fully automated
business processes and still requires a significant manual effort by users. So our project tries
to solve all lacking of E-commerce business process.

1.1 Motivation

Bangladesh is agricultural country. Majority of Bangladesh people live on agricultural. So,


Agricultural institutes, research bases agencies and other resources related to agriculture in
Bangladesh is vitally important. Now a day, the farmers have to go to the nearest market to
hand over his product to a particular agent where agent sells the product to another agent or a
dealer. After a specific time the agent gives the collected cash out of the sold products to the
respected farmer but every Agent tries to cuts his commission out of the earned amount. The
whole process is not transparent as there is no way for farmer to know about the deal and the
exact amount at which their product was sold. No facility is present for the farmers to know
the product rates at different markets where they can sell their products for achieving high
profits. Our project aims to help farmers to sell their products in a transparent way.

2
1.2 Objectives

The main objective of this project is to build a platform for farmers to sell their product and
track the sale. This platform is flexible which can maneuver the customer-farmer
relationship in an effective manner. Farmer will get unique interface where they can avail
everything right from learning to the market information. This website will act as unique
and secure way to perform agro-marketing.

1.3 Outline of the Report

In chapter 2, we survey existing agricultural e-commerce sites and review some


technologies used to implement this project; Chapter 3 analyzes the whole architecture of
the system; In chapter 4, the database implementation and interfaces are presented and in
chapter 5, conclusion and future works are highlighted. Lastly, list of acronyms, proper
references and source code of the project have been illustrated.

3
Chapter 2
Background Study

In this chapter, existing websites related to agriculture and technologies used to implement
the project have been discussed in detail.

2.1 Existing Agricultural Websites

The contents of some agricultural websites in Bangladesh are discussed below:


BADC (Bangladesh Agricultural Development Corporation) [1] provides quality agricultural
inputs supply, efficient irrigation management and production of high yielding seeds of
different crops. It also provides the best use of surface water, irrigation efficiency by reducing
logging and increasing irrigated areas and farmers to supply quality fertilizer.

BARC (The Bangladesh Agricultural Research Council) [2] is to develop an efficient,


effective and sustainable system of agricultural research promoting to increase standard of
living, which would be adequate for well-being of the people of Bangladesh. BARC also is to
strengthen and mobilize research capabilities of the institutes of the NARS, universities,
private sectors and other stakeholders in partnership in the generation of appropriate
technologies and information for the development of agriculture sector.
BARI (Bangladesh Agricultural Research Institute) [3] is an autonomous organization under
the Ministry of agriculture, that conducts research on all crops except rice, jute, sugarcane,
and tea for which there are separate institutes. The central research station of the institute is at
Joydebpur about 35 kilometers (22 mi) north of Dhaka. The research compound of the central
station is spread over 176 hectares of land of which 126 hectares are experiment fields.

MOA (Ministry of Agriculture) [5] is one of best ministries of the Government of the People's
Republic of Bangladesh. It comprises seven wings with responsibilities of policy formulation,
planning, monitoring and administration. Sixteen agencies operate under this ministry which
are responsible for implementation of different projects and plans of MOA. MOA develops
agricultural policies, plans, regulations, acts and provide support in developing new
agricultural technologies to boost up agricultural production and coordinate with local and
international trade agencies for marketing.

2.2 Technological Background

To implement the project, some open source tools have been used such as Netbeans, XAMPP,
CodeIgniter Framework, Apache as web server. The web programing language used to
implement this project are HTML (Hyper Text Markup Language), CSS (Cascading Style
Sheets), JavaScript, JQuery and PHP. MySQL is used as database server.
2.2.1 HTML

4
HTML [6] is a markup language that are used to create electronic documents, especially
pages on the World Wide Web that contain connections called hyperlinks to other pages.
Every web page you see on the Internet, including this one contains HTML code that helps
format and show text and images in an easy to read format. Without HTML a browser would
not know how to format a page and would only display

2.2.2 CSS

CSS [11] is a style sheet language used for describing the presentation of a document written
in a markup language. Although most often used to set the visual style of web pages and user
interfaces written in HTML and XHTML, the language can be applied to any XML
document, including plain XML, SVG and XUL, and is applicable to rendering in speech, or
on other media. Along with HTML and JavaScript, CSS is a cornerstone technology used by
most websites to create visually engaging webpages, user interfaces for web applications, and
user interfaces for many mobile applications.

2.2.3 JavaScript
JavaScript HTML and CSS, JavaScript is one of the three core technologies of World Wide
Web content production. It is used to make webpages interactive and provide online
programs, including video games. The majority of websites employ it, and all modern web
browsers support it without the need for plug-ins by means of a built-in JavaScript engine.
Each of the many JavaScript engines represent a different implementation of JavaScript, all
based on the ECMA Script specification, with some engines not supporting the spec fully, and
with many engines supporting additional features beyond ECMA. It has an API for working
with text, arrays, dates, regular expressions, and basic manipulation of the DOM, but does not
include any I/O, such as networking, storage, or graphics facilities, relying for these upon the
host environment in which it is embedded.

2.2.4 PHP

PHP [7] is probably the most popular scripting language on the web. It is used to enhance
web pages. With PHP, you can do things like create username and password login pages,
check details from a form, create forums, picture galleries, surveys, checkout, cart product
and a whole lot more. If you've come across a web page that ends in PHP, then the author has
written some programming code to liven up the plain, old HTML. PHP is known as a server-
sided language. That's because the PHP doesn't get executed on your computer. But on the
computer you requested the page from. The results are then handed over to you, and
displayed in your browser.

2.2.5 PHP CodeIgniter Framework

CodeIgniter [8] is an Application Development Framework a toolkit for people who build web
sites using PHP with a very small footprint. Its goal is to enable to develop projects much faster
than you could if you were writing code from scratch, by providing a rich set of libraries for
commonly needed tasks, as well as a simple interface and logical structure to access these
libraries. CodeIgniter lets you creatively focus on your project by minimizing the amount of
code needed for a given task.
5
2.2.6 Apache Server (XAMPP):

The Apache HTTP Server [9], commonly referred to as Apache is a web server application
notable for playing a key role in the initial growth of the World Wide Web and creates a
localhost server. Apache is developed and maintained by an open community of developers
under the auspices of the Apache Software Foundation. Most commonly used on a Unixlike
system, Microsoft Windows, OS/2, TPF, OpenVMS and eComStation. Released under the
Apache License, Apache is open-source software.

2.2.7 Editor (NetBeans IDE 8.0.1):

NetBeans IDE [10] is the web development tool that lets you efficiently design, quickly &
easily develop and maintain standards-based websites and applications. NetBeans IDE
provides a powerful combination of visual layout tools, application development features, and
code editing support.

Chapter 3

System Analysis and Design

In this chapter, the architecture of the whole project is analyzed. System analysis is the
process of defining the architecture, components, and data of a system to satisfy specified
requirements. Design is a method of studying a system by examining its component parts and
their interactions. Before implementation began the system was analyzed and designed. In
this section, use cases, requirement analysis, and other part are described in details.

3.1 Requirement Analysis

Web service of farmer product required the following requirements. This has mainly four
actors. Those are Admin, Customer, Farmer and Dealer. This website give service of farmer
product to sell holder is known as customer and dealer.

6
3.1.1 Data Requirement

During requirement analysis the following data have been identified for a web service of
farmer product system:
 At first each person need to register (without admin) himself/herself as a customer or
a farmer or a dealer for accessing the user’s necessary information. Each user requires
an unique username or email Id and password to register in the website.
 Admin/Farmer need to login to the system to operate the system. Admin/Farmer has
an individual or unique login user id and password. Through this user id and password
admin/farmer can login to the system.

 A customer can select a product for buying and add to cart. Customer also can pay
online or cash on delivery.

 Admin can update all the information of the registered users. Any registered member
can be deleted by the admin. And also view all order and can download.
 Admin can update the category list of the product. An admin can edit or delete a
category from the product category list. Admin can also insert a new category menu in
the category list. Admin can also insert product with price and quantity.

 Farmer can add product with price. After add product farmer can edit, delete and
publish of product. When farmer add product and publish then customer can buy the
product from the web page.
 After get buying product Customer can get discount offer. Because of discount
customer can buy low price from selected category which are available in the site.

 Dealer get the product from website with low price. Dealer should be register for this
service.

3.1.2 Process Requirement


The following process requirements are identified for system:

 A valid login is required for all process to be performed. A valid login is required for
every registered users and admin. All of them have a valid user id and password.
System will authenticate their valid login.

7
 After valid login Customer and Dealer can check his/her information, can see personal
information and can check product history and buy product.

 Admin can login to the system. Admin can view, delete, publish and update all
members’ information and product info too. Admin can also enter new category in the
list and insert new product.

 Farmer can login to the system. Farmer can view, delete, publish and update product
info.
Farmer can also enter new product in the list and insert new info.

3.2 Use Case Diagrams


A use case diagram is a graphical depiction of the interactions among the elements of a
system that shows the relationship between the user and the different use cases in which the
user is involved. It is a methodology used in system analysis to identify, clarify, and organize
system requirements. A use case diagram can identify different types of users of a system in
this chapter use cased. 3.2.1 Use case Diagram for Administrative Management:

The use case Diagram for Administrative Management is shown below in figure 3.1

Figure 3.1: Use case Diagram for Admin

8
According to figure, Admin can perform following function:

 Login: Admin needs login to perform all administrative works from admin panel.

 Add category: Admin can add category of products in the system. To perform this
action admin need to login to the system.
 Add Product: Admin can add product and a detail description of the product. Admin
can also approve a product that has been added by a farmer.

 Manage Product: The description price and manufacturer of the product can be
changed by admin at anytime. He/she has the capability to publish or unpublished of
product.

3.2.2 Use case Diagram for Farmer Management:

The Use case Diagram for Farmer Management is shown below in figure 3.2

Figure 3.2: Use case Diagram for Farmer

According to figure, Farmer can perform following function:

 Register: The farmer can perform the general registration to access as registered
farmer.

 Login: After completing registration farmer needs to login part to perform the
necessary actions.

 Add Product and Farming Comments: Farmer can add product add manufacturer
of the product. Farmer can also comment about each product.

 Edit Farmer’s Profile: The farmer can edit his profile. The farmer can update their
name, and contact details.

9
 Sell Product: The farmer can sell all the products online which he added.

3.2.3 Use case Diagram for Customer Management:

The Use case Diagram for Customer Management is shown below in figure 3.3:

Figure 3.3: Use case Diagram for Customer

According to figure, Customer can perform following function:

 Register: The Customer can perform the general registration to have an access as
registered customer.

 Login: After completing registration customer login to perform necessary job.

 Add to Cart: Customer can product to cart even they are not registered but they
cannot pay the bill. Only a registered customer can avail the payment option.

10
 Payment: The customer can buy the product from website and pay online or cash.

3.2.4 Use case Diagram for Dealer Management:

The Use case Diagram for Dealer Management is shown below in figure 3.4:

Figure 3.4: Use case Diagram for Dealer

According to figure, Dealer can perform following function:

 Register: The Dealer can perform the general registration to have an access as
registered customer.

 Login: After completing registration customer login to perform necessary job.

 Cart Product: Dealer can product to cart even they are not registered but they cannot
pay the bill. If they want pay bill than must be registered.

 Payment: The Dealer can buy the product from website and pay online or cash.

11
3.3 Entity Relationship Diagrams
An entity-relationship diagram (ERD) is a graphical representation of an information system
that shows the relationship between people, objects, places, concepts or events within that
system. In software engineering an ER model is commonly formed to represent things that a
business needs to remember in order to perform business processes. Consequently, the ER
model becomes an abstract data model that defines a data or information structure that can be
implemented in a database, typically a relational database.
User (id, name, email, password, mobile_no) Admin (id, name, email, password)
Product (id, name, price, status) Wish list (id, product_id, user_id)
Shipping (id, name, email, address, mobile_no) Order (id, total, status, date, comments)
Payment (id, type, status, date)

Figure 3.5: ER Diagram of the System

12
Chapter 4
Implementation

The system will be having only one User-name and Password section on the front page, as per
the user-name and password the system will know whether user is Farmer/Customer/Dealer.
We follow the MVC design pattern for developing our system. Model–view–controller
(MVC) is a software design pattern for implementing user interfaces on computers. It divides
a given software application into three interconnected parts, so as to separate internal
representations of information from the ways that information is presented to or accepted
from the user.

4.1 Database Implementation


After getting the requirement of a logical design and structural design of our database, we can
move to the implementation stage. In general, implementing our structural design involves
defining the various objects and enforcing the constraints on the data relationships. The
implementation phase is where you install the DBMS on the required hardware, optimize the
database to run best on that hardware and software platform, and create the database and load
the data.

4.1.1 Database of Users:


In database, user database gather into user table. When user create an account then all
information of user store into user table. In user table store user password, email, name,
mobile number, user type, date of birth, city, address, gender and profile image. If user wants
to login website then need that information. Figure 4.1 shows the database of user.

Figure 4.1: Databases of User

4.1.2 Database of Products:

13
Database of products store all information into product table of database. Here store product
id, category, manufacturer id, product name, product comment, product price, stock and
product image. Product table also store product status and publish or unpublished indicate.
Figure 4.2 shows the database of products.

Figure 4.2: Databases of Products

4.1.3 Database of Contacts:


Contact database store into contact table. Here store user feedback about product or other
service. Contact table also store contact id, name, email address and enquiry from user who
give feedback about our website. This table also store complains about our product or
website. Figure 4.3 shows the database of contacts.

Figure 4.3: Databases of Contact


4.1.4 Database of Shippings:

Database of shipping store all information into shipping table. Here store shipping id, name,
email address, mobile number, city, country and zip code. Shipping table also store product

14
shipping address and product delivery place or city. Figure 4.4 shows the database of
shippings.

Figure 4.4: Databases of Shipping

4.1.5 Database of Wish List:


Wish list database store into wish list table. This table store user wish list product. Wish list table
also store wish list id, product id and user id who add product into wish list. Figure 4.5 shows the
database of wish list.

Figure 4.5: Databases of Wish List

4.1.6 Database of Orders:

In order database store order status and order total price which user order in website. User can
order many products in same time that time order id will be different. There have user id,
shipping id and payment id for ensure all formality. Order database also have order date
which date user order product and order comment too. In Figure 4.6 shows the database of
orders.

15
Figure 4.6: Databases of Order

4.1.7 Database of Admin:

Admin database store admin login info into admin table. This table store admin name, id ,
email address, and password. This table also store access label which type of admin login into
admin panel. Our website has two type admin so we use two access label. Figure 4.7 shows
the database of admin.

Figure 4.7: Databases of Admin


4.1.8 Database of Category:
Category database store category info into category table. This table store product category
which category product add into website. Category table also store category id, name and
category comment. Add category have to select which category publish or unpublished in
website. Figure 4.8 shows the database of category.

16
Figure 4.8: Databases of Category

4.1.9 Database of Manufacturer:


This database store manufacturer info into manufacturer table. This table store manufacturer
name, id and comments. This table also store manufacturer status which type of
manufacturer are publish or unpublished. Figure 4.9 shows the database of manufacturer.

Figure 4.9: Databases of Manufacturer

4.1.10 Database of Payment:


This database store payment info into payment table. This table store payment id and date.
This table also store payment status which type of payment are completed by user. User can
pay cash or card if pay cash then cash on delivery and if pay bay card then pay bay card status
store into database. Figure 4.10 shows the database of payment.

17
Figure 4.10: Databases of Payment
4.1.11 Database of Order Details:
In order details database store order id, order detail id, product id and order each product
price which user order in website. User can order many products in same time that time order
id will be different. Order details database also have order quantity which amount product
order by user. Figure 4.11 shows the database of order details.

Figure 4.11: Databases of Order Details


4.1.12 Database of Payments with Stripe:

Stripe [13] is the best way to accept payments online and in mobile apps or PC. Stripe handles
billions of dollars every year for forward-thinking businesses around the world. Stripe give
developer friendly APIs let users focus on building great products. Using Stripe, web
developers can integrate payment processing into their websites with having to register and
maintain a merchant account. Here database of payments store stripe payment info. This

18
database store strip id and total price which pay by card. Here also store payment status,
description, date time and payment zip code. Figure 4.12 shows the database of payment with
stripe.

Figure 4.12: Databases of Payment with Stripe

4.2 Interface
A critical aspect of systems design is to create the user interface to the new system. Input and
output design focuses on the content of that interface – the specific fields that should be
included in screens and reports that are viewed by the users. Once the content is determined,
the format for human-computer interaction (HCI) is determined. The user interface (UI) is the
way the system talks to the users, using screens/forms, reports, and error messages. During
interface design developers identify procedures for each system activity and the required
inputs for those activities. These required inputs become screens or forms. User involvement
is critical during these design activities.

4.2.1 Home page:

This is the home page for Farming Assistant website and Online Product buy, sell and add
product. In the top menu there is my account login, about us, shopping cart, compare and
checkout in part and in middle there is featured product part. Between top menu and middle
part there are category name of product and login or register part too. In the bottom part there
are latest products of the website given. In the footer part there are the website information
given.

19
Figure 4.13 shows the Home page of the system.

Figure 4.13: Home page

4.2.2 About Us Page:


This is the about us page for Farming Assistant website. Here describe about Farming
Assistant service and aim. Just little bit brief of farming assistant which help to know service
of farming assistant. Figure 4.14 shows the About Us page of the system.

Figure 4.14: About Us page


4.2.3 Wish List page:

20
This is the wish list page for Farming Assistant website. Here user can add product to wish
list and also can remove from wish list. From wish list user can add product to shopping cart.
For all access user must be registered. If user register then can get all access and next time not
needed to register for access, only need login . Figure 4.15 shows the Wish List page of the
system.

Figure 4.15: Wish List page

4.2.4 Account Login page:


This is the account login page for Farming Assistant website. Here user can login to access
his account. User must need to register for login. User fills up the form with registered email
address and valid password which is used at registration. Figure 4.16 shows the login page of
the system.

Figure 4.16: Account Login page

21
4.2.5 Registration page:

This is the account registration page for Farming Assistant website. Here user can register an
account to access website all service. User must need to give requirement information for
registration. User fill up the form with require all info which is complete the registration. If a
person fills the form and submits, then he or she becomes a user of the site. Figure 4.17
shows the Registration page of the system.

Figure 4.17: Registration page


4.2.6 Shipping Info page:
This is the shipping info page for Farming Assistant website. Here user should register an
account to access shipping info in website. If user add product to shopping cart then user try
to checkout product, at this moment user should fill up shipping info for completing shopping
in this website. Figure 4.18 shows the Shipping Info page of the system.

22
Figure 4.18: Shipping info page
4.2.7 Shopping Cart page:
This is the shopping cart page for Farming Assistant website. Here user should register an
account to access shopping cart in website. If user adds product to shopping cart then user try
to checkout product, at this moment user should register for completing shopping in this
website. User can update his product quantity and can remove product from shopping cart.
Figure 4.19 shows the Shopping Cart page of the system.

Figure 4.19: Shopping Cart page


4.2.8 Payment info page:

This is the payment info page for Farming Assistant website. Here user should register an
account to access payment info in website. If user add product to shopping cart then user try

23
to checkout product and give shipping info, at this moment user should pay for completing
shopping in this website. There are two type payments such as cash and card. Figure 4.20
shows the Payment Info page of the system.

Figure 4.20: payment info page

4.2.9 Successful Order Mail Page:


This is the successful order mail page for Farming Assistant website. When he/she pay for his
product then get a successful email for completing shopping in this website. User gets all info
by email, about shopping get shipping info, order info & billing info too. This email sends
from admin for user. Figure 4.21 shows the Successful Order Mail page of the system.

24
Figure 4.21: Successful order mail page
4.2.10 Manage Category page:
This is the manage category page for Farming Assistant website’s admin panel. When admin
add category of product and publish it then user see those category of product. Admin can
edit category and delete category in this website. Figure 4.22 shows the Manage Category
page of the system.

Figure 4.22: Manage Category page

4.2.11 Category page:


This is the category page for Farming Assistant website. When admin add category of product
and publish it then user see those category of product in this page. User can add product into
shopping cart in this website. Figure 4.23 shows the Category page of the system.

25
Figure 4.23: Category page
4.2.12 Manage Manufacturer page:
This is the manage manufacturer page for Farming Assistant website’s admin panel. When
admin add manufacturer of product and publish it then user see those manufacturer of
product. Admin can edit manufacturer name and delete manufacturer in this website. Figure
4.24 shows the Manage manufacturer page of the system.

Figure 4.24: Manage Manufacturer page


4.2.13 Products page:
This is the product page for Farming Assistant website. When admin add product and publish
it then user see those product in this page. This page show details of product information.
User can add product into shopping cart from this page and also add to wish list if he/her
26
registered. In the bottom part there are related product and product reviews of the product
given. Figure 4.25 shows the Products page of the system.

Figure 4.25: Product page


4.2.14 Manage Product page:

This is the manage product page for Farming Assistant website’s admin panel. When admin
add product and publish it then user see those product. Admin can edit product and delete
product in this website. Admin can edit product type which product featured and which
product are normal publish in this website. Figure 4.26 shows the Manage Product page of
the system.

27
Figure 4.26: Manage Product page
4.2.15 Manage Order page:

This is the manage order page for Farming Assistant website’ admin panel. When user pay for
his product then get a order info for completing shopping in this website. Admin get all info
by user place order, about shopping get shipping info, order info & billing info too. Admin
see details from admin panel and download order pdf from this panel. Figure 4.27 shows the
Manage Order page of the system.

Figure 4.27: Manage Order page

4.2.16 Stripe Payment page:


This is the Stripe payment page for Farming Assistant website. Here user should register an
account to access payment info in website. After shopping cart then user try to checkout

28
product and give shipping info, at this moment user should pay for completing shopping.
There is pay by card payments option use stripe test payment gateway. Here we use test card
and zip number.
Figure 4.28 shows the Stripe Payment page of the system.

Figure 4.28: Stripe Payment page

4.2.17 Stripe Payment Successful page:

This is the Stripe payment successful page for Farming Assistant website. There are pay by
card payments option use stripe test payment gateway. Here we use test card and test zip
number. This page is successful page after payment by strip test card. Figure 4.29 shows the
Stripe Payment Successful page of the system.

Figure 4.29: Stripe Payment Successful page


29
4.2.18 Stripe Payments Details page:

This is the Stripe payment details page for Farming Assistant website. There are pay by card
payments option use stripe test payment gateway. Here we use test card and test zip number.
This page is payment details page in stripe official page [12] after payment by strip test card.
Figure 4.30 shows the Stripe Payment Details page of the system.

Figure 4.30: Stripe Payment Details page

Chapter 5
Conclusion and Future Work

5.1 Conclusion

The “E-Farming: An E-Commerce Site for Agricultural Product” is successfully designed and
developed to fulfill the necessary requirements, as identified in the requirements analysis
phase, such as the system is very much user friendly, form level validation and field level
validation are performing very good. The old manual system was suffering from a series of
drawbacks. The present project has been developed to meet the aspirations indicated in the
modern age. Through the developed project, anyone can visualize the effectiveness and

30
efficiency in the real life. It is very helpful for computerization or doing automation of a
personal information management system. This program helps reduce the manual method and
stress which is done by a person and that is time consuming and lengthy process. With this
application user’s information are stored very efficiently in a secured database. Trend of
information improvement in the generation has improved the quality and services of human
operation just as the case of this application for job services has reduce the mobility rate of
human and improve their standard of database storage.

5.2 Future Work


The future plan of this project is to improved design; implementation and documentation in
such a way that anyone can use this project for better perform. I will develop the site more
dynamically. In future I will add the few modules for better improvement of the project such
as, real-time chat bot option for user and farmer, so that user can directly enquiry theirs
problem on any time through the chat bot. Video conversation option for user and farmer and
admin and barcode generation for membership card and using online buy and sell product.
Online account verification and notification for user for specific job category they searching
for jobs. In future I will also add mobile version app of this website.

References

1. http://www.badc.gov.bd/
2. http://www.barc.gov.bd/
3. http://www.bari.gov.bd/
4. http://www.bdfish.org/
5. http://www.moa.gov.bd/
6. http://www.w3schools.com
7. http://www.php.net
8. http://www.codeigniter.com
9. https://www.apachefriends.org/index.html
10. https://netbeans.org/

31
11. https://www.w3schools.com/css/css_intro.asp
12. https://stripe.com/

Appendix A
List of Acronyms

BADC: Bangladesh Agricultural Development Corporation


BARC: The Bangladesh Agricultural Research Council
BARI: Bangladesh Agricultural Research Institute
MOA: Ministry of Agriculture
HTML: Hyper Text Markup Language
CSS : Cascading Style Sheets
PHP : Hypertext Preprocessor

32
Appendix B
Source Code

Source Code for Admin panel:


//START
<?php
//admin controller
defined('BASEPATH') OR exit('No direct script access allowed');
/* class Welcome extends CI_Controller
{ */ class Admin extends CI_Controller
{ public function __construct()
{ parent::__construct();
$admin_id=$this->session->userdata('admin_id');
if($admin_id!=NULL){
redirect("super_admin/dashboard");
}
}
public function index() {

33
$this->load->view('admin/admin_login');
}
public function admin_login() {
$email_address = $this->input->post('email_address', true);
$admin_password = md5($this->input->post('admin_password', true));
$access_label=$this->input->post('access_label',true);
//$this->load->model('admin_model');
$admin_info = $this->admin_model->check_admin_login_info($email_address,
$admin_password,$access_label);
// echo $email_address.'--------'.$admin_password;
// exit();
$sdata =
array(); if
($admin_info) {
$sdata['admin_id'] = $admin_info->admin_id;
$sdata['admin_name'] = $admin_info->admin_name;
$sdata['access_label']=$admin_info->access_label;
$this->session->set_userdata($sdata);
redirect('super_admin/dashboard');
} else {
$sdata['exception'] = "Your User Id Or Password Invalid !";
$this->session->set_userdata($sdata);
redirect('admin/index');
}
}
}
// super admin controller
<?php defined('BASEPATH') OR exit('No direct script access
allowed');
/* class Welcome extends CI_Controller { */
//session_start(); class Super_Admin
extends CI_Controller { public
function __construct()
{ parent::__construct();
$admin_id=$this->session-
>userdata('admin_id');

34
if($admin_id==NULL){
redirect("admin/index");
}
$this->load->model('Super_Admin_Model');
}
public function dashboard() {
$data=array();
$data['home_content']=$this->load->view('admin/home_content','',true);
$this->load->view('admin/admin_master',$data);}
public function add_category(){
$data=array();
$data['home_content']=$this->load->view('admin/category_form','',true);
$this->load->view('admin/admin_master',$data);
}
public function store_category(){ $this->Super_Admin_Model->save_category_info();
$sdata=array();
$sdata['message']="Category info save successfully";
$this->session->set_userdata($sdata);
return redirect('super_admin/add_category');
}
public function manage_category(){
$data=array();
$data['categories']=$this->Super_Admin_Model->get_allcategory();
$data['home_content']=$this->load->view('admin/manage_category',$data,true);
$this->load->view('admin/admin_master',$data);}
public function unpublished_category($category_id){
$this->Super_Admin_Model->unpublished_category_byid($category_id);
$data=array();
$data['message']="Category info unpublished successfully";
$this->session->set_userdata($data);
return redirect('super_admin/manage_category');
}
public function published_category($category_id){
$this->Super_Admin_Model->published_category_byid($category_id);
$data=array();
$data['message']="Category info published successfully";

35
$this->session->set_userdata($data);
return redirect('super_admin/manage_category');
}
public function edit_category($category_id){
$data=array();
$data['category_byid']=$this->Super_Admin_Model->getcategory_byid($category_id);
$data['home_content']=$this->load->view('admin/edit_category', $data,true);
$this->load->view('admin/admin_master',$data); }
public function update_category(){
$this->Super_Admin_Model->update_category_info();
$sdata=array();
$sdata['message']="Category info update successfully"; $this->session->set_userdata($sdata);
return redirect('super_admin/manage_category');
}
public function delete_category($category_id){
$this->Super_Admin_Model->delete_category_byid($category_id);
$sdata=array();
$sdata['message']="Category info Delete succesfully";
$this->session->set_userdata($sdata);
return redirect('super_admin/manage_category');
}
public function add_manufacturer(){
$data=array();
$data['home_content']=$this->load->view('admin/pages/add_manufacturer','',true); $this-
>load->view('admin/admin_master',$data);
}
public function store_manufacturer(){
$this->Super_Admin_Model->save_manufacturer_info();
$sdata=array();
$sdata['message']="Manufacturer info save successfully";
$this->session->set_userdata($sdata);
return redirect('super_admin/add_manufacturer');
}
public function manage_manufacturer(){
$data=array();
$data['manufactureis']=$this->Super_Admin_Model->get_allmanufacturer();

36
$data['home_content']=$this->load->view('admin/pages/manage_manufacturer',$data,true);
$this->load->view('admin/admin_master',$data);
}
public function unpublished_manufacturer($manufacturer_id){

$this->Super_Admin_Model->unpublished_manufacturer_byid($manufacturer_id);
$data=array();
$data['message']="Manufacturer info unpublished successfully";
$this->session->set_userdata($data);
return redirect('super_admin/manage_manufacturer');
}

public function published_manufacturer($manufacturer_id){


$this->Super_Admin_Model->published_manufacturer_byid($manufacturer_id);
$data=array();
$data['message']="Manufacturer info published successfully";
$this->session->set_userdata($data); return
redirect('super_admin/manage_manufacturer');
}
public function edit_manufacturer($manufacturer_id){
$data=array();
$data['manufacturer_byid']=$this->Super_Admin_Model-
>getmanufacturer_byid($manufacturer_id);
$data['home_content']=$this->load->view('admin/pages/edit_manufacture',$data,true); $this-
>load->view('admin/admin_master',$data);
}
public function update_manufacturer(){
$this->Super_Admin_Model->update_manufacturer_info();
$sdata=array();
$sdata['message']="Manufacturer info update successfully";
$this->session->set_userdata($sdata); return
redirect('super_admin/manage_manufacturer');
}
public function delete_manufacturer($manufacturer_id){
$this->Super_Admin_Model->delete_manufacturer_byid($manufacturer_id);
$sdata=array();
$sdata['message']="Manufacturer info Delete succesfully";

37
$this->session->set_userdata($sdata);
return redirect('super_admin/manage_manufacturer');
}
public function add_product(){
$data=array();
$data['all_published_category'] = $this->Super_Admin_Model->select_all_published_category();
$data['all_published_manufacturer'] = $this->Super_Admin_Model-
>select_all_published_manufacturer();
$data['home_content']=$this->load->view('admin/pages/add_product',$data,true); $this-
>load->view('admin/admin_master',$data);
}
public function store_product(){
$this->Super_Admin_Model->save_product_info();
$sdata=array();
$sdata['message']="Product info save successfully";
$this->session->set_userdata($sdata);
return redirect('super_admin/add_product');
}
public function manage_product(){
$data=array();
$data['products']=$this->Super_Admin_Model->get_allproduct();
// echo '<pre>';
// print_r($data['products']);
// exit();
$data['home_content']=$this->load->view('admin/pages/manage_product',$data,true); $this-
>load->view('admin/admin_master',$data);
}
public function unpublished_product($product_id){
$this->Super_Admin_Model->unpublished_product_byid($product_id);
$data=array();
$data['message']="Product info unpublished successfully";
$this->session->set_userdata($data);
return redirect('super_admin/manage_product');
}
public function published_product($product_id){
$this->Super_Admin_Model->published_product_byid($product_id);
$data=array();

38
$data['message']="Product info published successfully";
$this->session->set_userdata($data); return
redirect('super_admin/manage_product');
}

public function edit_product($product_id){


$data=array();
$data['all_published_category']=$this->Super_Admin_Model->select_all_published_category();
$data['all_published_manufacturer']=$this->Super_Admin_Model-
>select_all_published_manufacturer();
$data['product_byid']=$this->Super_Admin_Model->getproduct_byid($product_id);
$data['home_content']=$this->load->view('admin/pages/edit_product', $data,true); $this-
>load->view('admin/admin_master',$data);
}
public function update_product($product_id){
$this->Super_Admin_Model->update_product_info($product_id);
$sdata=array();
$sdata['message']="Product info update successfully";
$this->session->set_userdata($sdata);
return redirect('super_admin/manage_product');
}
public function delete_product($product_id){
$this->Super_Admin_Model->delete_product_byid($product_id);
$sdata=array();
$sdata['message']="Product info Delete succesfully";
$this->session->set_userdata($sdata);
return redirect('super_admin/manage_product');
}
public function featured_product($product_id){
$this->Super_Admin_Model->featured_product_byid($product_id);
$data=array();
$data['message']="Product featured successfully";
$this->session->set_userdata($data);
return redirect('super_admin/manage_product');
}
public function normal_product($product_id){
$this->Super_Admin_Model->normal_product_byid($product_id);
$data=array();

39
$data['message']="Product info normal successfully";
$this->session->set_userdata($data); return
redirect('super_admin/manage_product');
}
public function logout() {
$this->session->unset_userdata('admin_id');
$this->session->unset_userdata('admin_name');
$this->session->unset_userdata('access_label');
$sdata = array();
$sdata['message'] = "You are successfully Logout !";
$this->session->set_userdata($sdata);
redirect("admin/index");
}
public function manage_order() {
$data = array();
$data['all_order'] = $this->Super_Admin_Model->select_all_order();
$data['home_content'] = $this->load->view('admin/pages/manage_order', $data, true); $this-
>load->view('admin/admin_master', $data);
}
public function delete_order($order_id) {
$this->Super_Admin_Model->delete_order_by_id($order_id);
redirect('Super_admin/manage_order');
} public function
view_invoice($order_id) {
$data = array();
$data['billing_info'] = $this->Super_Admin_Model->select_billing_info($order_id);
$data['shipping_info'] = $this->Super_Admin_Model->select_shipping_info($order_id);
$data['order_details']= $this->Super_Admin_Model->select_order_details($order_id);
$data['home_content'] = $this->load->view('admin/pages/view_invoice',$data,true); $this-
>load->view('admin/admin_master', $data);
}
public function download_invoice($order_id){
$data = array();
$data['billing_info'] = $this->Super_Admin_Model->select_billing_info($order_id);
$data['shipping_info'] = $this->Super_Admin_Model->select_shipping_info($order_id);
$data['order_details']= $this->Super_Admin_Model->select_order_details($order_id);
//$this->load->view('admin/pages/download_invoice', $data);

40
$this->load->helper('dompdf');
$view_file=$this->load->view('admin/pages/download_invoice', $data,true);
$file_name=pdf_create($view_file, 'inv-00'.$order_id);
echo $file_name;
}
}
//admin model <?php class Admin_Model extends CI_Model { public function
check_admin_login_info($email_address,$admin_password,$access_label)
{ $this->db->select('*');
$this->db->from('tbl_admin');
$this->db->where('email_address',$email_address);
$this->db->where('admin_password',$admin_password);
$this->db->where('access_label',$access_label);
$query_result=$this->db->get();
$result=$query_result->row();
return $result;
}
}
// super admin model
<?php
class Super_Admin_Model extends CI_Model
{ public function save_category_info() {
$data = array();
$data['category_name'] = $this->input->post('category_name', true);
$data['category_description'] = $this->input->post('category_description', true);
$data['publication_status'] = $this->input->post('publication_status', true);
$this->db->insert('tbl_category', $data);}
public function get_allcategory() {
$this->db->select('*');
$this->db->from('tbl_category');
//$this->db->order_by("category_id","desc");
$query_result = $this->db->get();
$result = $query_result->result();
return $result;
}
public function unpublished_category_byid($category_id) {
$this->db->set('publication_status', 0);

41
$this->db->where('category_id', $category_id);
$this->db->update('tbl_category');
}
public function published_category_byid($category_id) {
$this->db->set('publication_status', 1);
$this->db->where('category_id', $category_id);
$this->db->update('tbl_category');
}
public function getcategory_byid($category_id) {
//$this->db->order_by("category_id","desc");
$this->db->select('*');
$this->db->from('tbl_category');
$this->db->where('category_id', $category_id);
$query_result = $this->db->get();
$result = $query_result->row();
return $result;
}
public function update_category_info() {
$data = array();
$category_id = $this->input->post('category_id', true);
$data['category_name'] = $this->input->post('category_name', true);
$data['category_description'] = $this->input->post('category_description', true);
$data['publication_status'] = $this->input->post('publication_status', true);
$this->db->where('category_id', $category_id);
$this->db->update('tbl_category', $data);} public
function delete_category_byid($category_id)
{ $this->db->where('category_id', $category_id);

$this->db->delete('tbl_category');
}
public function save_manufacturer_info() {
$data = array();
$data['manufacturer_name'] = $this->input->post('manufacturer_name', true);
$data['manufacturer_description'] = $this->input->post('manufacturer_description', true);
$data['manufacturer_status'] = $this->input->post('manufacturer_status', true); $this->db-
>insert('tbl_manufacturer', $data);
}
public function get_allmanufacturer() {

42
$this->db->select('*');
$this->db->from('tbl_manufacturer');
//$this->db->order_by("category_id","desc");
$query_result = $this->db->get();
$result = $query_result->result();
return $result;
}
public function unpublished_manufacturer_byid($manufacturer_id) {
$this->db->set('manufacturer_status', 0);
$this->db->where('manufacturer_id', $manufacturer_id);
$this->db->update('tbl_manufacturer');
}
public function published_manufacturer_byid($manufacturer_id) {
$this->db->set('manufacturer_status', 1);
$this->db->where('manufacturer_id', $manufacturer_id);
$this->db->update('tbl_manufacturer');
}
public function getmanufacturer_byid($manufacturer_id) {
//$this->db->order_by("manufacturer_id","desc");
$this->db->select('*');
$this->db->from('tbl_manufacturer');
$this->db->where('manufacturer_id', $manufacturer_id);
$query_result = $this->db->get();
$result = $query_result->row();
return $result;
}
public function update_manufacturer_info() {
$data = array();
$manufacturer_id = $this->input->post('manufacturer_id', true);
$data['manufacturer_name'] = $this->input->post('manufacturer_name', true);
$data['manufacturer_description'] = $this->input->post('manufacturer_description', true);
$data['manufacturer_status'] = $this->input->post('manufacturer_status', true);
$this->db->where('manufacturer_id', $manufacturer_id);
$this->db->update('tbl_manufacturer', $data);
}
public function delete_manufacturer_byid($manufacturer_id) {
$this->db->where('manufacturer_id', $manufacturer_id);

43
$this->db->delete('tbl_manufacturer');
}
public function select_all_published_category() {
$this->db->select("*");
$this->db->from('tbl_category');
$this->db->where('publication_status', 1);
$query_result = $this->db->get();
$result = $query_result->result();
return $result;
}
public function select_all_published_manufacturer() {
$this->db->select("*");
$this->db->from('tbl_manufacturer');
$this->db->where('manufacturer_status', 1);
$query_result = $this->db->get();
$result = $query_result->result();
return $result;
}
public function save_product_info() {
$data = array();
$data['product_name'] = $this->input->post('product_name');
$data['category_id'] = $this->input->post('category_id');
$data['manufacturer_id'] = $this->input->post('manufacturer_id');
$data['product_description'] = $this->input->post('product_description');
$data['product_price'] = $this->input->post('product_price');
$data['product_stock'] = $this->input->post('product_stock');
$data['product_status'] = $this->input->post('product_status');
$data['publication_status'] = $this->input->post('publication_status');
/* Start Image Upload */
$config['upload_path'] = './product_image/';
$config['allowed_types'] = 'gif|jpg|png|jpeg';
$config['max_size'] = 4000;
$this->load->library('upload', $config); if
(!$this->upload->do_upload('product_image')) {
$sdata['error'] = $this->upload->display_errors();
$this->session->set_userdata($sdata);
} else {

44
$fdata = $this->upload->data();
$data['product_image'] = $config['upload_path'] . $fdata['file_name'];
}
/* End Image Upload */
$this->db->insert('tbl_product', $data);
}
public function get_allproduct() {
$this->db->select('p.*,c.category_name,c.publication_status as
category_status,m.manufacturer_name');
$this->db->from('tbl_product p');
$this->db->join('tbl_category c', 'p.category_id = c.category_id');
$this->db->join('tbl_manufacturer m', 'm.manufacturer_id = p.manufacturer_id');
$query_result = $this->db->get();
$result = $query_result->result();
// echo 'Product<pre>';
// print_r($result);
// exit();
return $result;}
public function unpublished_product_byid($product_id) {
$this->db->set('publication_status', 0);
$this->db->where('product_id', $product_id);
$this->db->update('tbl_product');
}
public function published_product_byid($product_id) {
$this->db->set('publication_status', 1);
$this->db->where('product_id', $product_id);
$this->db->update('tbl_product');
}
public function select_featured_product() {
$this->db->select("*");
$this->db->from('tbl_product');
$this->db->where('publication_status', 1);
$this->db->where('product_status', 1);
$this->db->limit(3);
$query_result = $this->db->get();
$result = $query_result->result();
return $result;

45
}
public function getproduct_byid($product_id) {
//$this->db->order_by("product_id","desc");
$this->db->select('*');
$this->db->from('tbl_product');
$this->db->where('product_id', $product_id);
$query_result = $this->db-
>get(); $result = $query_result-
>row(); return $result;
}
public function update_product_info($product_id) {
$data = array();
$data['product_name'] = $this->input->post('product_name');
$data['category_id'] = $this->input->post('category_id'); $data['manufacturer_id'] = $this->input-
>post('manufacturer_id');
$data['product_description'] = $this->input->post('product_description');
$data['product_price'] = $this->input->post('product_price');
$data['product_stock'] = $this->input->post('product_stock');
$data['product_status'] = $this->input->post('product_status');
$data['publication_status'] = $this->input->post('publication_status');
// echo '<pre>';
// print_r($data);
// exit();
/* Start Image Upload */
$config['upload_path'] = './product_image/';
$config['allowed_types'] = 'gif|jpg|png|jpeg';
$config['max_size'] = 4000; $this->load-
>library('upload', $config); if (!$this->upload-
>do_upload('product_image'))
{ $sdata['error'] = $this->upload-
>display_errors();
$this->session->set_userdata($sdata);
} else {
$fdata = $this->upload->data();
$data['product_image'] = $config['upload_path'] . $fdata['file_name'];
}
/* End Image Upload */

46
$this->db->where('product_id', $product_id);
$this->db->update('tbl_product', $data);
}
public function delete_product_byid($product_id) {
$this->db->where('product_id', $product_id);
$this->db->delete('tbl_product');
}
public function featured_product_byid($product_id) {
$this->db->set('product_status', 1);
$this->db->where('product_id', $product_id);
$this->db->update('tbl_product');
}
public function normal_product_byid($product_id){
$this->db->set('product_status', 0);
$this->db->where('product_id',$product_id);
$this->db->update('tbl_product');
}
public function select_products_by_category_id($category_id) {
$this->db->select("*");
$this->db->from('tbl_product');
$this->db->where('publication_status', 1);
$this->db->where('category_id', $category_id);
$query_result = $this->db->get();
$result = $query_result->result();
return $result;
}
public function select_product_info_by_id($product_id) {
$sql = "SELECT a.category_name,b.*,c.manufacturer_name FROM tbl_category as a,tbl_product
as b,tbl_manufacturer as c WHERE a.category_id=b.category_id and
b.manufacturer_id=c.manufacturer_id and product_id='$product_id'";
$this->db->where('publication_status',1);
$this->db->where('product_id',$product_id);
$query_result = $this->db-
>query($sql); $result =
$query_result->row(); return
$result;
}

47
public function select_latest_products() {
$this->db->select("*");
$this->db->from('tbl_product');
$this->db->where('publication_status', 1);
$this->db->order_by('product_id', 'desc');
$this->db->limit(8);
$query_result = $this->db->get();
$result = $query_result->result(); return
$result;
}
public function select_featured_products() {
$this->db->select("*");
$this->db->from('tbl_product');
$this->db->where('publication_status', 1);
$this->db->where('product_status', 1);
$query_result = $this->db->get();
$result = $query_result->result();
return $result;
}
public function select_related_products($product_id) {
$this->db->select("category_id");
$this->db->from('tbl_product');
$this->db->where('publication_status', 1);
$this->db->where('product_id', $product_id);
$query_result = $this->db->get();
$result = $query_result->row();
$category_id = $result->category_id;
$this->db->select("*");
$this->db->from('tbl_product');
$this->db->where('publication_status', 1);
$this->db->where('category_id', $category_id);
$this->db->limit(3);
$query_result = $this->db-
>get(); $result = $query_result-
>result(); return $result;
}
public function check_login_info($email_address,$password,$registration_type){

48
$this->db->select('*');
$this->db->from('tbl_user');
$this->db->where('email_address',$email_address);
$this->db->where('password',$password);
$this->db->where('registration_type',$registration_type);
$query_result=$this->db->get();
$result=$query_result->row();
return $result;
}
public function save_user_info() {
$data = array();
$data['name'] = $this->input->post('name');
$data['email_address'] = $this->input->post('email_address');
$data['mobile_number'] = $this->input->post('mobile_number');
$data['dob'] = $this->input->post('dob');
$data['city'] = $this->input->post('city');
$data['password'] = md5($this->input->post('password'));
$data['address'] = $this->input->post('address');
$data['registration_type'] = $this->input->post('registration_type');
$data['gender'] = $this->input->post('gender');
/* Start Image Upload */
$config['upload_path'] = './profile_image/';
$config['allowed_types'] = 'gif|jpg|png|jpeg';
$config['max_size'] = 4000; $this->load-
>library('upload', $config); if (!$this->upload-
>do_upload('profile_image'))
{ $sdata['error'] = $this->upload-
>display_errors();
$this->session->set_userdata($sdata);
} else {
$fdata = $this->upload->data();
$data['profile_image'] = $config['upload_path'] . $fdata['file_name'];
}
/* End Image Upload */
$this->db->insert('tbl_user', $data);
$id = $this->db->insert_id();
$info = array();

49
$info['id']=$id;
$info['name']=$data['name'];
$info['registration_type']=$data['registration_type'];
return $info;
}
public function select_all_order() { $this->db-
>select("*");
$this->db->from('tbl_order');
$query_result = $this->db->get();
$result = $query_result->result();
return $result;}
public function delete_order_by_id($order_id){
$this->db->where('order_id',$order_id);
$this->db->delete('tbl_order');
}
public function select_billing_info($order_id){
$sql="SELECT * FROM tbl_user as c,tbl_order as o WHERE order_id='$order_id' and c.id=o.id";
$query_result= $this->db->query($sql);
$result=$query_result->row();
return $result;
}
public function select_shipping_info($order_id){
$sql="SELECT * FROM tbl_shipping as s,tbl_order as o WHERE order_id='$order_id' and
s.shipping_id=o.shipping_id";
$query_result= $this->db->query($sql);
$result=$query_result->row();
return $result;
}
public function select_order_details($order_id){
$this->db->select('*');
$this->db->from('tbl_order_details');
$this->db->where('order_id',$order_id);
$query_result= $this->db-
>get();
$result=$query_result->result();
return $result;
}

50
public function save_contact_info(){
$data = array();
$data['contact_name'] = $this->input->post('contact_name');
$data['email_address'] = $this->input->post('email_address');
$data['enquiry'] = $this->input->post('enquiry');
$data['captcha'] = $this->input->post('captcha');
$this->db->insert('tbl_contact', $data);
}
}//END
Source Code for Front End:
//START <?php defined('BASEPATH') OR exit('No direct
script access allowed');
/* class Welcome extends CI_Controller
{ */ class Welcome extends
CI_Controller { public function
index() { $data = array();
$data['title'] = "Home";
$data['featured_product'] = $this->Super_Admin_Model->select_featured_products();
$data['latest_product'] = $this->Super_Admin_Model->select_latest_products();
$data['publish_categories'] = $this->Super_Admin_Model->select_all_published_category();
$data['publish_manufacturer'] = $this->Super_Admin_Model-
>select_all_published_manufacturer();
// echo '<pre>';
// print_r($data['publish_categories']);
// exit();
$wish_count = $this->Wish_List_Model->select_wish_list_by_customer_id();
$data['wish_count'] = $wish_count;
$data['maincontent'] = $this->load->view('pages/home', $data, true); $this->load-
>view('master', $data);
}
public function category($category_id) {
$data = array();
$data['title'] = "Category";
// $data['all_published_category'] = $this->Super_Admin_Model-
>select_all_published_category();
$data['publish_categories'] = $this->Super_Admin_Model->select_all_published_category();
$data['category_products'] = $this->Super_Admin_Model-

51
>select_products_by_category_id($category_id);
$data['publish_manufacturer'] = $this->Super_Admin_Model-
>select_all_published_manufacturer();
$data['category_byid']=$this->Super_Admin_Model->getcategory_byid($category_id);
$data['maincontent'] = $this->load->view('pages/category', $data, true);
$wish_count = $this->Wish_List_Model->select_wish_list_by_customer_id();
$data['wish_count'] = $wish_count;
$this->load->view('master', $data);
}
public function about() {
$data = array();
$data['title'] = "About";
$data['publish_categories'] = $this->Super_Admin_Model->select_all_published_category();
$data['publish_manufacturer'] = $this->Super_Admin_Model-
>select_all_published_manufacturer();
$data['maincontent'] = $this->load->view('pages/about', $data, true);
$wish_count = $this->Wish_List_Model->select_wish_list_by_customer_id();
$data['wish_count'] = $wish_count;
$this->load->view('master', $data);
}
public function my_account() {
$data = array();
$data['title'] = "My account";
$data['publish_categories'] = $this->Super_Admin_Model->select_all_published_category();
$data['publish_manufacturer'] = $this->Super_Admin_Model-
>select_all_published_manufacturer();
$data['maincontent'] = $this->load->view('pages/my_account', '', true);
$wish_count = $this->Wish_List_Model->select_wish_list_by_customer_id();
$data['wish_count'] = $wish_count;
$this->load->view('master', $data);
}
public function compare() {
$data = array();
$data['title'] = "Compare";
$data['publish_categories'] = $this->Super_Admin_Model->select_all_published_category();
$data['publish_manufacturer'] = $this->Super_Admin_Model->select_all_published_manufacturer();
$data['published_product']= $this->Super_Admin_Model->select_featured_product();
$data['maincontent'] = $this->load->view('pages/compare',$data, true);

52
$wish_count = $this->Wish_List_Model->select_wish_list_by_customer_id();
$data['wish_count'] = $wish_count;
$this->load->view('master', $data);
}
public function shopping_cart() {
$data = array();
$data['title'] = "Shopping Cart";
$data['cart_js'] = true;
$data['cart_jquery'] = true;
$data['publish_categories'] = $this->Super_Admin_Model->select_all_published_category();
$data['publish_manufacturer'] = $this->Super_Admin_Model-
>select_all_published_manufacturer();
$data['maincontent'] = $this->load->view('pages/shopping_cart', '', true);
$wish_count = $this->Wish_List_Model->select_wish_list_by_customer_id();
$data['wish_count'] = $wish_count;
$this->load->view('master', $data);
}
public function checkout() {
$data = array();
$data['title'] = "Checkout";
$data['publish_categories'] = $this->Super_Admin_Model->select_all_published_category();
$data['publish_manufacturer'] = $this->Super_Admin_Model-
>select_all_published_manufacturer();
$data['maincontent'] = $this->load->view('pages/checkout', '', true);
$wish_count = $this->Wish_List_Model->select_wish_list_by_customer_id();
$data['wish_count'] = $wish_count;
$this->load->view('master', $data);
}
public function contact() {
$data = array();
$data['title'] = "Contact us";
$data['publish_categories'] = $this->Super_Admin_Model->select_all_published_category();
$data['publish_manufacturer'] = $this->Super_Admin_Model->select_all_published_manufacturer();
$data['maincontent'] = $this->load->view('pages/contact', '', true);
$wish_count = $this->Wish_List_Model->select_wish_list_by_customer_id();
$data['wish_count'] = $wish_count;
$this->load->view('master', $data);

53
}
public function store_contact() {
$this->Super_Admin_Model->save_contact_info();
$sdata = array();
$sdata['message'] = "Contact info save successfully";
$this->session->set_userdata($sdata);
$wish_count = $this->Wish_List_Model->select_wish_list_by_customer_id();
$data['wish_count'] = $wish_count;
return redirect('Welcome/contact');
}
public function product($product_id) {
$data = array();
$data['title'] = "Product";
$data['product_js'] = true;
$data['publish_categories'] = $this->Super_Admin_Model->select_all_published_category();
$data['product_byid'] = $this->Super_Admin_Model->select_product_info_by_id($product_id);
$data['publish_manufacturer'] = $this->Super_Admin_Model-
>select_all_published_manufacturer();
$data['related_products'] = $this->Super_Admin_Model->select_related_products($product_id);
$data['maincontent'] = $this->load->view('pages/product', $data, true);
$wish_count = $this->Wish_List_Model->select_wish_list_by_customer_id();
$data['wish_count'] = $wish_count;
$this->load->view('master', $data);
}
public function sitemap() {
$data = array();
$data['title'] = "Sitemap";
$data['publish_categories'] = $this->Super_Admin_Model->select_all_published_category();
$data['publish_manufacturer'] = $this->Super_Admin_Model-
>select_all_published_manufacturer(); $data['maincontent'] = $this->load->view('pages/sitemap',
$data, true);
$wish_count = $this->Wish_List_Model->select_wish_list_by_customer_id();
$data['wish_count'] = $wish_count;
$this->load->view('master', $data);
}
public function login_form() {
$data = array();

54
$data['title'] = "login";
$data['publish_categories'] = $this->Super_Admin_Model->select_all_published_category();
$data['publish_manufacturer'] = $this->Super_Admin_Model-
>select_all_published_manufacturer();
$data['maincontent'] = $this->load->view('pages/login_p', '', true);
$wish_count = $this->Wish_List_Model->select_wish_list_by_customer_id();
$data['wish_count'] = $wish_count;
$this->load->view('master', $data);
}
public function login() {
$email_address = $this->input->post('email_address', true);
$password = md5($this->input->post('password', true));
//$password = $this->input->post('password', true);
$registration_type = $this->input->post('registration_type', true);
$user_info = $this->Super_Admin_Model->check_login_info($email_address, $password,
$registration_type);
//echo '<pre>';
//print_r($user_info);
//exit();
$sdata =
array(); if
($user_info) {
$sdata['id'] = $user_info->id;
$sdata['name'] = $user_info->name;
$sdata['registration_type'] = $user_info->registration_type;
$this->session->set_userdata($sdata);
redirect('welcome/index');
} else {
$sdata['exception'] = "Your User Id Or Password Invalid !";
$this->session->set_userdata($sdata);
redirect('welcome/login_form');
}
$wish_count = $this->Wish_List_Model->select_wish_list_by_customer_id();
$data['wish_count'] = $wish_count;
}
public function logout() {
$this->session->unset_userdata('id');

55
$this->session->unset_userdata('name');
$this->session->unset_userdata('registration_type');
$this->session->unset_userdata('shipping_id');
$sdata = array();
$sdata['message'] = "You are successfully Logout !";
$this->session->set_userdata($sdata);
$wish_count = $this->Wish_List_Model->select_wish_list_by_customer_id();
$data['wish_count'] = $wish_count;
redirect("welcome/index");
} public function
register() {
$data = array();
$data['title'] = "Register";
$data['publish_categories'] = $this->Super_Admin_Model->select_all_published_category();
$data['publish_manufacturer'] = $this->Super_Admin_Model-
>select_all_published_manufacturer();
$data['maincontent'] = $this->load->view('pages/register', '', true);
$wish_count = $this->Wish_List_Model->select_wish_list_by_customer_id();
$data['wish_count'] = $wish_count;
$this->load->view('master', $data);
}
public function store_user() {
$reg_info = $this->Super_Admin_Model->save_user_info();
$this->session->set_userdata($reg_info);
$sdata = array();
$sdata['message'] = "User info save successfully";
$this->session->set_userdata($sdata);
$wish_count = $this->Wish_List_Model->select_wish_list_by_customer_id();
$data['wish_count'] = $wish_count;
return redirect('Welcome/index');
}
public function wish_list() {
$data = array();
$data['title'] = "Wish List";
$data['publish_categories'] = $this->Super_Admin_Model->select_all_published_category();
$data['publish_manufacturer'] = $this->Super_Admin_Model-
>select_all_published_manufacturer(); $data['wish_count'] = 0;

56
$data['product_info'] = $this->Wish_List_Model->select_product_info();
$wish_count = $this->Wish_List_Model->select_wish_list_by_customer_id();
$data['wish_count'] = $wish_count;
$data['maincontent'] = $this->load->view('pages/wish_list', $data, true); $this->load-
>view('master', $data);
}
}
//END

57

You might also like