cart-subtotal td {
border: none;
margin: 10px 0px;
width: 100%;
}
.yui-b div form.cart-form {
margin: 0;
padding: 0;
}
You just finished the visitor??™s part of the code for this chapter, so now it??™s time to try it and make sure everything
works as expected. Test it by adding products to the shopping cart, changing the quantity, and removing items.
CHAPTER 12 ?– CREATING YOUR OWN SHOPPING CART 391
How It Works: The Shopping Cart
The actions that the shopping cart can execute are defined by the constants defined in include/config.php:
ADD_PRODUCT, REMOVE_PRODUCT, UPDATE_PRODUCTS_QUANTITIES, SAVE_PRODUCT_FOR_LATER, and
MOVE_PRODUCT_TO_CART. Note that we didn??™t define any variable for viewing the shopping cart, so if CartAction
does not take any value or its value is not equal to one of the action variables, it will simply display the shopping
cart content.
Every shopping cart action, except viewing and updating the shopping cart, relies on the ItemId query string
parameter (an error is raised if it isn??™t set). If the proper conditions are met, the business tier method that corresponds
to the visitor??™s action is called.
Administering the Shopping Cart
Now that you??™ve finished writing the shopping cart, you need to take two more issues into
account, both related to administration:
??? How to delete from the catalog a product that exists in shopping carts.
Pages:
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501