// Load product details page if visiting a product
if (isset ($_GET['ProductId']))
$this->mContentsCell = 'product.tpl';
// Load search result page if we're searching the catalog
elseif (isset ($_GET['SearchResults']))
$this->mContentsCell = 'search_results.tpl';
// Load the page title
$this->mPageTitle = $this->_GetPageTitle();
...
9. Also, in store_front.php, add the highlighted lines of code in the _GetPageTitle() method to show
a custom title when we??™re viewing the search results page:
...
elseif (isset ($_GET['ProductId']))
{
$page_title = 'TShirtShop: ' .
Catalog::GetProductName($_GET['ProductId']);
}
elseif (isset ($_GET['SearchResults']))
{
$page_title = 'TShirtShop: "';
// Display the search string
$page_title .= trim(str_replace('-', ' ', $_GET['SearchString'])) . '" (';
// Display "all-words search " or "any-words search"
$all_words = isset ($_GET['AllWords']) ? $_GET['AllWords'] : 'off';
$page_title .= (($all_words == 'on') ? 'all' : 'any') .
'-words search';
// Display page number
if (isset ($_GET['Page']) && ((int)$_GET['Page']) > 1)
$page_title .= ', page ' . ((int)$_GET['Page']);
$page_title .= ')';
}
else
{
if (isset ($_GET['Page']) && ((int)$_GET['Page']) > 1)
$page_title .= ' - Page ' . ((int)$_GET['Page']);
}
CHAPTER 8 ?– SEARCHING THE CATALOG 246
return $page_title;
}
...
10. Open presentation/product.
Pages:
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360