• Nenhum resultado encontrado

Developing E-Commerce web-site using Zend Framework and MySQL database

N/A
N/A
Protected

Academic year: 2023

Share "Developing E-Commerce web-site using Zend Framework and MySQL database"

Copied!
37
0
0

Texto

The main methodology in this thesis is qualitative research, mainly conducting several interviews for requirements gathering and analysis. In conclusion, the web owner is satisfied with www.mocaymart.com and this website is rated as the most important factor in their startup plan. Currently, many e-commerce websites such as www.amazon.com, www.ebay.com or www.alibaba.com etc.

Project background

The invention of the internet accelerated the exchange of information and made it possible to make various resources accessible worldwide. The charts above show that food consists of a significant ratio in product categories chosen by Vietnamese shopper and the two most popular payment methods are "Cash on delivery". The website is almost finished and it was published in May 2014, the default language is .

It is developed based on the need of the customer who owns the website www.mocaymart.com. I am responsible for building the website in all phases: design, database design, front-end development, back-end development and search engine optimization (SEO). Due to the fact that the vast majority of clients are Vietnamese, the website is hosted on the server in Vietnam for maximum web surfing performance.

Figure 1: Online shopping product categories in Vietnam 2013
Figure 1: Online shopping product categories in Vietnam 2013

Project objective

Thesis research method

Back-end development: To code the behind-the-scenes elements that communicate with the web server and the database server. Search Engine Optimization (SEO): Making the website friendlier to search engines like Google, Bing and Yahoo by optimizing HTML tags and performing link building, blacklist checking, etc. However, this thesis concentrates on only 3 phases: the graphical user interface design, database design and back-end development.

Zend framework

Web application framework introduction

According to this chart, PHP and ASP.NET are dominant programming languages ​​used in web application framework with a percentage of almost 75%. There are some reasons that make PHP the most popular programming language in web development. PHP is open source and free to use, easy to learn especially for developers who have a background in C and Java.

PHP is fast to develop, so it is the good choice for small and medium size website.

MVC architecture in Zend framework

For example, when the controller receives the request to retrieve customer information, it interprets the request into action based on predefined business logic that executes the database retrieval from the Model layer. Model: This layer defines the data access routines and some business logic in order to establish the connections to the database for retrieving the data. Appearance: The appearance layer is responsible for creating the user interface that is visible to the web user.

For example, a view layer renders data received from a controller in some format defined by Hyper Text Markup Language (HMTL) and Cascading Style Sheet (CSS). Separating the model, view, and controller when designing a web application simplifies the coding and maintenance of the website. For example, if a web developer wants to use an additional database for a new module, he or she just codes a model layer that supports the new database.

Figure 4: MVC pattern in Web application
Figure 4: MVC pattern in Web application

Zend framework advantages

MySQL database

Register page Buyer who would like to become the user of www.mocaymart.com website can fill the registration form which contains username, password and personal data. In the case of www.mocaymart.com, the tool used for this stage is activity diagram for describing the activities of online buyer and use case diagram that describes the interaction between website and users such as web administrator, online buyer, etc. Registered customers: Those who register the account on www.mocaymart.com by providing the username, password and other personal data.

The website www.mocaymart.com uses Zend framework which is a PHP web application framework as the latest technology. The “index.php” file in the Zend framework plays the role of the receptionist who receives all the requests from the web user and accordingly sends its appropriate component for further processing. Boostrap.php” and “applica-tion.ini”, on the other hand, contain the database connection information, the default module, the path to the Zend framework library, etc.

The controller layer in the Zend framework handles the request received from submitting the "index.php" file. For example, when a web user clicks on the URL http://www.mocaymart/Front/cart/removecart, the "CartController" in the "Front" module is handled first. At www.mocaymart.com, each table in the database is represented by a single class, and the table name and class name must be the same.

This thesis describes the phases of graphical user interface design, database design and back-end development in the development process of www.mocaymart.com website. Next, back-end development is conducted using Zend framework to create the dynamic content for the website. Currently, the web user amount of www.mocaymart.com website is increasing and its contribution to the success of the web owner's business is highly evaluated.

Do you think that the website www.mocaymart.com plays a vital role in your business project?

Graphic user interface and dabase design

Customer requirements

The website is developed for an e-commerce startup, so the client needs some basic features for it. Product information portal: The website should contain short and complete product information such as price, discounted price, image, name, short description and full description. Cart features: Online users can add a product to the cart, remove, edit, or add a new product to an existing cart.

Payment Functions: Users are able to do the payment process after selecting their purchase product. As per the above requirements, I generated the website interface samples using HTML, CSS and sent to the client for approval. The final interface of the website and the organization of the website are decided based on the meeting between the client who is the owner of the website and me as the developer of the website.

Sitemap and web interface

For example, the forms for users fill in delivery address, personal data, payment method, etc. In general, the user page consists of 4 functions: Information portal, shopping cart related functions, contact form and user login. After the sitemap and web page description are finished, I generated the web interface as the following images.

Product category pages Show brief information of products in each category such as image, name, price, discount price. Product pages Show complete information about products like full images, name, price, discount price, in stock status, short description, full description. Order Confirmation Shows the order details such as amount, delivery time, delivery address, payment method, order number (six digits) etc.

Change delivery address Let buyer choose another address for delivery Cancel order Buyer can cancel order by email to web administrator Add products to order Buy new products in the same existing order. Contact form Contact us page Let buyer send the message to web administrator by filling contact form. Login Page Users can login to his or her account by providing valid username and password.

Figure 6: The sitemap of www.mocaymart.com
Figure 6: The sitemap of www.mocaymart.com

Database design

Requirements collection

According to the online shopper activity diagram, there are two types of internet users which are described as below. The website does not record their information and they are not subject to certain campaigns such as special offers for regular customers, newsletter service, etc. They get some benefits compared to anonymous customers like special offers that are only available to registered customers, newsletter. service, discount coupon, etc.

Web administrators, on the other hand, are responsible for two main tasks: web content management such as posting new product information or updating website data and order management such as getting order information, order confirmation, order cancellation, etc.

Figure 11: www.mocaymart.com website online shopper activity diagram
Figure 11: www.mocaymart.com website online shopper activity diagram

Database design

Back-end developing

  • Zend framework configuration
  • Controller layer developing
  • Model layer developing
  • View layer developing

Each controller class implements the "Zend_Controller" class which is the backbone of the Zend framework MVC. The mechanism of the controller layer is described in more detail via the sample "CartController.php" file attached. This controller belongs to the "Front" module and is responsible for controlling all actions related to the shopping cart, such as "add to cart", "update item", "delete cart".

There are 4 public functions in this controller: "indexAction", "addtocartAction", "updateitemAction" and "removecartAction" which perform the actions of "open the shopping cart page", "add the products to shopping cart", "update the quantity of items add to shopping cart" and "remove entire items from shopping cart" respectively. Accordingly, this controller executes the function “removecartAction” to remove all items from existing shopping cart. Model in Zend framework is not only the means for data access but actually represents a system's data and behavior.

For example, the "CartItem.php" and "Cart.php" are 2 classes in the model layer, which maintain the product ID, quantity and price data of each item when the web user adds new products to the cart. That information is used at checkout when the total number of items in the cart is calculated for payment. The “product” class inherits from “Zend_Db_Table_Abstract” so that it can retrieve the product table data records in the database.

According to this, the shopping cart page has 3 parts: the header and footer section, which renders the "header.phtml" and "footer.phtml" files, respectively, and the main section, which renders the file as figure 23. Index .phtml” file in this example is responsible for rendering the main body of shopping cart page. Accordingly, "index.phtml" file returns information of all subcategories through PHP functions called "foreach" and "echo".

Figure 17: application.ini file in www.mocaymart.com website
Figure 17: application.ini file in www.mocaymart.com website

Imagem

Figure 1: Online shopping product categories in Vietnam 2013
Figure 2: Payment methods of Vietnamese online shoppers in 2013
Figure 3: Web application framework usage by programming language on August 2014
Figure 4: MVC pattern in Web application
+7

Referências

Documentos relacionados

Alinha o ponto decimal do número que tem o menor expoente para igualar ao expoente do número que tem maior expoente. Maior chance de resultado