Prev | Current Page 247 | Next

Emilian Balanescu and Cristian Darie

"Beginning PHP and MySQL E-Commerce: From Novice to Professional, Second Edition"


When a large number of products need to be presented, navigation links will appear (see
Figure 5-10).
Figure 5-10. The products_list componentized template with paging
This componentized template will be used in multiple places within the web site. On the
main page, it displays the products that have the display field set to 1 or 3. When a visitor
CHAPTER 5 ?–  CREATING THE PRODUCT CATALOG: PART 2 156
selects a particular department, the products_list componentized template displays the
products featured for the selected department. Finally, when the visitor clicks a category, the
componentized template displays all the products that belong to that category. Due to the way
the database is implemented, you can feature a product in the departments it belongs to but
not on the main page or vice versa. If a product belongs to more than one department, it will
appear on the main page of each of these departments.
The componentized template chooses which products to display after analyzing the query
string. If both DepartmentId and CategoryId parameters are present in the query string, this
means the products of that category should be listed. If only DepartmentId is present, the visitor
is visiting a department, so its featured products should appear. If DepartmentId is not present,
the visitor is on the main page, so the catalog featured products should appear.


Pages:
235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259