If you need to have different
product prices, you need to create different products. If you need to support attributes that affect the product
price, one option would be to extend the product_attribute table by including data about the change in the
product price and making many other changes and additions to the business tier and presentation tier code.
We advise you not to make any changes at this time, as they would propagate to the following chapters as
well, making the task of following the book more difficult.
You learned in Chapter 5 that database diagrams can help in understanding the relationships
among data tables. A visual representation of these tables and of the relationships among
the attribute tables can be seen in Figure 6-2. The relationship between the product table and
the other tables is shown in Figure 5-6. If you are new to databases, you should take a moment
to study this diagram so that the following code is easier for you to negotiate and understand.
CHAPTER 6 ?– PRODUCT ATTRIBUTES 176
Figure 6-2. Diagram describing the relationships among the data tables required to implement
product attributes
Let??™s start by updating the tshirtshop database and then implement the new stored
procedure catalog_get_product_attributes in the following exercise.
Exercise: Creating the Data Tier Functionality for Product Attributes
1.
Pages:
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277