The visitor??™s session object stores (name, value) pairs that are saved at server-side
and are accessible for the visitor??™s entire session. In this chapter, we??™ll use the session feature for improving
performance. When implementing the paging functionality, before requesting the list of products, you first
ask the database for the total number of products that are going to be returned, so you can show the visitor
how many pages of products are available. This number will be saved in the visitor??™s session, so if the visitor
browses the pages of a list of products, the database wouldn??™t be queried multiple times for the total number
of products on subsequent calls; this number will be directly read from the session (this functionality is
implemented in the HowManyPages() method that you??™ll implement later). In this chapter, you??™ll also use the
session to implement the Continue Shopping buttons in product details pages.
Let??™s work through each business tier method. All these methods need to be added to the
Catalog class, located in the business/catalog.php file that you started writing in Chapter 4.
GetDepartmentDetails
GetDepartmentDetails() is called from the presentation tier when a department is clicked to
display its name and description. The presentation tier passes the ID of the selected department,
and you need to send back the name and the description of the selected department.
Pages:
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239