The DevKen Cart Class addresses an issue that I ran into several times while developing ecommerce websites. Customers wanted shopping carts that fit their needs exactly in design and aesthetics. I used a couple free versions for a few projects and found myself spending more time modifying them than I should have had to. So I decided to roll my own shopping cart class that would provide just what was required. It saved the list of products that users wanted to save and organized them in a way that makes it easy to display and calculate.
The Cart class handles any type of list that you need to manage. I also use it to maintain a history of products that users have visited and I use it to keep track of wishlists and download lists at the same time. It is very versatile and easy to integrate into any project. It is well documented and comes with a demo that works right out of the box. Just place it on your webserver and load it up.
$cart = new Cart;
// create a new item array - ID is required
$item = array('id'=>132,'qty'=>'1','color'=>'blue','size'=>'large');
// Add item to cart
$cart->addItem($item);
// Add two more items with the same ID (no overwrite)
$item['qty'] += 2;
$cart->addItem($item);
// Change the item color, a new item will be added this time
$item['color'] = 'white';
$cart->addItem($item);
// Remove item by index
$cart->removeItem(0);
// Update item properties by index
$cart->updateItem(0,array('color'=>'yellow'));
// Empty the cart
$cart->clearCart();
// Dump the cart for debugging
$cart->dumpCart();
// Get the cart for processing
$cartItems = $cart->getCart();
foreach($cartItems as $item) {
// Process cart
}
Great class, lots of features and easy to use.
The author provided good support.
Questions & Comments