Prev | Current Page 261 | Next

Emilian Balanescu and Cristian Darie

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

Edit presentation/store_front.php to load the product.tpl template using the $mContentsCell
member if the ProductId parameter exists in the query string. Also, if we??™ve arrived to the product page
from a department or category catalog page, we display the list of categories as well. This is a small feature
but an important one for improving the catalog navigation experience of your visitor. Add the boldfaced lines
to the store_front.php file as shown in the following code:
public function init()
{
// Load department details if visiting a department
if (isset ($_GET['DepartmentId']))
{
$this->mContentsCell = 'department.tpl';
$this->mCategoriesCell = 'categories_list.tpl';
}
elseif (isset($_GET['ProductId']) &&
isset($_SESSION['link_to_continue_shopping']) &&
strpos($_SESSION['link_to_continue_shopping'], 'DepartmentId', 0)
!== false)
{
$this->mCategoriesCell = 'categories_list.tpl';
}
// Load product details page if visiting a product
if (isset ($_GET['ProductId']))
$this->mContentsCell = 'product.tpl';
}
}
?>
CHAPTER 5 ?–  CREATING THE PRODUCT CATALOG: PART 2 172
9. Load the web site, and click the picture or name of any product. You should be forwarded to its details page.
Figure 5-12 shows an example details page.
Figure 5-12. A product details page in TShirtShop
How It Works: The product Componentized Template
As expected, the steps to implement the product details page were quite straightforward, since we only wrote or
updated code that is already structured in a logical and consistent fashion.


Pages:
249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273
drukarki fiskalne kraków willa karmazyn międzyzdroje www.books61.hobbitstory.com terapia magnetyczna Informacje o hostingu