Hi
Thanks for all your help so far.
I've combined all your thoughts, and from what I understand, for every
page I have that interacts with the cart, I need to have something like
the following code.
So basically, on every page, be it a page that displays the contents of
the cart, the checkout, or catalog pages, at the top of the code I
always need to check if files are being added, deleted or changed qty.
Is this correct?
This is my biggest concern. What's the best way to interact with the
Cart class when adding/removing items?
Thanks
Steve
<?php
// This File: catalog.php
require_once 'Cart.php';
session_start();
/* Establish connection to the cart
************************************ */
if ( isset($_SESSION["cart"] )
$cart = unserialize($_SESSION["cart"]);
else
$cart = new Cart();
/* Modify the cart for this user
************************************ */
if ( isset($_GET['add']) )
$cart->addItem($_GET['add']);
if ( isset($_GET['remove']) )
$cart->removeItem($_GET['remove']);
/* Save the cart's state
************************************ */
$_SESSION['cart'] = $cart;
/* Display the catalog
************************************ */
echo <<<HEREDOCS
blah blah
HEREDOCS;
?>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php