Admin Control Panel

 

Our shopping cart admin page consist of the following :

  • Category
    • Add Category
      Add a new category.

    • View Category
      List all the category we have. We can also see all the child categories and show many products in each category

    • Modify Category
      Update a category information, the name, description and image

    • Delete Category
      Remove a category. All products in it will be set to have cat_id = 0.

  • Product
    • Add Product
      Insert an item into our store. We also need to supply the product image and we'll create a thumbnail automatically from this image

    • View Product
      View all the products we have. Since our online shop can have many products we can view the products grouped by category.

    • Modify Product
      Modify product information. We can also remove the product image from this page

    • Delete Product
      Remove a product from the shop

  • Order
    • View Orders
      Here we can see all the orders we have and their status. When you click the "Order" link on the left navigation you will go straight to the "Paid" orders. The reason is so you can respond immediately upon your customers that already paid for their purchase.

    • Modify Orders
      Sometimes a customer might contact us saying that she made the wrong order like specifying the wrong product quantity or simply want her order cancelled so she can repeat the buying process again. This page enables the admin to do such a thing.

  • Shop Configuration
    This is where we can set and change our online shop appearance, behaviour and information ( like the shop name, main url, etc ).

Below is what admin main page ( admin/index.php ) look like.

Online Shop Main Admin Page

 

By the way the shopping cart name is PlainCart :-)

Each sub-module (category, product, etc) will have similar file structure. They are :

  • index.php
  • list.php
  • add.php
  • modify.php
  • process<sub-module name>.php

The admin/index.php only serves as a simple display when the admin enters the administrator section. On this page (and all other pages in the admin sections ) we check if the one requesting the file is already logged in or not. This way we can be sure that anyone who plays around with the admin pages are those who have the required permission.

All admin pages will be using the same template so they will all look alike. Basically each admin file will set the page title, what javascript to include and the main content. If you want to customize the look of the admin pages you only need to modify the template and the css file ( admin.css ) . Here is the code for template.php

Source code : admin/include/template.php

<?php
if (!defined('WEB_ROOT')) {
   exit;
}

$self = WEB_ROOT . 'admin/index.php';
?>
<html>
<head>
<title><?php echo $pageTitle; ?></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="<?php echo WEB_ROOT;?>admin/include/admin.css" rel="stylesheet" type="text/css">
<script language="JavaScript" type="text/javascript" src="<?php echo WEB_ROOT;?>library/common.js"></script>
<?php
$n = count($script);
for ($i = 0; $i < $n; $i++) {
if ($script[$i] != '') {
echo '<script language="JavaScript" type="text/javascript" src="' . WEB_ROOT. 'admin/library/' . $script[$i]. '"></script>';
}
}
?>
</head>
<body>
<table width="750" border="0" align="center" cellpadding="0" cellspacing="1" class="graybox">
<tr>
<td colspan="2"><img src="<?php echo WEB_ROOT; ?>admin/include/banner-top.gif" width="750" height="75"></td>
</tr>
<tr>
<td width="150" valign="top" class="navArea"><p>&nbsp;</p>
<a href="<?php echo WEB_ROOT; ?>admin/" class="leftnav">Home</a>
<a href="<?php echo WEB_ROOT; ?>admin/category/" class="leftnav">Category</a>
<a href="<?php echo WEB_ROOT; ?>admin/product/" class="leftnav">Product</a>
<a href="<?php echo WEB_ROOT; ?>admin/order/?status=New" class="leftnav">Order</a>
<a href="<?php echo WEB_ROOT; ?>admin/config/" class="leftnav">Shop Config</a>
<a href="<?php echo WEB_ROOT; ?>admin/user/" class="leftnav">User</a>
<a href="<?php echo $self; ?>?logout" class="leftnav">Logout</a>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p></td>
<td width="600" valign="top" class="contentArea"><table width="100%" border="0" cellspacing="0" cellpadding="20">
<tr>
<td>
<?php
require_once $content;
?>
</td>
</tr>
</table></td>
</tr>
</table>
<p>&nbsp;</p>
<p align="center">Copyright &copy; 2005 - <?php echo date('Y'); ?> <a href="http://www.phpwebcommerce.com"> www.phpwebcommerce.com</a></p>
</body>
</html>

You see the bolded section on the top? All file that is meant to be included from another file will have this right at the beginning of the code. So if we request the file directly like this : plaincart/admin/include/template.php it won't display anything.

But first, we have to postpone making the admin pages and create the login page first. Because a shop admin certainly must login before doing anything to the shop.

NOTE : When you play with the admin pages demo you will see that any changes you make doesn't have any effect at all. This is because i've commented some of the code in the demo. I do this just to make sure all the settings, products, and categories stay the same. The code for download, however, are not commented. So when you install it on your server you can make any changes as you wish

 

 

 

Database Abstraction PHP MySQL Shopping Cart Tutorial : Admin Control Panel Admin - Login
Google
 
Web www.phpwebcommerce.com
 

At long last i'm finally able to update this site. Now the shopping cart can handle payment through paypal. As always you have any critiques, questions, comments or problems about this tutorial please tell me. Click here to send your feedback. And if you like this tutorial please link to this site. It will really help a lot :-)

 

Get custom programming done at ScriptLance.com!

 



PHP MySQL Shopping Cart Tutorial
Copyright © 2005 - 2008 www.phpwebcommerce.com