File: INSTALL

Recommend this page to a friend!
  Classes of Sergey Pimenov  >  Shop Cart  >  INSTALL  >  Download  
File: INSTALL
Role: Example script
Content type: text/plain
Description: Short examples
Class: Shop Cart
Manage shopping cart
Author: By
Last change:
Date: 13 years ago
Size: 1,571 bytes
 

Contents

Class file image Download
REQUIREMENTS

    Cart class requires a recent PHP 5+
   
   
QUICK START
<?
 
require('class.cart.php');

 
// Create instance of Cart with default store mode (into SESSION)
 
$cart = Cart::CreateInstance();

 
// Create instance of Cart with store mode (into COOKIES)
 
$cart = Cart::CreateInstance(CART_MODE_COOKIES);

 
// adding Items to cart with item data as array and count 10
 
$cart->addItems(1, array("MODEL_NUM_1", "TEST MODEL", "BRAND"), 10);

 
// adding Items to cart with item data as string and default count (1)
 
$cart->addItems(1, "MODEL_NUM_1");

 
// adding Items to cart without item data
 
$cart->addItems(1);

 
// adding Items to cart without item data count 100
 
$cart->addItems(1, null, 100);

 
// remove Items from cart
 
$cart->RemoveItems(1, 100); /*in this example remov item with ID=1 from Cart and count of removed items 100*/

  //Getting Cart
 
$cart_data = $cart->GetCart();

 
//$cart_data[item_id]['count'] - count items in cart
  //$cart_data[item_id]['data'] - item data is object of CartItem (CartItem->ItemID and CartItem->ItemData)

  //Getting items count from Cart
 
$count = $cart->GetItemsCount() /* return full total items in cart*/

 
$count = $cart->GetPositionsCount() /* return unique items position in cart*/
 
  //Delete all items from cart
 
$cart->EmptyCart();

 
//Change store cart mode for store into COOKIES
 
$cart->SetFlushMode(CART_MODE_COOKIES);
 
$cart->FlushCart();

 
//Change store cart mode for store into SESSION
 
$cart->SetFlushMode(CART_MODE_SESSION);
 
$cart->FlushCart();

?>

IMPORTANT


For more information send a message to info at phpclasses dot org.