Bringing products catalog to customers
Presenting products catalog to customers is much like presenting products and categories in back end.
To navigate in products catalog customer can use a category tree:
 |
When clicking a certain category link, customer is directed to
index.php?categoryID=X
where X is the integer ID of the category, e.g. 5.
Script should perform following operations if categoryID parameter is passed:
- Validates categoryID parameter value and transforms it to an integer number to avoid SQL injections vulnerability. More about your store security .
- Searches for a requested category in the database.
- If category was not found in the database, visitor is redirected to storefront homepage (index.php).
- If category was found, visitor is shown a list of products within selected category with the ability to order certain products.
|
A list of products within current category can be easily fetched from the database using following SQL query:
SELECT * FROM `PRODUCT` WHERE categoryID = `$current_categoryID`;
Clicking a certain product link brings visitor detailed product information page - index.php?productID=XX. XX indicates unique integer ID of the product. Just like with the category, script should validate productID parameter value, search for a product in the database, and then fetch all required information from the database and present it to visitor:

Clicking "Add to cart" button will add this product to customer's shopping cart. Learn more about shopping cart feature.
|