Login   Register  
PHP Classes
elePHPant
Icontem

File: hippo_shopping_cart.txt

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of DavidLanz  >  Hippo Shopping Cart  >  hippo_shopping_cart.txt  >  Download  
File: hippo_shopping_cart.txt
Role: Documentation
Content type: text/plain
Description: some example of this class
Class: Hippo Shopping Cart
Manage shopping cart of products stored in MySQL
Author: By
Last change:
Date: 2005-07-25 00:50
Size: 1,215 bytes
 

Contents

Class file image Download
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."]>";
   }