Location: PHPKode > scripts > Hippo Shopping Cart > hippo-shopping-cart/hippo_shopping_cart.txt
class
=====
hippo_shopping_cart.php


Usage
=====
require('classes/hippo_sql_query.php');
$obj = new hippo_shopping_cart();

--

// Add Item to Cart
$obj->add_item($_GET['products_id']);

--

// Update Item in Cart
$obj->update_shopping_cart($_POST['quantity'], $_POST['if_delete'])
// see 'shopping_cart_1-1.php' for more details

--

// Get Cart Item
$obj->get_shopping_cart();

for($i=0; $i<$obj->num_of_products_id; $i++)
{
  echo $obj->products_id_in_cart[$i]."_".$obj->products_num_in_cart[$i]."<br>";
}

note:
products_id_in_cart is a class member variable in Array, stores pruducts_id
products_num_in_cart is a class member variable in Array, stores number of products_id

// see 'shopping_cart_1-2.php' for more details

--

// GetUser Detail & Product Detail
$obj->get_shopping_cart_detail($MemId, $email);

//results:
echo $obj->product_detail[$i][0]['f_products_name'];
echo $obj->user_detail[0]['f_nickname'];

--

Other Notice:
<> the quantity variable in the web form(shopping_cart_1-1.php), must declare the same with $_POST['quantity'], ex:
   for($i=0; $i<$obj->num_of_products_id; $i++)
   {
     echo "<input name=quantity[".$i."]>";
   }

Return current item: Hippo Shopping Cart