JavaScript Editor Ajax software     Free javascripts 



Main Page

$brand_image_url = make_media_url($brand_id, $brand[‘name’], ‘jpg’);
// send a 404 if the product or category does not exist
if (!$product || !$category) {
header(“HTTP/1.0 404 Not Found”);
exit();
}
?>
<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN”
“http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”>
<html>
<head>
<title><?php echo $product[‘name’] ?> - Cookie Ogre Warehouse</title>
</head>
<body>
<!— Display title, which includes link to the home page —>
<h1>
<?php echo $product[‘name’] ?> -
<a href=”/“>Cookie Ogre Warehouse</a>
</h1>
<!— Display the product description —>
<p><?php echo $product[‘desc’];?></p>
<!— Display the brand logo —>
<p>
This cookie is brought to you by <?php echo $brand[‘name’]; ?>.
<br /><img src=”<?php echo $brand_image_url; ?>”/>
</p>
<!— Display the product price —>
<p>Price:
<?php
// display price in CAD for canadian visitors, or in USD otherwise
if (SimpleGeoTarget::isRegion(“CA”))
echo $product[‘price’] * 1.17 . ‘ CAD’;
else
echo $product[‘price’] . ‘ USD’;
?>
</p>
View more products in our
<a href=”<?php echo $category_url; ?>”>
<?php echo $category[‘name’]; ?></a>
category.
</body>
</html>
16.
The final step is to exclude the product links that aren’t in the primary category. Obtaining this data
isn’t extremely complicated, but it does involve a longer-than-usual SQL query. Also, although you
do not have a shopping cart, assume that you do and deliberately exclude it using
robots.txt
.
Otherwise, assuming your add-to-cart URLs look like
/cart.php?action=add&product_id=5
,
277
Chapter 14: Case Study: Building an E-Commerce Store
c14.qxd:c14 10:46 277


JavaScript Editor Ajax software     Free javascripts