Admin - View Category

 

All the product categories for the online shop are listed here. The sql query for it is pretty simple. We just select category id, parent id and name and using a while loop we show the category one by one.

Below is the screenshot for the category list page. You ca see that on each row there's a Modify link and Delete link. Clicking on the Modify link will take you to the category modification page ( admin/category/modify.php ) where you can update the category name, description and image. Clicking on the Delete link will pop a javascript confirmation box asking whether you are sure to delete the category. Using a confirmation is a must when you want to delete something. This will prevent stupid accident where you unknowingly click on the delete link and suddenly the category disappear before you even realize what's going on.

 

Online Shop Admin - View Category

Take a look at the code snippet below :

Source code : admin/category/list.php

<?php
// ...
$catId = (isset($_GET['catId']) && (int)$_GET['catId'] >= 0) ?
(int)$_GET['catId'] : 0;
//...
?>

When the page loads we check for the existence of catId ( category id ) in the query string. This category id is then used as the paramater for the javascript function addCategory() . When you click on the 'Add Category' button the parent id will be sent to category/add.php.

Go look at the source code and scroll to the bottom you will see this code :

Source code : admin/category/list.php

<input name="btnAddCategory" type="button" id="btnAddCategory" 
value="Add Category" class="box"
onClick="addCategory(<?php echo $catId; ?>)">

 

The addCategory() function is defined in admin/library/category.js. It simply perform a redirect to show the add category page. More detail on adding a category can be found on the next page.

 

 

 

 

Admin - Login PHP MySQL Shopping Cart Tutorial : Admin - View Category Admin - Add Category
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