Home PHP

PHP Shopping Cart & Ordering Module – Source Code – Download Now!

Contents of this post include:

1.0 Output Preview & Demo Link
2.0 Pre-Requisites
3.0 Cart Data Storage
4.0 File Structure
5.0 What People Say?
6.0 Features List & Download
7.0 Simple Set Up
8.0 Need More Features?
9.0 Related Source Codes
10.0 Get In Touch

1.0 Output Preview & Demo Link

The following slideshow is the output preview of this source code.

Customer Section Output Preview:

Admin Section Output Preview:

If you need the live demo link, send a request to mike@codeofaninja.com with subject “PHP Shopping Cart Module”, thank you!

Note: The “PHP Shopping Cart Module” is also called the “LEVEL 3 source code” of our PHP Shopping Cart Tutorials – PHP SESSIONS, PHP COOKIES and MySQL.

2.0 Pre-Requisites

Before you download, make sure you have basic understanding of these topics:

a. PHP Object Oriented CRUD Example with Bootstrap
b. Apache .htaccess RewriteRule Examples with PHP

3.0 Cart Data Storage

This source code takes advantage of PHP SESSIONS, PHP COOKIES and MySQL when storing cart data.

  • We use PHP COOKIES to save site visitor’s user_id locally.
  • We use PHP SESSIONS as back up just in case cookies are disabled in user’s browser.
  • We use MySQL to store cart items in the database.
  • This way, cart items can be resurrected even if user closed his browser, logged out or logged in another computer.

Here’s the logic:

IF cookies are enabled, AND if user is logged in, we save ‘session user_id’ to ‘user_id variable’. The value of ‘user_id variable’ is very important because we use it to save ‘user_id’ both in PHP ‘cookie’ and ‘session’.

IF cookies are enabled, AND if user is not logged in, AND if user already have a ‘cookie user_id’ token, we save ‘cookie user_id’ to ‘user_id variable’.

IF cookies are enabled, AND if user is not logged in, AND if ‘cookie user_id’ is not set (it means, visitor never used the cart before), we get new token as ‘user_id variable’ value.

IF cookies are enabled, AND user is logged in OR not logged in, we set ‘cookie user_id’ and ‘session user_id’ with the final ‘user_id variable’ value. This will retrieve the cart data with the same ‘user_id’ from MySQL database.

IF cookies are disabled, AND user is logged in, we maintain ‘session user_id’.

IF cookies are disabled, AND user is not logged in, we get new token and save it to ‘session user_id’.

Important Note: The statements above can be understood more clearly if you will see the code implementation on /config/core.php line 26 onwards.

4.0 File Structure

The following folders and files are included in our source code. It will have more meaning if you will see the code inside the folders and files.
├─ admin/
├─── category.php
├─── change_order_status.php
├─── create_product.php
├─── create_user.php
├─── create_image.php
├─── delete_pdf.php
├─── delete_product.php
├─── delete_user.php
├─── layout_foot.php
├─── layout_head.php
├─── login_checker.php
├─── navigation.php
├─── order_history.php
├─── paging.php
├─── read_inactive_products.php
├─── read_one_order.php
├─── read_orders_template.php
├─── read_orders.php
├─── read_products_sorted_by_fields.php
├─── read_products_template.php
├─── read_products.php
├─── read_users_template.php
├─── read_users.php
├─── search_orders.php
├─── search_products.php
├─── search_users.php
├─── update_product.php
├─── update_user.php
├─ config/
├─── core.php
├─── database.php
├─ dev/
├─── shop_cart_ordering_module.sql
├─── readme.txt
├─ images/
├─ libs/
├─── css/
├────── bootstrap/
├────── admin.css
├────── user.css
├─── js/
├────── bootstrap-image-gallery/
├────── jquery-ui/
├────── yellow-text/
├────── bootbox.min.js
├────── custom-script.js
├────── jquery.js
├─── php/
├────── php-mailer/
├────── pw-hashing/
├────── utils.php
├─ objects/
├─── cart_item.php
├─── category.php
├─── order_item.php
├─── order.php
├─── product_image.php
├─── product_pdf.php
├─── product.php
├─── user.php
├─ uploads/
├─── images/
├─── pdfs/
├─ .htaccess
├─ add_to_cart.php
├─ cart.php
├─ category.php
├─ checkout.php
├─ empty_cart.php
├─ info.php
├─ layout_foot.php
├─ layout_head.php
├─ login_checker.php
├─ login.php
├─ logout.php
├─ navigation.php
├─ orders.php
├─ paging.php
├─ place_order.php
├─ product.php
├─ products.php
├─ read_one_order.php
├─ remove_from_cart.php
├─ search.php
├─ update_quantity.php

5.0 What People Say?

Here are some of the things people say about our source code downloads.

★★★★★ “I have purchased both your (PHP) CRUD Level 2, and Level 3 applications so that I can improve my programming skills. YOU’RE THE MAN! I would say that I should have contacted you three days ago, I learned a lot!!!”

Kevin Richards
Web Developer, Recruiter Solutions

★★★★★ “Mike, thank you for the great (PHP CRUD) tutorial and quick response, I finally figured it out and got it working!”

Ira Rabinowitz
Web Developer & Designer, LinkedIn Profile

★★★★★ “Awesome! everything is looking great (PHP Shopping Cart). You’re my new hero this is all great. We couldn’t be happier. You will be paid more.”

Joshua Duncan
Product Manager, LinkedIn Profile

6.0 Features List & Download

Create userAdminYES
Read usersAdminYES
Update userAdminYES
Delete userAdminYES
Search userAdminYES
Users list paginationAdminYES
Valid email format requiredAdmin & CustomerYES
Password must be uppercase letter, lowercase letter, number and special characterAdmin & CustomerYES
Confirm password fieldAdminYES
Password validation as you typeAdminYES
View customer order historyAdmin & CustomerYES
Deleting first administrator account is not allowedAdminYES
User types: Admin and CustomerAdmin & CustomerYES
Interface for adminAdminYES
Interface for customerCustomerYES
Login pageAdmin & CustomerYES
Log outAdmin & CustomerYES
Edit profile of currently logged in userAdminYES
Show name with icon of currently logged in userAdmin & CustomerYES
Create productAdminYES
Read productsAdminYES
Update productAdminYES
Delete productAdminYES
Search productAdmin & CustomerYES
Product lists with paginationAdmin & CustomerYES
View inactive productsAdminYES
View products under a categoryAdmin & CustomerYES
Product list under a category with paginationAdmin & CustomerYES
Upload product images, you can select many images at onceAdminYES
View product images with thumbnailsAdmin & CustomerYES
Delete product image with X iconAdminYES
Upload product PDFs , you can select many PDF files at onceAdminYES
List product PDFAdminYES
Delete product PDFAdminYES
View single product with related informationCustomerYES
View single product with add to cart buttonCustomerYES
View single product with image sliderCustomerYES
View single product with SEO friendly URL (.htaccess file used)CustomerYES
Rich text editor for product description when adding or editing productAdminYES
Quantity value must be more than 1CustomerYES
Sorting by fieldsAdminYES
View products under a product categoryAdmin & CustomerYES
Highlight selected category in navigationAdmin & CustomerYES
Make an orderCustomerYES
Auto-generated unique transaction IDCustomerYES
Add to cart button (for each item) with specified quantityCustomerYES
Cart page with list of products added to cartCustomerYES
Update quantity button for each item in cart pageCustomerYES
Auto-compute subtotal in cart pageCustomerYES
Auto-compute grand total in cart pageCustomerYES
Remove from cart button for each item in the cartCustomerYES
Empty cart button to remove all items in the cartCustomerYES
View order history of a customerAdmin & CustomerYES
View pending and completed order in separate tabsAdminYES
Checkout pageCustomerYES
Show billing information on check-out pageCustomerYES
Show payment information on checkout pageCustomerYES
Payment via cash on deliveryCustomerYES
Place order page – Thank you messageCustomerYES
View list of ordersCustomerYES
Pagination on list of ordersAdmin & CustomerYES
Latest order seen at the top of the listAdmin & CustomerYES
View details of an orderAdmin & CustomerYES
Auto-compute order totalsAdmin & CustomerYES
Change status of an order (pending or completed)AdminYES
Register user hashed password stored in the databaseCustomerYES
Edit user profile hashed password update in the databaseAdminYES
Create user hashed password stored in the databaseAdminYES
Login user with hashed password validationCustomer & AdminYES
Used PDO bindParam() to prevent SQL injection in all MySQL queriesDeveloperYES
Used PHP htmlspecialchars() & strip_tags() to prevent XSS attacksDeveloperYES
Object oriented programming source codeDeveloperYES
Bootstrap user interfaceDeveloperYES
PDO extension usedDeveloperYES
Page title navigation with linksDeveloperYES
Radio button looks like a switchDeveloperYES
Icon in all create, edit and delete buttonsDeveloperYES
All source code files organized by foldersDeveloperYES
Database configuration file in config folderDeveloperYES
SQL file and READ-ME.txt in “dev” folderDeveloperYES
Database design and data dictionary in “dev” folderDeveloperYES
Well explained / commented source codeDeveloperYES
Free source code updates / new features updatesDeveloperYES
Free support for 6 monthsDeveloperYES
Buy once, use for unlimited number of sitesDeveloperYES
One-time payment, no recurring paymentDeveloperYES

7.0 Simple Set Up

Source code simple set up when you install:

1. Extract the ZIP file to your server directory.

2. In your PhpMyAdmin, create a database “shop_cart_module”

3. Import the “shop_cart_module.sql” SQL file in the “dev” folder

4. Change rewrite base directory in line 7 of .htaccess file (if needed)

5. Change $home_url in /config/core.php (if needed)

6. Configure database in /config/database.php

7. Run product.php – this is the main file, not index.php

8. User Login
Admin Section Login
Username: mike@example.com
Password: ninja12qw!@QW

Customer Account Login
Username: darwin@example.com
Password: darwin12qw!@QW

How To Make TinyMCE File Manager / File Browser Work?

1. Change line 71 of /libs/js/responsive_filemanager/filemanager/config/config.php

'upload_dir' => '/YOUR_ROOT_DIRECTORY/libs/js/responsive_filemanager/source/',

2. Change line 42-43 of /admin/layout_foot.php

external_plugins: { "filemanager" : "/YOUR_ROOT_DIRECTORY/libs/js/responsive_filemanager/filemanager/plugin.min.js"},

I’ll keep you updated via email with the update information and download link. Download the source code by clicking the green button below. Once your payment was sent, you’ll receive the download link on your email.

8.0 Need More Features?

If you think you now need more features, you can try our “PHP Shopping Cart System” – it has highly related and useful features for your PHP shopping cart project.

Below are some screenshots of the system’s output. You can click an image to view the larger version of it. Use the left and right arrow to navigate through the screenshots.

Please note that the following images are just output previews. New features might be added already the time you are reading this.

Output preview when customer is not logged in.

Output preview when customer is logged in.

Output preview when admin / merchant is logged in.

To learn more and to download our PHP Shopping Cart System, Click Here.

Related Source Code Modules

You can download the PHP SHOPPING CART SYSTEM by modules. Learn more by clicking any 'View Module' button below.

PHP Users & Login System
PHP Product Catalog
PHP Shopping Cart & Ordering
PHP Web Page Content Management
PHP Contact Form & Messages
PHP & PayPal Integration

You can download the different modules right now by checking multiple check-boxes and clicking the "Download Now" button below.

Download Now

10.0 Get In Touch

Contact me if you have any questions about the code, I’ll be more than happy to help and support you!

My email is mike@codeofaninja.com, you can also contact me via our official Facebook page.

Please subscribe as well to receive news and updates about our source codes and free tutorials. Fill out the form below.

  • 1. We are currently building more high quality tutorials about Vue.js, PHP, Laravel, CakePHP, and Social Media APIs.
  • 2. If you want any of these skills in your resume, please subscribe using the form below. IT'S FREE!
100% Privacy. We will never spam you!

Thank you visiting our for PHP Online Shopping Cart Source code download page!