Prev | Current Page 344 | Next

Emilian Balanescu and Cristian Darie

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

If that is the case, the search box is also populated with the keywords searched by the visitor:
if (isset ($_GET['ProductId']) &&
isset ($_SESSION['link_to_continue_shopping']))
{
$continue_shopping =
Link::QueryStringToArray($_SESSION['link_to_continue_shopping']);
if (isset ($continue_shopping['SearchResults']))
{
$this->mSearchString =
trim(str_replace('-', ' ', $continue_shopping['SearchString']));
$this->mAllWords = $continue_shopping['AllWords'];
}
}
Displaying the Search Results
In the next exercise, you??™ll create the componentized template that displays the search results.
To make your life easier, we??™ll reuse the product_list componentized template to display the
list of products. This is the componentized template that we are currently using to list products
for the main page, for departments, and for categories. Of course, if you want to have the
search results displayed in another format, you must create another componentized template.
You??™ll need to modify the templates logic file of the products list (products_list.php) to
recognize when it??™s being called to display search results and display the correct list of products.
Let??™s create the search_results template and update the templates logic of the products_list
componentized template in the following exercise.
Exercise: Creating the search_results Componentized Template
1.


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