Prev | Current Page 255 | Next

Emilian Balanescu and Cristian Darie

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

tpl"}
2. Modify the presentation/store_front.php file, as highlighted in the following code:
class StoreFront
{
public $mSiteUrl;
// Define the template file for the page contents
public $mContentsCell = 'first_page_contents.tpl';
// Define the template file for the categories cell
public $mCategoriesCell = 'blank.tpl';
This way, when no DepartmentId and CategoryId are in the query string, store_front.php will load
the first_page_contents componentized template.
3. Modify the init() method from the ProductsList class located in the presentation/
products_list.php file, as highlighted:
public function init()
{
/* If browsing a category, get the list of products by calling
the GetProductsInCategory() business tier method */
if (isset ($this->_mCategoryId))
$this->mProducts = Catalog::GetProductsInCategory(
$this->_mCategoryId, $this->mPage, $this->mrTotalPages);
CHAPTER 5 ?–  CREATING THE PRODUCT CATALOG: PART 2 164
/* If browsing a department, get the list of products by calling
the GetProductsOnDepartment() business tier method */
elseif (isset ($this->_mDepartmentId))
$this->mProducts = Catalog::GetProductsOnDepartment(
$this->_mDepartmentId, $this->mPage, $this->mrTotalPages);
/* If browsing the first page, get the list of products by
calling the GetProductsOnCatalog() business
tier method */
else
$this->mProducts = Catalog::GetProductsOnCatalog(
$this->mPage, $this->mrTotalPages);
/* If there are subpages of products, display navigation
controls */
if ($this->mrTotalPages > 1)
{
// Build the Next link
if ($this->mPage < $this->mrTotalPages)
{
if (isset($this->_mCategoryId))
$this->mLinkToNextPage =
Link::ToCategory($this->_mDepartmentId, $this->_mCategoryId,
$this->mPage + 1);
elseif (isset($this->_mDepartmentId))
$this->mLinkToNextPage =
Link::ToDepartment($this->_mDepartmentId, $this->mPage + 1);
else
$this->mLinkToNextPage = Link::ToIndex($this->mPage + 1);
}
// Build the Previous link
if ($this->mPage > 1)
{
if (isset($this->_mCategoryId))
$this->mLinkToPreviousPage =
Link::ToCategory($this->_mDepartmentId, $this->_mCategoryId,
$this->mPage - 1);
elseif (isset($this->_mDepartmentId))
$this->mLinkToPreviousPage =
Link::ToDepartment($this->_mDepartmentId, $this->mPage - 1);
else
$this->mLinkToPreviousPage = Link::ToIndex($this->mPage - 1);
}
}
CHAPTER 5 ?–  CREATING THE PRODUCT CATALOG: PART 2 165
4.


Pages:
243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267
www.books61.hobbitstory.com tanie noclegi międzyzdroje pokoje windsurfing Władysławowo noclegi e-lady