Admin - Add Product
Adding a product for the online shop is a straightforward process. Just enter the product information and hit the 'Add Product' button. When adding a product we will require these information :
All is mandatory except for the image. We can add the product image later.The add product form look like this :
Not much difference from the add category form. We just have more input box. On top of the form you can see the category combo box. We build this so that you can only select the second level category. This is to ensure that all product are added on the second level category and not put in the top level category by mistake. The one responsible to build the list is the buildCategoryOptions() in admin/library/function.php. Below is the snippet for the code that build the combo box. Just in case you will need the ability to add some product to the first level category you can replace the buildCategoryOptions() with the commented function code written below it. If you happen to click the "Add Product" button while viewing the product list in a category you can see that the category list is pre-selected to the right category. When the function is building the list options it always check if the current category id is the same as the category id in the function parameter. Source code : admin/library/functions.php <?php // build combo box options // ... more code here ?> The product quantity is limited to 65,535 since in the table definition we only use smallint(5) . I find this number adequate for most online shops. But if do carry more than that amount for an item just change the data type to something bigger like mediumint(8). The product image you need to supply is the large size product image which will be shown in the product detail page. The script will generate a thumbnail for it to be shown in the product browsing page. We define the maximum image size and the thumbnail size in config php. We need to restrict the image size so it won't destroy the site layout. Imagine if the image is 1000 pixels wide and 2000 pixels high. It will make the product detail page look awful. Image resizing can be turned on or off. If you set LIMIT_PRODUCT_WIDTH to false on config.php the script will just upload the image without worying about it's size. It's not recommended though. Please note that the image resizing function can only handle jpeg and gif image. That function was actually taken from the php documentation and i don't know how to improve it yet. |
|
|
|
|
Admin - Delete Category | PHP MySQL Shopping Cart Tutorial : Admin - Add Product | Admin - View Product |
|
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 :-) |
PHP MySQL Shopping Cart Tutorial
Copyright © 2005 - 2008 www.phpwebcommerce.com