JavaScript Editor Ajax software     Free javascripts 



Main Page

Establishing the Requirements
As with any other development project, you design your site based on a set of requirements. For Cookie
Ogre’s Warehouse, we’ve come up with this short list:
?
The catalog contains products that are grouped into categories.
?
A product can belong to any number of categories, and a category can contain many products.
?
The properties of a product are name, price, description, the primary category that it is part of,
and an associated search engine brand.
?
The properties of a category are: name.
?
The properties of a brand are: name.
?
The first page of the catalog contains links to the category pages. The page title should contain
the site name.
?
A category page displays the category name, the site name, a link to the home page, and links to
the pages of the products in that category. The page title should contain the site name and the
category name.
?
Category pages should have a maximum number of products it can display, and use a paging
feature to allow the visitors to browse the products on multiple pages.
?
A product page must display the product name, price and a link to the storefront, a link to its
category, the product’s description, and the associated brand name and picture.
?
All catalog pages must be accessible through keyword-rich URLs.
?
If a catalog page is accessed through a URL other than the proper version, it should be automat-
ically 301 redirected to the proper version.
?
Requests for
index.php
and
index.html
should be automatically 301 redirected to
/
.
?
Canadian users should see the product price in CAD currency. All the other visitors should see
the price in USD.
?
Because a product that is in multiple categories can be reached through more than one category
link, all the links except the one associated with its primary category must be excluded through
robots.txt
.
Implementing the Product Catalog
Starting from the basic list of requirements depicted earlier, you’ve come to implement three catalog pages,
whose functionality is sustained by numerous helper scripts. The first catalog page is
index.php
, and it
looks as shown in Figure 14-1.
Clicking one of the category links gets you to
category.php
, which displays the details of the category,
including links to its products. The script is accessed — obviously — through a keyword-rich URL, so
the user will never know it’s a script named
category.php
that does all the work. Figure 14-2 shows
this script at work.
Clicking a product link in the category page loads the details page of that product, which looks like
Figure 14-3.
262
Chapter 14: Case Study: Building an E-Commerce Store
c14.qxd:c14 10:46 262


JavaScript Editor Ajax software     Free javascripts