reset(); } function restore_contents() { if (!isset($_SESSION['customer_id'])) return false; // insert current cart contents in database if (is_array($this->contents)) { reset($this->contents); $db =& oosDBGetConn(); $oosDBTable = oosDBGetTables(); while (list($products_id, ) = each($this->contents)) { $qty = $this->contents[$products_id]['qty']; $towlid = $this->contents[$products_id]['towlid']; if ($_SESSION['customer_wishlist_link_id'] == $towlid) { $towlid = ''; $db->Execute("DELETE FROM " . $oosDBTable['customers_wishlist'] . " WHERE customers_id= '" . intval($_SESSION['customer_id']) . "' AND products_id = '" . oosDBInput($products_id) . "'"); $db->Execute("DELETE FROM " . $oosDBTable['customers_wishlist_attributes'] . " WHERE customers_id= '" . intval($_SESSION['customer_id']) . "' AND products_id = '" . oosDBInput($products_id) . "'"); } $product_sql = "SELECT products_id FROM " . $oosDBTable['customers_basket'] . " WHERE customers_id = '" . intval($_SESSION['customer_id']) . "' AND products_id = '" . intval($products_id) . "'"; $product_result = $db->Execute($product_sql); if (!$product_result->RecordCount()) { $db->Execute("INSERT INTO " . $oosDBTable['customers_basket'] . " (customers_id, to_wishlist_id, products_id, customers_basket_quantity, customers_basket_date_added) VALUES ('" . intval($_SESSION['customer_id']) . "', '" . oosDBInput($towlid) . "', '" . oosDBInput($products_id) . "', '" . intval($qty) . "', '" . oosDBInput(date('Ymd')) . "')"); if (isset($this->contents[$products_id]['attributes'])) { reset($this->contents[$products_id]['attributes']); while (list($option, $value) = each($this->contents[$products_id]['attributes'])) { $attr_value = $this->contents[$products_id]['attributes_values'][$option]; $db->Execute("INSERT INTO " . $oosDBTable['customers_basket_attributes'] . " (customers_id, products_id, products_options_id, products_options_value_id, products_options_value_text) VALUES ('" . intval($_SESSION['customer_id']) . "', '" . oosDBInput($products_id) . "', '" . oosDBInput($option) . "', '" . oosDBInput($value) . "', '" . oosDBInput($attr_value) . "')"); } } } else { $db->Execute("UPDATE " . $oosDBTable['customers_basket'] . " SET customers_basket_quantity = '" . intval($qty) . "' WHERE customers_id = '" . intval($_SESSION['customer_id']) . "' AND products_id = '" . oosDBInput($products_id) . "'"); } } if (isset($_SESSION['gv_id'])) { $remote = oos_server_get_remote(); $gv_result = $db->Execute("INSERT INTO " . $oosDBTable['coupon_redeem_track'] . " (coupon_id, customer_id, redeem_date, redeem_ip) VALUES ('" . oosDBInput($_SESSION['gv_id']) . "', '" . intval($_SESSION['customer_id']) . "', now(), '" . oosDBInput($remote) . "')"); $gv_update = $db->Execute("UPDATE " . $oosDBTable['coupons'] . " SET coupon_active = 'N' WHERE coupon_id = '" . oosDBInput($_SESSION['gv_id']) . "'"); oos_gv_account_update($_SESSION['customer_id'], $_SESSION['gv_id']); unset($_SESSION['gv_id']); } } // reset per-session cart contents, but not the database contents $this->reset(false); $sql = "SELECT products_id, to_wishlist_id, customers_basket_quantity FROM " . $oosDBTable['customers_basket'] . " WHERE customers_id = '" . intval($_SESSION['customer_id']) . "'"; $products_result = $db->Execute($sql); while ($products = $products_result->fields) { $this->contents[$products['products_id']] = array('qty' => $products['customers_basket_quantity'], 'towlid' => $products['to_wishlist_id']); // attributes $sql = "SELECT products_options_id, products_options_value_id, products_options_value_text FROM " . $oosDBTable['customers_basket_attributes'] . " WHERE customers_id = '" . intval($_SESSION['customer_id']) . "' AND products_id = '" . $products['products_id'] . "'"; $attributes_result = $db->Execute($sql); while ($attributes = $attributes_result->fields) { $this->contents[$products['products_id']]['attributes'][$attributes['products_options_id']] = $attributes['products_options_value_id']; if ($attributes['products_options_value_id'] == PRODUCTS_OPTIONS_VALUE_TEXT_ID) { $this->contents[$products['products_id']]['attributes_values'][$attributes['products_options_id']] = $attributes['products_options_value_text']; } $attributes_result->MoveNext(); } $products_result->MoveNext(); } $this->cleanup(); } function reset($reset_database = false) { $this->contents = array(); $this->total = 0; $this->weight = 0; $this->content_type = false; $db =& oosDBGetConn(); $oosDBTable = oosDBGetTables(); if (isset($_SESSION['customer_id']) && ($reset_database == true)) { $db->Execute("DELETE FROM " . $oosDBTable['customers_basket'] . " WHERE customers_id = '" . intval($_SESSION['customer_id']) . "'"); $db->Execute("DELETE FROM " . $oosDBTable['customers_basket_attributes'] . " WHERE customers_id = '" . intval($_SESSION['customer_id']) . "'"); } unset($this->cartID); if (isset($_SESSION['cartID'])) unset($_SESSION['cartID']); } function add_cart($products_id, $nQuantity = '1', $attributes = '', $notify = true, $towlid = '') { $db =& oosDBGetConn(); $oosDBTable = oosDBGetTables(); $sProductsId = oos_get_uprid($products_id, $attributes); $nProductsId = oos_get_product_id($sProductsId); $nQuantity = intval($nQuantity); if (is_numeric($nProductsId) && is_numeric($nQuantity)) { $check_product_sql = "SELECT products_status FROM " . $oosDBTable['products'] . " WHERE products_id = '" . intval($nProductsId) . "'"; $check_product_result = $db->Execute($check_product_sql); if (($check_product_result !== false) && ($check_product_result->fields['products_status'] >= '1')) { if ($notify == true) { $_SESSION['new_products_id_in_cart'] = $sProductsId; } if (isset($_SESSION['customer_wishlist_link_id']) && ($_SESSION['customer_wishlist_link_id'] == $towlid)) { $towlid = ''; $db->Execute("DELETE FROM " . $oosDBTable['customers_wishlist'] . " WHERE customers_id = '" . intval($_SESSION['customer_id']) . "' AND products_id = '" . oosDBInput($sProductsId) . "'"); $db->Execute("DELETE FROM " . $oosDBTable['customers_wishlist_attributes'] . " WHERE customers_id = '" . intval($_SESSION['customer_id']) . "' AND products_id = '" . oosDBInput($sProductsId) . "'"); } if ($this->in_cart($sProductsId)) { $this->update_quantity($sProductsId, $nQuantity, $attributes, $towlid); } else { $this->contents[] = array($sProductsId); $this->contents[$sProductsId] = array('qty' => $nQuantity, 'towlid' => $towlid); // insert into database if (isset($_SESSION['customer_id'])) { $db->Execute("INSERT INTO " . $oosDBTable['customers_basket'] . " (customers_id, to_wishlist_id, products_id, customers_basket_quantity, customers_basket_date_added) VALUES (" . $db->qstr($_SESSION['customer_id']) . ',' . $db->qstr($towlid) . ',' . $db->qstr($sProductsId) . ',' . $db->qstr($nQuantity) . ',' . $db->qstr(date('Ymd')) . ")"); } if (is_array($attributes)) { reset($attributes); while (list($option, $value) = each($attributes)) { $attr_value = NULL; $blank_value = FALSE; if (strstr($option, TEXT_PREFIX)) { if (trim($value) == NULL) { $blank_value = TRUE; } else { $option = substr($option, strlen(TEXT_PREFIX)); $attr_value = htmlspecialchars(stripslashes($value), ENT_QUOTES); $value = PRODUCTS_OPTIONS_VALUE_TEXT_ID; $this->contents[$sProductsId]['attributes_values'][$option] = $attr_value; } } if (!$blank_value) { $this->contents[$sProductsId]['attributes'][$option] = $value; // insert into database if (isset($_SESSION['customer_id'])) { $db->Execute("INSERT INTO " . $oosDBTable['customers_basket_attributes'] . " (customers_id, products_id, products_options_id, products_options_value_id, products_options_value_text) VALUES (" . $db->qstr($_SESSION['customer_id']) . ',' . $db->qstr($sProductsId) . ',' . $db->qstr($option) . ',' . $db->qstr($value) . ',' . $db->qstr($attr_value) . ")"); } } } } } $this->cleanup(); // assign a temporary unique ID to the order contents to prevent hack attempts during the checkout procedure $this->cartID = $this->generate_cart_id(); } } } function update_quantity($products_id, $nQuantity = '', $attributes = '', $towlid = '') { $sProductsId = oos_get_uprid($products_id, $attributes); $nProductsId = oos_get_product_id($sProductsId); $nQuantity = intval($nQuantity); if (is_numeric($nProductsId) && isset($this->contents[$sProductsId]) && is_numeric($nQuantity)) { $this->contents[$sProductsId] = array('qty' => $nQuantity, 'towlid' => $towlid); // update database $db =& oosDBGetConn(); $oosDBTable = oosDBGetTables(); if (isset($_SESSION['customer_id'])) $db->Execute("UPDATE " . $oosDBTable['customers_basket'] . " SET customers_basket_quantity = '" . intval($nQuantity) . "' WHERE customers_id = '" . intval($_SESSION['customer_id']) . "' AND products_id = '" . oosDBInput($sProductsId) . "'"); if (is_array($attributes)) { reset($attributes); while (list($option, $value) = each($attributes)) { $attr_value = NULL; $blank_value = FALSE; if (strstr($option, TEXT_PREFIX)) { if (trim($value) == NULL) { $blank_value = TRUE; } else { $option = substr($option, strlen(TEXT_PREFIX)); // $attr_value = htmlspecialchars(stripslashes($value), ENT_QUOTES); $attr_value = stripslashes($value); $value = PRODUCTS_OPTIONS_VALUE_TEXT_ID; $this->contents[$sProductsId]['attributes_values'][$option] = $attr_value; } } if (!$blank_value) { $this->contents[$sProductsId]['attributes'][$option] = $value; // update database if (isset($_SESSION['customer_id'])) { $db->Execute("UPDATE " . $oosDBTable['customers_basket_attributes'] . " SET products_options_value_id = '" . oosDBInput($value) . "', products_options_value_text = '" . oosDBInput($attr_value) . "' WHERE customers_id = '" . intval($_SESSION['customer_id']) . "' AND products_id = '" . oosDBInput($sProductsId) . "' AND products_options_id = '" . oosDBInput($option) . "'"); } } } } } } function check_products_status($products_id) { // Get database information $db =& oosDBGetConn(); $oosDBTable = oosDBGetTables(); $product_info_sql = "SELECT products_id FROM " . $oosDBTable['products'] . " WHERE products_status >= '1' AND products_id='" . oos_get_product_id($products_id) . "'"; $product_result = $db->Execute($product_info_sql); if (!$product_result->RecordCount()) { return false; } else { return true; } } function cleanup() { $db =& oosDBGetConn(); $oosDBTable = oosDBGetTables(); reset($this->contents); while (list($key,) = each($this->contents)) { if ($this->contents[$key]['qty'] < 1) { unset($this->contents[$key]); // remove from database if (isset($_SESSION['customer_id'])) { $db->Execute("DELETE FROM " . $oosDBTable['customers_basket'] . " WHERE customers_id = '" . intval($_SESSION['customer_id']) . "' AND products_id = '" . oosDBInput($key) . "'"); $db->Execute("DELETE FROM " . $oosDBTable['customers_basket_attributes'] . " WHERE customers_id = '" . intval($_SESSION['customer_id']) . "' AND products_id = '" . oosDBInput($key) . "'"); } } } } function count_contents() { // get total number of items in cart $total_items = 0; if (is_array($this->contents)) { reset($this->contents); while (list($products_id, ) = each($this->contents)) { $total_items += $this->get_quantity($products_id); } } return $total_items; } function get_quantity($products_id) { if (isset($this->contents[$products_id])) { $nQuantity = $this->contents[$products_id]['qty']; $nQuantity = intval($nQuantity); return $nQuantity; } else { return 0; } } function in_cart($products_id) { if (isset($this->contents[$products_id])) { return true; } else { return false; } } function remove($products_id) { $db =& oosDBGetConn(); $oosDBTable = oosDBGetTables(); unset($this->contents[$products_id]); // remove from database if (isset($_SESSION['customer_id'])) { $db->Execute("DELETE FROM " . $oosDBTable['customers_basket'] . " WHERE customers_id = '" . intval($_SESSION['customer_id']) . "' AND products_id = '" . oosDBInput($products_id) . "'"); $db->Execute("DELETE FROM " . $oosDBTable['customers_basket_attributes'] . " WHERE customers_id = '" . intval($_SESSION['customer_id']) . "' AND products_id = '" . oosDBInput($products_id) . "'"); } // assign a temporary unique ID to the order contents to prevent hack attempts during the checkout procedure $this->cartID = $this->generate_cart_id(); } function remove_all() { $this->reset(); } function get_product_id_list() { $product_id_list = ''; if (is_array($this->contents)) { reset($this->contents); while (list($products_id, ) = each($this->contents)) { $product_id_list .= ', ' . $products_id; } } return substr($product_id_list, 2); } function calculate() { $this->total_virtual = 0; // Gift Voucher System $this->weight_virtual = 0; $this->total = 0; $this->weight = 0; if (!is_array($this->contents)) return 0; $db =& oosDBGetConn(); $oosDBTable = oosDBGetTables(); reset($this->contents); while (list($products_id, ) = each($this->contents)) { $nQuantity = $this->contents[$products_id]['qty']; $nQm = 1 ; if (isset($this->contents[$products_id]['attributes_values'])) { reset($this->contents[$products_id]['attributes_values']); while (list($option, $value) = each($this->contents[$products_id]['attributes_values'])) { if ($option == '2') { $a = intval($value); } elseif ($option == '1') { $b = intval($value); } } } if ((isset($a)) or (isset($b))) { if (is_numeric($a) AND ($a >= 1)) { } else { $a = 1; } if (is_numeric($b) AND ($b >= 1)) { } else { $b = 1; } $nQm = $a * $b; } // products price $product_sql = "SELECT products_id, products_model, products_price, products_discount_allowed, products_tax_class_id, products_weight FROM " . $oosDBTable['products'] . " WHERE products_id='" . oos_get_product_id($products_id) . "'"; $product_result = $db->Execute($product_sql); if ($product = $product_result->fields) { $no_count = 1; if (ereg('^GIFT', $product['products_model'])) { $no_count = 0; } $prid = $product['products_id']; $products_tax = oos_get_tax_rate($product['products_tax_class_id']); if ($_SESSION['member']->group['qty_discounts'] == 1) { $products_price = $this->products_price_actual($prid, $product['products_price'], $nQuantity); } else { $products_price = $product['products_price']; } $max_product_discount = min($product['products_discount_allowed'], $_SESSION['member']->group['discount']); $products_price = $products_price*(100-$max_product_discount)/100; $products_weight = $product['products_weight']; $sql = "SELECT specials_new_products_price FROM " . $oosDBTable['specials'] . " WHERE products_id = '" . intval($prid) . "' AND status = '1'"; $specials_result = $db->Execute($sql); if ($specials_result->RecordCount()) { $specials = $specials_result->fields; $products_price = $specials['specials_new_products_price']; } $products_price = $products_price * $nQm; $this->total_virtual += oos_add_tax($products_price, $products_tax) * $nQuantity * $no_count; $this->weight_virtual += ($nQuantity * $products_weight) * $no_count; $this->total += oos_add_tax($products_price, $products_tax) * $nQuantity; $this->weight += ($nQuantity * $products_weight); } // attributes price if (isset($this->contents[$products_id]['attributes'])) { reset($this->contents[$products_id]['attributes']); while (list($option, $value) = each($this->contents[$products_id]['attributes'])) { $sql = "SELECT options_values_price, price_prefix FROM " . $oosDBTable['products_attributes'] . " WHERE products_id = '" . intval($prid) . "' AND options_id = '" . intval($option) . "' AND options_values_id = '" . intval($value) . "'"; $attribute_price_result = $db->Execute($sql); $attribute_price = $attribute_price_result->fields; if ($attribute_price['price_prefix'] == '+') { $this->total += $nQuantity * oos_add_tax($attribute_price['options_values_price'], $products_tax); } else { $this->total -= $nQuantity * oos_add_tax($attribute_price['options_values_price'], $products_tax); } } } } } function products_price_actual($product_id, $actual_price, $products_qty) { $new_price = $actual_price; if ($new_special_price = oos_get_products_special_price($product_id)) { $new_price = $new_special_price; } if ($new_discounts_price = oos_get_products_price_quantity_discount($product_id, $products_qty, $new_price)){ $new_price = $new_discounts_price; } return $new_price; } function attributes_price($products_id) { $attributes_price = 0; if (isset($this->contents[$products_id]['attributes'])) { reset($this->contents[$products_id]['attributes']); $db =& oosDBGetConn(); $oosDBTable = oosDBGetTables(); while (list($option, $value) = each($this->contents[$products_id]['attributes'])) { $attribute_price_sql = "SELECT options_values_price, price_prefix FROM " . $oosDBTable['products_attributes'] . " WHERE products_id = '" . intval($products_id) . "' AND options_id = '" . intval($option) . "' AND options_values_id = '" . intval($value) . "'"; $attribute_price_result = $db->Execute($attribute_price_sql); $attribute_price = $attribute_price_result->fields; if ($attribute_price['price_prefix'] == '+') { $attributes_price += $attribute_price['options_values_price']; } else { $attributes_price -= $attribute_price['options_values_price']; } } } return $attributes_price; } function get_products() { if (!is_array($this->contents)) return false; $db =& oosDBGetConn(); $oosDBTable = oosDBGetTables(); $nLanguageID = isset($_SESSION['language_id']) ? $_SESSION['language_id']+0 : 1; $products_array = array(); reset($this->contents); while (list($products_id, ) = each($this->contents)) { $nQuantity = $this->contents[$products_id]['qty']; $nQm = 1 ; if (isset($this->contents[$products_id]['attributes_values'])) { reset($this->contents[$products_id]['attributes_values']); while (list($option, $value) = each($this->contents[$products_id]['attributes_values'])) { if ($option == '2') { $a = intval($value); } elseif ($option == '1') { $b = intval($value); } } } if ((isset($a)) or (isset($b))) { if (is_numeric($a) AND ($a >= 1)) { } else { $a = 1; } if (is_numeric($b) AND ($b >= 1)) { } else { $b = 1; } $nQm = $a * $b; } $sql = "SELECT p.products_id, pd.products_name, p.products_image, p.products_model, p.products_ean, p.products_price, p.products_discount_allowed, p.products_weight, p.products_tax_class_id FROM " . $oosDBTable['products'] . " p, " . $oosDBTable['products_description'] . " pd WHERE p.products_id = '" . oos_get_product_id($products_id) . "' AND pd.products_id = p.products_id AND pd.products_languages_id = '" . intval($nLanguageID) . "'"; $products_result = $db->Execute($sql); if ($products = $products_result->fields) { $prid = $products['products_id']; if ($_SESSION['member']->group['qty_discounts'] == 1) { $products_price = $this->products_price_actual($prid, $products['products_price'], $nQuantity); } else { $products_price = $products['products_price']; } $max_product_discount = min($products['products_discount_allowed'], $_SESSION['member']->group['discount']); $products_price = $products_price*(100-$max_product_discount)/100; $spezial_price = 'false'; $sql = "SELECT specials_new_products_price FROM " . $oosDBTable['specials'] . " WHERE products_id = '" . intval($prid) . "' AND status = '1'"; $specials_result = $db->Execute($sql); if ($specials_result->RecordCount()) { $spezial_price = 'true'; $specials = $specials_result->fields; $products_price = $specials['specials_new_products_price']; } $products_price = $products_price * $nQm; $products_array[] = array('id' => $products_id, 'name' => $products['products_name'], 'model' => $products['products_model'], 'image' => $products['products_image'], 'ean' => $products['products_ean'], 'price' => $products_price, 'spezial' => $spezial_price, 'discount_allowed' => $products['products_discount_allowed'], 'quantity' => $this->contents[$products_id]['qty'], 'weight' => $products['products_weight'], 'final_price' => ($products_price + $this->attributes_price($products_id)), 'tax_class_id' => $products['products_tax_class_id'], 'attributes' => (isset($this->contents[$products_id]['attributes']) ? $this->contents[$products_id]['attributes'] : ''), 'attributes_values' => (isset($this->contents[$products_id]['attributes_values']) ? $this->contents[$products_id]['attributes_values'] : ''), 'towlid' => $this->contents[$products_id]['towlid']); } } return $products_array; } function show_total() { $this->calculate(); return $this->total; } function show_weight() { $this->calculate(); return $this->weight; } function show_total_virtual() { $this->calculate(); return $this->total_virtual; } function show_weight_virtual() { $this->calculate(); return $this->weight_virtual; } function generate_cart_id($length = 5) { return oos_create_random_value($length, 'digits'); } function get_content_type() { $this->content_type = false; $db =& oosDBGetConn(); $oosDBTable = oosDBGetTables(); if ( (DOWNLOAD_ENABLED == 'true') && ($this->count_contents() > 0) || ($this->show_weight() == 0 )&& ($this->count_contents() > 0) ) { reset($this->contents); while (list($products_id, ) = each($this->contents)) { if (isset($this->contents[$products_id]['attributes'])) { reset($this->contents[$products_id]['attributes']); while (list(, $value) = each($this->contents[$products_id]['attributes'])) { $sql = "SELECT COUNT(*) AS total FROM " . $oosDBTable['products_attributes'] . " pa, " . $oosDBTable['products_attributes_download'] . " pad WHERE pa.products_id = '" . intval($products_id) . "' AND pa.options_values_id = '" . intval($value) . "' AND pa.products_attributes_id = pad.products_attributes_id"; $virtual_check_result = $db->Execute($sql); $virtual_check = $virtual_check_result->fields; if ($virtual_check['total'] > 0) { switch ($this->content_type) { case 'physical': $this->content_type = 'mixed'; return $this->content_type; break; default: $this->content_type = 'virtual'; break; } } else { switch ($this->content_type) { case 'virtual': $this->content_type = 'mixed'; return $this->content_type; break; default: $this->content_type = 'physical'; break; } } } } elseif ($this->show_weight() == 0) { reset($this->contents); while (list($products_id, ) = each($this->contents)) { $sql = "SELECT products_weight FROM " . $oosDBTable['products'] . " WHERE products_id = '" . intval($products_id) . "'"; $virtual_check_result = $db->Execute($sql); $virtual_check = $virtual_check_result->fields; if ($virtual_check['products_weight'] == 0) { switch ($this->content_type) { case 'physical': $this->content_type = 'mixed'; return $this->content_type; break; default: $this->content_type = 'virtual_weight'; break; } } else { switch ($this->content_type) { case 'virtual': $this->content_type = 'mixed'; return $this->content_type; break; default: $this->content_type = 'physical'; break; } } } } else { switch ($this->content_type) { case 'virtual': $this->content_type = 'mixed'; return $this->content_type; break; default: $this->content_type = 'physical'; break; } } } } else { $this->content_type = 'physical'; } return $this->content_type; } function unserialize($broken) { for(reset($broken);$kv=each($broken);) { $key=$kv['key']; if (gettype($this->$key)!="user function") $this->$key=$kv['value']; } } /** * ICWILSON CREDIT CLASS Gift Voucher Addittion Start * amend count_contents to show nil contents for shipping * as we don't want to quote for 'virtual' item * GLOBAL CONSTANTS if NO_COUNT_ZERO_WEIGHT is true then we don't count any product with a weight * which is less than or equal to MINIMUM_WEIGHT * otherwise we just don't count gift certificates */ function count_contents_virtual() { // get total number of items in cart disregard gift vouchers $db =& oosDBGetConn(); $oosDBTable = oosDBGetTables(); $total_items = 0; if (is_array($this->contents)) { reset($this->contents); while (list($products_id, ) = each($this->contents)) { $no_count = false; $sql = "SELECT products_model FROM " . $oosDBTable['products'] . " WHERE products_id = '" . intval($products_id) . "'"; $gv_result = $db->Execute($sql); $gv_result = $gv_result->fields; if (ereg('^GIFT', $gv_result['products_model'])) { $no_count = true; } if (NO_COUNT_ZERO_WEIGHT == 1) { $sql = "SELECT products_weight FROM " . $oosDBTable['products'] . " WHERE products_id = '" . oos_get_product_id($products_id) . "'"; $gv_result = $db->Execute($sql); $gv_result = $gv_result->fields; if ($gv_result['products_weight']<=MINIMUM_WEIGHT) { $no_count = true; } } if (!$no_count) $total_items += $this->get_quantity($products_id); } } return $total_items; } } ?>