Shopping Cart Tutorial PHP Shopping Cart Tutorial
Learn how to create an online store with PHP and MySQL
Free shopping cart    Download:
Shop-Script FREE
Shop-Script FREE User Guide (PDF; 0 Kb)
View Live Demo    View online store demo
 Introduction
 Basic concepts
 Technologies
 File structure
 Database structure
 Back end
   Password protection
   Products catalog: structure
   Product catalog: viewing
   Managing categories
   Managing products
   Special offers
   Managing orders
 Front end
   Viewing products catalog
   Product search
   Shopping cart
   Checkout
   PayPal integration
 Security
 Live Demo
 Author
 Terms Of Use

Shopping cart software

 

Managing orders

We will review the basic facility of viewing orders list and the ability to delete orders.

To learn how orders do get into ORDER database table please read Checkout process description .
Order list can be easily fetched from the ORDER table using following SQL query:

SELECT orderID, order_time, cust_firstname, cust_lastname, cust_email, cust_country, cust_zip, cust_state, cust_city, cust_address, cust_phone FROM `ORDER` ORDER BY `orderID`;

This query will return all orders sorted by orderID field (ORDER table primary key) in ascending order.

Now we can easily show all fetched orders on a web page using Smarty:

When showing order list make sure to transform orders data to a safe form by replacing < and > symbols to &lt; and &gt; accordingly. Please refer to Security page  for more details.

If you would like to delete a certain order simply click "Delete" button against the order record, and the following SQL query will be executed:

DELETE FROM `ORDER` WHERE orderID=`$orderID_to_delete`;

There is absolutely no difficulties in viewing orders list with such basic functionality.
Of course, there could be many advanced features for orders management, e.g. order statuses, invoices, shipping labels and many more. Usually such facilities are supported in commercial shopping cart software, because they are far more difficult to implement and requires advanced PHP programming skills from developer. Unfortunately we do not the ability to discuss these features in this tutorial.

 

 


Copyright © 2006 WebAsyst LLC