JavaScript Editor Ajax software     Free javascripts 



Main Page

Now you see what we’re up to. Follow the steps of the exercise to implement it.
Creating Cookie Ogre’s Warehouse
1.
In order to display different prices for Canadian users, you need geo-targeting functionality,
which was covered in Chapter 11. Because the exercise is quite long, the steps are not repeated
here. Please follow the geo-targeting exercise in Chapter 11 to create and populate the
geo_
target_data
table, and create the
simple_geo_target.inc.php
library.
2.
Inside your
seophp
folder, create a folder named
media
. This folder needs to contain four files
named 1, 2, 3, and 4, which are the pictures of the search engine company logos — Google, Yahoo!,
Microsoft, and Ask. Then take files from the code download of this book, and copy them to your
media
folder.
3.
Now create the new necessary database structures. Connect to your database using either
phpMyAdmin or the MySQL console, like you did in the other database exercises in this
book. Then execute the following SQL commands, which create and populate with data from
the
brands
table:
CREATE TABLE `brands` (
`id` int(11) NOT NULL auto_increment,
`name` varchar(50) NOT NULL default ‘’,
PRIMARY KEY (`id`)
);
INSERT INTO `brands` (`id`, `name`) VALUES (1, ‘Google’);
INSERT INTO `brands` (`id`, `name`) VALUES (2, ‘Yahoo’);
INSERT INTO `brands` (`id`, `name`) VALUES (3, ‘Microsoft’);
INSERT INTO `brands` (`id`, `name`) VALUES (4, ‘Ask’);
4.
Continue by executing these SQL commands, which create and populate the
categories
data
table:
CREATE TABLE `categories` (
`id` int(11) NOT NULL auto_increment,
`name` varchar(50) NOT NULL default ‘’,
PRIMARY KEY (`id`)
);
INSERT INTO `categories` (`id`, `name`) VALUES (1, ‘Chanukah’);
INSERT INTO `categories` (`id`, `name`) VALUES (2, ‘Christmas’);
INSERT INTO `categories` (`id`, `name`) VALUES (3, ‘Frosted’);
INSERT INTO `categories` (`id`, `name`) VALUES (4, ‘Low Sugar’);
INSERT INTO `categories` (`id`, `name`) VALUES (5, ‘Low Fat’);
INSERT INTO `categories` (`id`, `name`) VALUES (6, ‘High Protein’);
INSERT INTO `categories` (`id`, `name`) VALUES (7, ‘Fortune’);
INSERT INTO `categories` (`id`, `name`) VALUES (8, ‘Organic’);
5.
Next you’re creating and populating the
product_categories
table, which contains associa-
tions between products and categories. Each record is formed of a product ID and a category ID:
CREATE TABLE `product_categories` (
`product_id` int(11) NOT NULL default ‘0’,
`category_id` int(11) NOT NULL default ‘0’,
PRIMARY KEY (product_id, category_id)
);
264
Chapter 14: Case Study: Building an E-Commerce Store
c14.qxd:c14 10:46 264


JavaScript Editor Ajax software     Free javascripts