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 < and > 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.



0 comments:
Post a Comment