$this->mProduct['image']);
if ($this->mProduct['image_2'])
$this->mProduct['image_2'] =
Link::Build('product_images/' . $this->mProduct['image_2']);
CHAPTER 5 ?– CREATING THE PRODUCT CATALOG: PART 2 169
$this->mLocations = Catalog::GetProductLocations($this->_mProductId);
// Build links for product departments and categories pages
for ($i = 0; $i < count($this->mLocations); $i++)
{
$this->mLocations[$i]['link_to_department'] =
Link::ToDepartment($this->mLocations[$i]['department_id']);
$this->mLocations[$i]['link_to_category'] =
Link::ToCategory($this->mLocations[$i]['department_id'],
$this->mLocations[$i]['category_id']);
}
}
}
?>
4. Add the following method to presentation/link.php. This function creates an associative array with the
elements of the query string.We??™ll use this functionality to implement the Continue Shopping feature.
public static function QueryStringToArray($queryString)
{
$result = array();
if ($queryString != '')
{
$elements = explode('&', $queryString);
foreach($elements as $key => $value)
{
$element = explode('=', $value);
$result[urldecode($element[0])] =
isset($element[1]) ? urldecode($element[1]) : '';
}
}
return $result;
}
5. Modify presentation/products_list.php as shown in the following code snippet. This new code
saves the last catalog page accessed. When displaying a product details page, this address will be used to
create the Continue Shopping link.
Pages:
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271