function add_cart($products_id, $qty = EMPTY_STRING, $attributes = EMPTY_STRING)
 {
     $products_id = olc_get_uprid($products_id, $attributes);
     if ($this->in_cart($products_id)) {
         $this->update_quantity($products_id, $qty, $attributes);
     } else {
         if ($qty == EMPTY_STRING) {
             $qty = '1';
         }
         // if no quantity is supplied, then add '1' to the customers basket
         $this->contents[] = array($products_id);
         $this->contents[$products_id] = array('qty' => $qty);
         // insert into database
         if (CUSTOMER_ID) {
             $insert = INSERT_INTO;
             $sep = "', '";
             $fields = " (customers_id, products_id, ";
             $values = ") values ('" . CUSTOMER_ID . "', '" . $products_id . $sep;
             olc_db_query($insert . TABLE_CUSTOMERS_BASKET . $fields . "customers_basket_quantity, customers_basket_date_added" . $values . $qty . $sep . date('Ymd') . "')");
         }
         if (is_array($attributes)) {
             reset($attributes);
             while (list($option, $value) = each($attributes)) {
                 $this->contents[$products_id]['attributes'][$option] = $value;
                 // insert into database
                 if (CUSTOMER_ID) {
                     olc_db_query($insert . TABLE_CUSTOMERS_BASKET_ATTRIBUTES . $fields . "products_options_id, products_options_value_id" . $values . $option . $sep . $value . "')");
                 }
             }
         }
         $_SESSION['new_products_id_in_cart'] = $products_id;
     }
     $this->cleanup();
 }
 function update_quantity($products_id, $quantity = EMPTY_STRING, $attributes = EMPTY_STRING)
 {
     if (empty($quantity)) {
         return true;
     }
     // nothing needs to be updated if theres no quantity, so we return true.
     /*# auction.lister ########################
     		# look if product in cart is an auction #
     		# START-                                #
     		#########################################*/
     //tmp save passed productid
     $old_prod_id = $products_id;
     $products_id_string = olc_get_uprid($products_id, $attributes);
     $products_id = $products_id_string;
     //olc_get_prid($products_id_string);
     $pid = $products_id_string;
     if (is_numeric($products_id) && is_numeric($quantity) && (isset($this->contents[$products_id_string]) || isset($this->contents[$old_prod_id]))) {
         //substract auctionid (out of combination --> productid[auctionid])
         $myauctionid = substr(strstr($old_prod_id, "["), 1, -1);
         //get clear productid (out of combination --> productid[auctionid])
         $myproducts_id = explode("[", $old_prod_id);
         //look if products are in productsarray (auction and normal products)
         if ($myauctionid) {
             //if an auction
             $pid = $old_prod_id;
             //also set auctionid in productsarray
             $this->contents[$old_prod_id][AUCTION_ID_TEXT] = $myauctionid;
         }
     }
     $this->contents[$pid] = array('qty' => $quantity);
     // update database
     if (CUSTOMER_ID) {
         if (!$myauctionid) {
             olc_db_query(SQL_UPDATE . TABLE_CUSTOMERS_BASKET . " set customers_basket_quantity = '" . $quantity . "' where customers_id = '" . CUSTOMER_ID . "' and products_id = '" . $products_id . APOS);
         }
     }
     if (is_array($attributes)) {
         if (!$myauctionid) {
             $myauctionid = ZERO_STRING;
         }
         reset($attributes);
         while (list($option, $value) = each($attributes)) {
             $this->contents[$pid]['attributes'][$option] = $value;
             // update database
             if (CUSTOMER_ID) {
                 $sql_update0 = SQL_UPDATE . TABLE_CUSTOMERS_BASKET_ATTRIBUTES . " set products_options_value_id = '#3' where customers_id = '" . CUSTOMER_ID . "' and products_id = '#1' and products_options_id = '#2' and auctionid='#4'";
                 $param_array = array('#1COMMA_BLANK#2COMMA_BLANK#3COMMA_BLANK#4');
             }
             while (list($option, $value) = each($attributes)) {
                 $this->contents[$products_id]['attributes'][$option] = $value;
                 // insert into database
                 if (CUSTOMER_ID) {
                     $sql_update = str_replace($param_array, array($products_id, $option, $value, $myauctionid), $sql_update0);
                     olc_db_query($sql_update);
                 }
             }
         }
     }
 }
         if ($products_qty > MAX_PRODUCTS_QTY) {
             $products_qty = MAX_PRODUCTS_QTY;
         }
         $_SESSION['cart']->add_cart($products_id, $quantity_in_cart + $products_qty, $id);
     }
     if ($is_local_processing && isset($_GET['cart_no_show'])) {
         //We do not need to return any real data, as the cart is updated locally!!!
         echo "AJAX-NODATA";
         olc_exit();
     } else {
         $_SESSION['cart_modified'] = true;
         if (IS_AJAX_PROCESSING && !$display_cart) {
             $force_cart_update_only = true;
             return;
         } else {
             $_SESSION['products_id_full'] = olc_get_uprid($products_id, $id);
             olc_redirect(olc_href_link($goto, olc_get_all_get_params($parameters)));
             break;
         }
     }
     //W. Kaiser - AJAX
 //W. Kaiser - AJAX
 case 'check_gift':
     require_once DIR_FS_INC . 'olc_collect_posts.inc.php';
     olc_collect_posts();
     break;
     // customer wants to add a quickie to the cart (called from a box)
 // customer wants to add a quickie to the cart (called from a box)
 case 'add_a_quickie':
     if (DO_GROUP_CHECK) {
         $group_check = " and " . SQL_GROUP_CONDITION;