Home » A Simple E-Shop Application Using PHP Comments and MySQL

A Simple E-Shop Application Using PHP Comments and MySQL

by tutorialsart

SPECIFICATION:

Write a simple E-shop application using PHP Comments and MySQL*. This may be a bookshop, music shop, clothes store, or anything else you wish. There should be a “user” interface to allow customers to select and purchase items (don’t worry about the payment side of things). Ideally there should also be a password-protected “owner” interface, to allow the E-shop operator to view/edit stock and pending orders.

The exercise is deliberately “hard” given the short deadline, and I do not expect everyone necessarily to complete it to perfection. This will be taken into account in the marking.

MARKING SCHEME:

[A 5%] Ability to write working HTML code (i.e. code that creates successful markup on a browser window).**

[B 5%] Ability to post an HTML web-page on a server such that it is visible on the World Wide Web. ***

[C 10%] Ability to make an HTML form communicate with a PHP script.**

[D 10%] Ability to make a PHP script interact with a MySQL database.**

[E 40%] Functionality (the extent to which the software’s operation complies with – or exceeds- the original specification).

[F 10%] User friendliness (the extent to which the browser displays are clear and self-explanatory).

[G 10%] Presentation. (This could include appropriate use of images, colour, text fonts, style-sheets and dynamic HTML functions.)

[H 10%] Clarity and readability of coding and related documentation (e.g. use of comments, appropriate indentation etc.)

NOTES:

*If you wish to use different web-based technologies (e.g. ASP, JSP, Pearl) please do so. However, please do NOT use high-level software packages which require no programming skills (e.g. “wysiwyg” HTML editors), as these rather defeat the purpose of taking this module.

** In categories A to D, the marks are awarded in a “binary” manner (i.e. the student receives either the entire weighting mark or else zero). Thus 30% can be obtained simply by demonstrating a basic knowledge of HTML, PHP and MySQL. The remaining categories are marked in a “continuous” fashion (i.e. any number of marks between zero and the weighting value can be awarded).

*** In the event of server failure (or other irresolvable technical difficulties) Category B will be removed and the weightings of the other categories scaled accordingly.

SOLUTION:

My electronic shop application is for the sale of books and other assorted item sold by the Wandle Industrial Museum.

This development is a logical extension to an existing static website. The data and basic layout of my application are derived from this pre-existing work.

THE MAIN INTERFACE:

the initial screen, not including the original frames used in the Museum website. Most of the content in the top and bottom frames is non functional and is included for completeness, this also helps demonstrate the dynamic HTML that provided secondary navigation structures.

This screen shown the main body of the shop information and the “shopping basket” functions at the button. This page provides access to:

1) A complete list of the online “catalogue”;

2) A subset of the catalogue listed by product category;

3) A subset of the catalogue based on user defined search terms;

4) More detailed information about an item;

5) Ability to add items to a session based “shopping basket”;

6) Ability you registered users to write book reviews;

If a user is new to the application, he/she is shown the message “Welcome. Already a customer? Click here to sign in”, otherwise they see their user name and a button to the right named “My account” which allows them to edit their information . This information is stored in a client side cookie that is retained for 30 minutes.

ABOUT THE SUMMARY DISPLAY:

The summary of items shows the item code, title, price, description and stock level of all items. The display also includes two additional other possibilities, 1 items that are out of stock are show in red text. 2 items that are not sold through the online shop are “grayed-out” in both these cases the “buy” button is removed from all displays for a given item.

THE BASKET:

The Basket Initially there is not shopping basket until the user adds an item, until such time clicking on the “view basket button shows a default screen.

When an item is added, its quantity is set to one by default, this can either be increased by adding the same item to the basket again or by clicking in the increment button on the basket display screen shown here. Once a basket is created and the user enters the system the following options are available under the product description:

1) Clear cart;

2) Continue shopping;

3) Checkout;

If the item is de-incremented to zero then it is removed from the basket.

The basket is based on PHP sessions and unlike the users identity, which is reined for 30 minutes, will not persist after the instance on the browser is closed.

If the user is unknown to the application when he/she attempts to complete the transaction, they will be asked to sign in, if the user has an account he/she can login and continue with the transaction.

If the user has not got an account he/she must register before being able to finish buying anything.

ADDING ITEMS TO THE SHOPPING BASKET:

Items can be added to shopping basket either from any summary listing, or an item description page.

A summary page displays basic item information in a tabular format whithout images, such as the one shown right by clicking on the “buy” button at the left on the item line.

This can also be done from the item detail page, which is displayed by clicking the items code shown on the left of the summary display.

Each item detail page also includes a “buy” button as well as the other shopping basket tools” These are on the summary page but at the bottom so require scrolling

The database supports two forms of items, “books”, as shown above, which include information specific to reading materials, and “goods” which only include basic item information, item code, title and price.

Where images ae not available a replacement is automatically instituted until the administrator specifies a real image.

ABOUT THE USER:

If the user is unknown to the application when he/she attempts to complete the transaction, they will be asked to sign in, if the user has an account he/she can login and continue with the transaction

If the user has not got an account he/she must register before being able to finish buying anything. Here we see the effect of an invalid attempt to register a new account. The user is given a text description of the error and the suspect entities are highlight in sequence until all anomalies have been resolved.

After the user has registered he/she is asked to print the form for his/her reference. Then is logged in and can bypass authentication when buying.

The application has been hard coded with one administrative account, the username is “system” and the password is “god” Note there is currently no way to change this.

The administration display allows the users to:

1) define new item types;

2) Edit and delete users;

3) Add, edit and delete categories;

This screen allows the user to either edit an existing data item in a given category identified by its product code or create a new product date item. The application includes a specific set of validation criteria as shown in the next image. Items are listed alpha numerically, left to right.

Here we see the result of a failed data entry operation denoted by crosses to denote invalid or missing entries for given fields, likewise a tick indicates the field is valid.
It is possible to have a blank correct entry – eg, if there are no images these boxes should be left clear.

The question mark is to double check the intention to leave blank in certain cases

This screen shows that theadministrator has chosen to delete a user’s account from the database – the edit and delete functions use the same display except that the edit function does not show the delete warning

The interface The image shows the initial (welcome) screen, not including the frames used in the Museum website.

This screen shown the main body of the shop information and the “shopping basket” functions at top and the button. This page provides access to:

1) A complete list of the online “catalogue”;

2) A subset of the catalogue listed by product category;

3) Ability to order the catalogue listed by product code, price or title, in acceding order;

4) A subset of the catalogue based on user defined search terms;

5) More detailed information about an item;

6) Ability to add items to a session based “shopping basket”;

If a user is new to the application, he/she is shown the message “Welcome. Already a customer? Click here to sign in”, otherwise they see their user name and a button to the right named “My account” which allows them to edit their information. This information is stored in a client side cookie that is retained for 30 minutes.

The administration display allows the users to:

1) Define new item types;

2) Edit and delete users;

3) Add, edit and delete categories;

4) Add, edit, move and delete products;

5) Edit and add help information;

6) Create and restore dumps of tables;

 

You may also like

Leave a Comment