Example of marketplace using MongoDB and HTML, CSS, Bootstrap, JavaScript, jQuery, AngularJS, PHP
In this marketplace you can explore and buy products from partner stores!
As admin you can add/edit products, stores
As user you can register, add products to cart from many stores, order, comment on products and see order history.
Note that the website is in greek language so many features will be difficult to use.
In this DB we have 3 collections that the website uses a) loginreg b) stores c) orders
loginreg: This collection has only one document named userdata and it stores the data of the users who register through the corresponding form. By default all users in the privileges field have the attribute "customer". Tochange "customer" to "administrator" the corresponding query must be executed. In our collection we have 2 users where one is administrator and the other customer. Note: Passwords pass through a hash function.
stores: Here We also have a document called storeinfo where we keep the details of the store, the products it sells and the product reviews.
- Note 1: _id, pID, as well as pTHUMBNAIL have been used as sku (stock-keeping unit) for the search and implementation of various procedures. For example, I can search for products based on their thumbnail since I believe that every same product will have this thumbnail. Logic is wrong I should have used a SKU code. No such procedure was implemented because every time the administrator adds a product he has to look for which code to enter, etc.
- Note 2: Commends are added to the product with the push method, so if the product has no comments then it will not have the corresponding field "pCOMMENTS".
- Note 3: nextProductCounter refers to the total products that the store has +1.
orders: In this collection we have only the document orderinfo. For each order made, an entry is added. As mentioned before, the thumbnail is used as a SKU. Also for each product you order a different collection is created. For example, if in an order we have 3 products in the basket, 3 entries will be created in the document and not 1 single. This is done so that we can easily delete orders from different stores.
Assets
Css all the stylesheets used.
Img -> all the photos used, among them we have logo, favicon, banners, footer photos, product photos, homepage photos, some avatars for testimonials.
Js -> js files for voicesearch, smoothscrool, search and myscript. Myscript is used to open and close forms after reloading pages.
Incudes -> Here we have many key important feauters of the site. We have all forms as well the action forms that establise the communication/modification of the db. We will also find some files for viewing the header, menu on mobiles.
index.php -> homepage
marketplace.php -> in this page you can see all the available products
product-preview.php -> dynamic view of selected product
cart.php -> cart page
contact-us.php -> contact us page
Coppy pricedoc folder to the httdocs folder of XAMPP.
Install MongoDB and Database tools
Download mongoDB folder, open cmd inside the folder and then import the collections with the following commnads:
mongoimport --db loginreg --collection userdata --jsonArray --file pathToFolder/mongoDB/userdata.json
mongoimport --db stores --collection userdata --jsonArray --file pathToFolder/mongoDB/storeinfo.json
mongoimport --db orders --collection userdata --jsonArray --file pathToFolder/mongoDB/orderinfo.json
Open XAMMP app and run apache server
Login credentials
Admin
username: alex@gmail.com
password: 1234User
username: john@gmail.com
password: 1234