Prev | Current Page 484 | Next

Emilian Balanescu and Cristian Darie

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

At this point, you still
can??™t add new products to your cart because you need to create the cart details page. You??™ll be able to fully test
your cart summary component after you implement the cart details page in the next exercise.
Displaying the Cart Details
Right now, clicking the Add to Cart and View Cart buttons generates an error because you
haven??™t written the cart_details componentized template yet, which displays the visitor??™s
shopping cart details. To create the new componentized template, you first create a new
template named cart_details.tpl in the presentation/templates folder. Next, you create
the cart_details.php presentation object file that will keep your CartDetails class behind the
cart_details.tpl template.
Exercise: Displaying the Cart Details
1. Modify presentation/store_front.php to manage the Continue Shopping functionality in the cart
details page. Add the following code in the init() method from the StoreFront class:
public function init()
{
$_SESSION['link_to_store_front'] =
Link::Build(str_replace(VIRTUAL_LOCATION, '', getenv('REQUEST_URI')));
// Build the "continue shopping" link
if (!isset ($_GET['CartAction']))
$_SESSION['link_to_last_page_loaded'] = $_SESSION['link_to_store_front'];
// Load department details if visiting a department
if (isset ($_GET['DepartmentId']))
CHAPTER 12 ?–  CREATING YOUR OWN SHOPPING CART 385
2.


Pages:
472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496
tanie apartamenty międzyzdroje upadlanych.waw.pl dopobrania.com.pl Automaty samosprzedające przyczepy campingowe