Prev | Current Page 341 | Next

Emilian Balanescu and Cristian Darie

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

'/';
return self::Build($link);
}
CHAPTER 8 ?–  SEARCHING THE CATALOG 239
4. In the same file, modify the following CheckRequest() method as highlighted. You implemented this function
in Chapter 7 to redirect incoming requests to their proper versions, but we don??™t want it to verify search
queries or search results pages, which have no ???proper??? version.
// Redirects to proper URL if not already there
public static function CheckRequest()
{
$proper_url = '';
if (isset ($_GET['Search']) || isset($_GET['SearchResults']))
{
return ;
}
// Obtain proper URL for category pages
elseif (isset ($_GET['DepartmentId']) && isset ($_GET['CategoryId']))
{
if (isset ($_GET['Page']))
5. Add the following styles, needed in the search_box template, to styles/tshirtshop.css:
div.yui-b div form {
padding: 5px 10px;
}
input, select, textarea {
font-family: "georgia";
font-size: 85%;
}
6. Modify the presentation/templates/store_front.tpl file to load the search_box template:
...

{include file="search_box.tpl"}
{include file="departments_list.tpl"}
{include file=$obj->mCategoriesCell}

...
7. Load your project in a browser, and you??™ll see the search box resting nicely in its place (refer to Figure 8-1).
How It Works: The search_box Componentized Template
At this point, your search box is functional. However, before you can fully test the searching feature, you also need
to implement the search results page.


Pages:
329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353