class shoppingBag
{
var $sb_item;
function getShoppingBag()
{
return $this->sb_item;
}
function addItem($size_id, $qty, $size, $proccessType="")
{
$prd_exist = $this->getShoppingBagItem($size_id);
//if have record, increase qty by $qty
echo $processType;
if($prd_exist=="Y")
$this->updateItemQty($size_id, $qty, $size, $proccessType);
else
$this->insertItem($size_id, $qty, $size);
}
function removeItem($item_index)
{
//$size_id = $this->sb_item[$item_index]["size_id"];
//$this->deleteItem($item_index);
$temp_item = $this->sb_item;
unset($temp_item[$item_index]);
unset($this->sb_item);
$i = 0;
foreach ($temp_item as $value)
{
$this->sb_item[$i]["pro_id"] = $value["pro_id"];
$this->sb_item[$i]["pro_qty"] = $value["pro_qty"];
$this->sb_item[$i]["pro_price"] = $value["pro_price"];
$i++;
}
}
function getShoppingBagIndex($pro_id)
{
$prd_row = 0;
for($i=0 ; $i < count($this->sb_item) ; $i++)
{
if(($this->sb_item[$i]["pro_id"]==$pro_id))
{
$prd_row = $i;
}
}
return $prd_row;
}
function getShoppingBagItem($pro_id)
{
$retval = "N";
for($i=0 ; $i < count($this->sb_item) ; $i++)
{
if(($this->sb_item[$i]["pro_id"]==$pro_id))
{
$retval = "Y";
}
}
return $retval;
}
// database function
function updateItemQty($pro_id, $pro_qty, $pro_price, $proccessType="")
{
for($i=0 ; $i < count($this->sb_item) ; $i++)
{
if($this->sb_item[$i]["pro_id"]==$pro_id)
{
if($proccessType=="add")
$this->sb_item[$i]["pro_qty"]+=$pro_qty;
else
$this->sb_item[$i]["pro_qty"] = $pro_qty;
}
}
}
function insertItem($pro_id, $pro_qty, $pro_price)
{
$ttl_item = count($this->sb_item);
$this->sb_item[$ttl_item]['pro_id'] = $pro_id;
$this->sb_item[$ttl_item]['pro_qty'] = $pro_qty;
$this->sb_item[$ttl_item]['pro_price'] = $pro_price;
}
function destoryShoppingBag()
{
unset($this->sb_item);
}
}//class
?>
Fatal error: Class 'shoppingBag' not found in C:\Data\www\wahhinghong\config.php on line 9