<?php
/**
  @licence GPL 2005-2011  The osCSS developers - osCSS Open Source E-commerce
  @portion code Copyright (c) 2002 osCommerce
  @package osCSS-2 <www http://www.oscss.org>
  @version 2.1.0
  @date  24/01/11, 19:24
  @author oscim <mail aurelien@oscim.fr> <www http://www.oscim.fr>
  @encode UTF-8
  @brief code is part of execution shopping cart by ajax control
*/
     $cart_id_get = (int)tep_output_string_protected($_GET['cart_id']);
      $total_nb_products_with_qty = 0;
      $products = $cart->get_products();

      if(!empty($_GET['product_qty'])) {

        $product_qty_get = (int)tep_output_string_protected($_GET['product_qty']);
        $attributes = (isset($products[$cart_id_get]['attributes'])) ? $products[$cart_id_get]['attributes'] : '';

        $cart->add_cart($products[$cart_id_get]['id'], $product_qty_get, $attributes, false);

        $subTotal = $currencies->format($cart->show_total());
        $products_sum = $currencies->format(tep_round(tep_add_tax($products[$cart_id_get]['final_price'], tep_get_tax_rate($products[$cart_id_get]['tax_class_id'])),$currencies->currencies[DEFAULT_CURRENCY]['decimal_places']) *$product_qty_get  );

        $products_box = $cart->get_products();
        $total_nb_products_with_qty=0;
        foreach($cart->get_products() as $products_box)
          $total_nb_products_with_qty += $products_box['quantity'];

	echo $total_nb_products_with_qty.'|'.$products_sum.'|'.$subTotal;

      } else {

        $cart->remove($products[$cart_id_get]['id']);
        $subTotal = $currencies->format($cart->show_total());

        $products_box = $cart->get_products();
	foreach($cart->get_products() as $products_box)
	  $total_nb_products_with_qty += $products_box['quantity'];

        echo $total_nb_products_with_qty.'|'.$subTotal;

      }
?>