Initializing the Tables for Products and Departments
Tables. You should have one overall directory for your
webstore called firefox. It should have the following
The following table displays the images you need to copy into the images_dept folder.
|The following table displays the entries that should be placed in the department table.|
|1||Edible Panties||Don't get your panties in a bunch, munch them for brunch or lunch||dept_edibles.jpg|
|2||Amerindian DVDs||Some artistic efforts from the far too silent minority.||dept_native_dvds.jpg|
|3||Kurosawa DVDs||A Japanese master of movie making.||dept_kurosawa.jpg|
|4||Martial Arts DVDs||Some say it should be long rather than dragon. Enter some real efforts to portray longs.||dept_martial_arts.jpg|
|5||T Shirts||We carry t-shirts with a passion.||dept_tshirts.gif|
|So that you can see how to initialize the entries
in this table I will lead you through the steps using the MySQL
Admin on your account at battcave.com. You can then follow
these same steps to initialize the other tables we are about to
delineate later in this webpage.
First you need to get back into the MySQL Admin and access your database. After following the usual steps you should see a page like the following.
|If you click on the insert icon/button in the department row you should get a page containing the following.|
|At which point you should enter the
information about the Edible Panties
department. Remember you can copy the words into the
appropriate field. You also shouldn't enter any
id_department so that it will auto increment. Then you
should press the Go button
to insert the record.
You also need to do this for the other four departments.
Once you have done this you can press the browse icon associated with the department table to see the following segment of your screen.
|This lets you know they've been initialized.
If you need to correct anything you can press the edit button/icon for that particular record. This button/icon looks like a pencil.
Product Initialization. The following table displays a set of images you need to copy into the images_prod folder. This first set of images will appear on the departments page and all have sm_ at the beginning of their names. These images are smaller because more than one will appear on each department's page.
|The following table displays another set of images you need to copy into the images_prod folder. This second set of images will appear on the page for each product.|
|The following table displays the initializations
for the products table. While the weights are in lbs, you
should only enter the number. In order for our website to work
you need to enter this information.
Fortunately, we will eventually develop the store manager interface that will greatly improve modifying these tables and the rest in the firefox database.
|1||Womens Edible Panties||These crotchless panties will leave your mate always asking for more.||prod_female_edibles.gif||1.6||7.49|
|2||Mens Edible Undies||These edible undies will definitely liven up your meal time.||prod_male_edibles.gif||2.0||7.49|
|3||Dreamkeeper DVD||A miniseries based on current native themes and action.||prod_dreamkeeper.jpg||4.5||39.95|
|4||Powwow Highway DVD||Native wanderlust finding its way across the highways of the US following a trail of native powwows.||prod_powwow_highway.jpg||1.4||19.95|
|6||The Seven Samurai DVD||A dramatic comedy about a band of samurai defending Japanese farmers from a large extortionist gang.||prod_seven_samurai.jpg||1.3||24.95|
|7||Crouching Tiger Hidden Dragon DVD||Oriental mysticism bonds with martial arts and love to create an epic journey.||prod_crouching_tiger.jpg||1.5||19.95|
|8||Iron Monkey DVD||A warrior/healer defends his region against corrupt officialdom.||prod_iron_monkey.jpg||1.4||19.95|
|9||The Last Dragon DVD||A black American youth develops his spirit and whole body glow in his quest for dealing everything justly.||prod_last_dragon.jpg||1.4||19.95|
|10||Eagle Feather T-Shirt||A t-shirt depicting an eagle guardian spirit giving a feather to a questing youth.||prod_eagle_feather.gif||2.3||21.95|
|11||The Sentinels T-Shirt||A t-shirt depicting a cougar guardian spirit protecting a youth in his duties.||prod_the_sentinels.gif||2.3||21.95|
|Relating Products to
We have chosen to use a configuration that makes use of a separate
table to relate products and departments. This approach is
actually more flexible than just having an extra field in the
products table that tells which department it is in. This way
it is possible to list products in more than one department and it
is possible to use this same sort of approach to relate different
products to each other. For example, if we were selling camera
equipment, you might want to make sure certain flashes and lenses
are associated with particular cameras.
But, while this table might appear quite abstract at first, it really serves a purpose. The table we are about display the initializations for is called department_products. It is still best to have a key, even though these numbers are really quite arbitrary and basically just enumerating how many department product relationships we have,
You will need to initialize the following table.
In an earlier webpage we talked about coordinating/assigning products with
their attributes. Remember, within our products we have just two
that have attributes.
But it is key to remember that we have designed our tables so that we can easily add more products using these or other attributes.
First we need a table that defines our attribute categories called attribute_category. The initializations follow.
|Now we need to define the specific attributes our products can have and sort them into their categories. This is done in a table called attribute.|
|Notice how we have used the id_attribute_category
as a foreign key.
Now we need to define which products have specific attributes. Since we don't want to assume things like all of our t shirts come in the same sizes, or our edibles all come in the same flavors, we need to associate each product with its particular attributes. This is done in a table called product_attribute.
|Finally, we have our "unnecessary" table, at least in theory.|
|We leave initialization of the other tables until we are closer to making use of them.|