Prev | Current Page 477 | Next

Emilian Balanescu and Cristian Darie

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


When clicking View Cart, the cart details componentized template is loaded in store_
front.tpl. You can see this componentized component in action in Figure 12-1. The mechanism
for loading the cart details componentized template is the same one you already used in
store_front.php to load other components. When the Add to Cart button is clicked, index.php
is reloaded with an additional parameter (CartAction) in the query string:
http://localhost/tshirtshop/index.php?CartAction=1&ItemId=10
When clicking View Cart, the CartAction parameter added to the query string doesn??™t take
any value.
The shopping cart has five cart actions, which are described using the following selfexplanatory
constants in the configuration file (include/config.php): ADD_PRODUCT, REMOVE_
PRODUCT, UPDATE_PRODUCTS_QUANTITIES, SAVE_PRODUCT_FOR_LATER, and MOVE_PRODUCT_TO_CART.
Before moving on, let??™s recap the main steps you??™ll take to implement the whole UI of the
shopping cart:
1. Modify the Add to Cart buttons to use the custom shopping cart.
2. Add a shopping cart summary box to store_front.tpl instead of the View Cart button.
3. Modify the CheckRequest() method from the Link class from the presentation/link.php
file to recognize the CartAction query string parameter.
4. Implement the cart_details componentized template.
Updating the Add to Cart Buttons
You need to change the code of products_list.


Pages:
465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489
Mark Morrison Matthew Mills Martika Marillion teksty piosenek