// definisem bazu
require_once("../include/classes/objdatabaze.php");
$db = new databaze;
// otvorim konekciju
$db->connect();
include("shoppingcart.php");
$table = "shopping";
$cart = new Cart;
$sh="";
//foreach($_SERVER as $key => $value) {
// echo "$key => $value
";
//}
// echo $_SERVER['REQUEST_URI']."?";
// echo $_SERVER['QUERY_STRING'];
// echo $_SERVER['PHP_SELF'];
$add = $_REQUEST['add'];
$remove = $_REQUEST['remove'];
$modify = $_REQUEST['modify'];
if($add)
{
if($ShoppingCart) {
$session = $ShoppingCart;
}
//$db->query("SELECT oglasi.id as ID FROM oglasi WHERE ID='" . $add . "'");
//$row = mysql_fetch_object($db->rs);
$cart->add_item($table,$session,$add,1);
// dodaj url adresu za povratak iz odabranih oglasa!!!
// eh kad je blic u pitanju onda ovo ne radi
// $_SESSION['lista_shcart_backurl'] = "[ Nazad ] ";
// pokusaj nesto drugo
$_SESSION['lista_shcart_backurl'] = "[ Nazad ] ";
$_SESSION['NUM_ITEMS_IN_CART'] = $cart->num_items($table,$session);
}
if($remove)
{
if($ShoppingCart)
{
$session = $ShoppingCart;
}
$sql = "SELECT oglasi.id as ID FROM oglasi WHERE ID=" . $remove . "";
$db->query($sql);
$row = mysql_fetch_object($db->rs);
$cart->delete_item($table,$session,$row->ID);
$_SESSION['NUM_ITEMS_IN_CART'] = $cart->num_items($table,$session);
$sh="&shcart=1";
}
if($modify)
{
$contents = $cart->display_contents($table,$session);
for($i = 0; $i < sizeof($quantity); $i++)
{
$oldquan = $contents[quantity][$i];
$product = $contents[OGLID][$i];
$newquan = $quantity[OGLID];
$cart->modify_quantity($table,$session,$OGLID,$newquan);
}
$_SESSION['NUM_ITEMS_IN_CART'] = $cart->num_items($table,$session);
}
// End update cart
// diskonektujem
$db->disconnect();
$lgoto = ($sh <> "") ? "oglasi/oglasi.php?shcart=1" : $_SESSION['LQRY'] ;
echo "";
// history.go(-1);
?>