<?php
/**
 * 
 * @file cart.php
 * @copyright (c) 2005 - 2011 eifr.com
 * @license http://www.gnu.org/copyleft/gpl.html gnu/gpl
 * eifr is free software
 */
require_once('../includes/inc_general.php');

$clCart = new CCart();

if (!isset($action)) {
    $action = '';
} 
if (!isset($articleID)) {
    $articleID = '';
} 
Log_d(__FILE__, __LINE__, 'action:' . $action . ', articleID:' . $articleID);

switch ($action) {
    case "addToCart":
        Log_d(__FILE__, __LINE__, 'addToCart, articleID=' . $articleID);
        $row = array('id' => $articleID, 'title' => 'product1', 'price' => 33.5, 'quantity' => 3);
        $rc = $clCart -> addCart($row);
        if ($rc) {
            Log_d(__FILE__, __LINE__, 'addToCart OK');
            echo $clCart -> getItemHtml($row);
        } 
        break;
    case "delFromCart":
        Log_d(__FILE__, __LINE__, 'delFromCart, articleID=' . $articleID);
        $clCart -> delCart($articleID);
        break;
    case "emptyCart":
        Log_d(__FILE__, __LINE__, 'emptyCart');
        $clCart -> emptyCart();
    case "reloadCart":
        Log_d(__FILE__, __LINE__, 'reloadCart');
        echo $clCart -> getCartHtml();
        break;
    default:
        Log_d(__FILE__, __LINE__, 'action null');
        break;
} 

?>
