Bazaar app enable management of sell offers from variety of registered clients. Main project focus on database design and implementation, login implemantation with SESSIONS extended with support of COOKIES, maintaining access to scripts along user roles. Our first part of series will explain basic interaction among pages and show page design expectation.
Enumeration of app expectation
Our Bazaar app will enable manage listenings for sell of used things. Functionality must be limited for registered users and some of management capability can be available only for admin user.
During process of preparation we expanded our first thoughts and adding new fatures as item cart or user roles.
Requirements for our app:
- unregistered user must be able view all sell listenings on index.php page
- list of items for sell must display last 5 products and user must be able select interesting category from drop-down menu
- for all items must be available closer look page with further display and link to buy
- only registered users can add itmes to a cart – for cart management we use column cart_number. If cart number is 0, item is available for buy. If this number is changed to users_id then item is not displayed anymore and is added into a cart of user (there is some dificulty, how to after some time release listening and reset number to 0 after some expiration period)
- application will demonstrate mechanism for sinup user with login functionality
- for user login persistency combination of SESSION with COOKIES mechanism will be used
- on admin page and editprofile page is shown different content for loged in or unloged user
- user can signin into a common user role with signup form
- only admin has granted full access to admin page
- registered user can add item to sell listening, but item is displayed only after admin approval of content
- admin can manage categories available on bazaar portal
Block diagram of main page scripts
Next picture show names of main page scripts and flow during user work. Some pages/ scripts will be added next in development process for support of new important functionality. This solution depicts traditional, procedural approach for developmnet of PHP aplications.
Code scripts can be separated into a three main category: 1 – database creatonal scripts with further database altering scripts, 2 – cascade styles scrypts and 3 – main page scripts.
Description some of them:
createdatabase.php – main script for creating three database table for category, item and user data persistency.
alter.php and altercart.php – minor updates and addins into a existing database table. Up to a time of preapartion of this article user_role to bazaar_user table was added and cart_number in bazaar_item was added for support of user cart functionality.
index,php – main page with signup, login and logout functionality. Display will differ for unloged and loged in user. man contentent of the page are two table outputs os listened items for sell. persistent display show 5 latest listenings. Uper part enable select form dropdown menu category of interest for appropriate user and next show all listed items. Further improvement will be pagination of results.
login.php, logout.php and signup.php – all these scripts suport access management into a content of the page. Unregistered user must sign up with unique e-mail and name. Some of important data can be added itno a database next with editprofile.php script.
item.php and buyitem.php – all items listened on main index page have link leading into a item.php page. from GET data is obtained item_id that select form database all information provided to listed item. On item.php page is ling into a buyitem.php page. This page is avalable only for registred user and enable change cart_number data from 0 to users_id of appropriate user. This way we mark listed item as added into a user cart for further buy fullfilment (this option must be discused next, at time of writting tis article is not in a final stage).
cart.php – (on progress) – show all items marked with apropriate users_id of the loged user and show total price for all listened items. This page is a way for fullfil buy process and send info to site admin/ seller to arrange all important things for correct buy/sell process. (This part need further improvement of functionality, because to sell listening user must be marked in bazaar_item table with their users_id).
sellitem.php – enable add ifnfo about selled product.
editprofile.php – any further information about registered user is contained in this part of page.
admin.php with removeitem.php and managecategory.php and removecategory.php – access to this pages is enabled only for admin role of the user. This part enable change state of published boolean filed from 0 to 1 for display item to sell. All page categories can be managed through these gages.
appvars.php – central page with all important constants included on top part of pages in any other scripts.
Showcase of frontend and backend for bazaar app
This part show visual look of appropriate pages in state of time whne this article will be written. Further improvements will be added in next weeks during development and testing process.
Next photogallery shows additional page designs and dialog outputs for further reference what to expect from the project.
Conclusion and source code
In our first article focused on bazaar app page we make basic fundation about main page script and their interactions. During proces of description arrisen some new questions about ways how to extend functionality to fullfil requirements for working portal enabling selling and buying used goods from common users.
Ful code of the projects in as is state can be obtained from github here.