Prev | Current Page 788 | Next

Emilian Balanescu and Cristian Darie

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

php?OrderError [L]
# Rewrite Amazon t-shirts department pages
RewriteRule ^amazon-t-shirts/?$ index.php?DepartmentId=Amazon [L]

CHAPTER 22 ?–  USING AMAZON.COM WEB SERVICES 685
# Set the default 500 page for Apache errors
ErrorDocument 500 /tshirtshop/500.php
# Set the default 404 page
ErrorDocument 404 /tshirtshop/404.php
9. Update include/index.php to reference the new business tier class by adding the following code on top
of the line that checks the page requests:
require_once BUSINESS_DIR . 'amazon.php';
// URL correction
Link::CheckRequest();
// Load Smarty template file
$application = new Application();
10. Open the presentation/store_front.php file, and modify the init() method from the StoreFront
class to load the Amazon T-Shirts department when requested:
...
// Load department details if visiting a department
if (isset ($_GET['DepartmentId']))
{
if ((string) $_GET['DepartmentId'] == 'Amazon')
$this->mContentsCell = 'amazon_products_list.tpl';
else
{
$this->mContentsCell = 'department.tpl';
$this->mCategoriesCell = 'categories_list.tpl';
}
}
...
11. Load TShirtShop in your browser, and then click your newly created Amazon T-Shirts department. You should
see the new department as shown earlier in Figure 22-1.
How It Works: Displaying Amazon.com Products in TShirtShop
In this exercise, you simply updated TShirtShop to display Amazon.


Pages:
776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800
klamki Sprzedaż mieszkań Warszawa poker online Perfumy zadaszenia namiotowe