655
C H A P T E R 2 1
Planning the Product Reviews Feature
The product reviews feature is simple enough. It is governed by three simple design decisions:
??? The list of reviews and the interface elements necessary for adding new reviews should
be displayed below the list of product recommendations on the product details pages,
as shown in Figure 21-1.
??? If the product has no reviews, we should invite the reader to write the first review, as
shown in Figure 21-2.
??? Only registered users can write product reviews.
Figure 21-1. The product details page containing product reviews
CHAPTER 21 ?– PRODUCT REVIEWS 656
Figure 21-2. Be the first person to voice your opinion!
We store the product reviews in a database table named review, which is manipulated by
two stored procedures??”catalog_get_product_reviews and catalog_create_product_review??”
whose names are self-describing. The other code we??™ll write will only package this functionality
in a form that is accessible to your visitors.
Implementing Product Reviews
Follow the steps of this exercise to create the database table, stored procedures, business tier,
and presentation tier functionality required for the product reviews feature.
CHAPTER 21 ?– PRODUCT REVIEWS 657
Exercise: Implementing Product Reviews
1. Load phpMyAdmin, select the tshirtshop database, and open a new SQL query page.
Pages:
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771