COM WEB SERVICES 684
if (array_key_exists('DepartmentId', $continue_shopping))
$this->mSelectedDepartment =
(int)$continue_shopping['DepartmentId'];
}
// Set Amazon department name and build the link for department
$this->mAmazonDepartmentName = AMAZON_DEPARTMENT_TITLE;
$this->mLinkToAmazonDepartment = Link::ToAmazonDepartment();
// Check whether the Amazon department is selected
if ((isset ($_GET['DepartmentId'])) &&
((string) $_GET['DepartmentId'] == 'Amazon'))
$this->mAmazonSelected = true;
}
...
6. Add the following method to the Link class in the presentation/link.php file:
// Creates a link to the Amazon T-Shirts department
public static function ToAmazonDepartment()
{
return self::Build('amazon-t-shirts/');
}
7. In the same class, modify the CheckRequest() method as highlighted to exit the function if we request the
Amazon T-Shirts department page:
...
// Obtain proper URL for department pages
elseif (isset ($_GET['DepartmentId']))
{
if ((string) $_GET['DepartmentId'] == 'Amazon') return;
if (isset ($_GET['Page']))
$proper_url = self::ToDepartment($_GET['DepartmentId'],
$_GET['Page']);
else
$proper_url = self::ToDepartment($_GET['DepartmentId']);
}
...
8. Open the .htaccess file from the project root folder, and add the following rewrite definition rule for the
Amazon T-Shirts department page:
...
# Rewrite order error pages
RewriteRule ^order-error/?$ index.
Pages:
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799