Location: PHPKode > scripts > Shopping Cart > shopping-cart/cart.php
/*############################################################
A manageable shopping cart class 

Authors: Satya Prakash 
        Deepak Singh Tanwar.
if you have any queries please mail me at hide@address.com
############################################################
*/
if (isset($_REQUEST['action']) && $_REQUEST['action']== 'cart')
{
	$addtocart = isset($_REQUEST['addtocart'])? treatGet($_REQUEST['addtocart']):'';

	if(!empty($addtocart) and ($addtocart > 0)){

	$cart->add_item($db,$sessionid,$addtocart,1);
	}
	if(isset($_POST['submitType']) && ($_POST['submitType'] == 'remove')) //Delete shopping cart content
	{
		$cart->delete_item($db,$sessionid,$_POST['product_id']);
	}


	if(isset($_POST['submitType']) && ($_POST['submitType'] == 'update')) //update shopping cart content
	{

		$cart->modify_quantity($db,$sessionid,$_POST['product_id'],$_POST['shopqty']);

	}
	if (isset($_GET["clear_cart"])) //completely clear shopping cart
	{
		$cart->clear_cart($db,$sessionid);

	}

	$cart->display_contents($db,$sessionid);// for showing cart contents
	$numOfProducts = count($cart->products);

Return current item: Shopping Cart