$_SESSION['error_cart_msg'] = $aLang['error_products_quantity_order_min_text'] . $aLang['error_products_units_invalid'] . $cart_quantity . ' - ' . $aLang['products_order_qty_unit_text_info'] . ' ' . $products_order_units; } } else { $_SESSION['error_cart_msg'] = $aLang['error_products_quantity_order_min_text'] . $aLang['error_products_quantity_invalid'] . $cart_quantity . ' - ' . $aLang['products_order_qty_min_text_info'] . ' ' . $products_order_min; } } if ($_SESSION['error_cart_msg'] == '') { MyOOS_CoreApi::redirect(oos_href_link($goto_file, oos_get_all_get_parameters($parameters), 'NONSSL')); } else { MyOOS_CoreApi::redirect(oos_href_link($aPages['product_info'], 'products_id=' . $_POST['products_id'])); } } break; case 'frend_wishlist_add_product': if (isset($_POST['products_id']) && is_numeric($_POST['cart_quantity'])) { $cart_qty = $_SESSION['cart']->get_quantity(oos_get_uprid($_POST['products_id'], $_POST['id'])); $news_qty = $cart_qty + $cart_quantity; $products_order_min = oos_get_products_quantity_order_min($_POST['products_id']); $products_order_units = oos_get_products_quantity_order_units($_POST['products_id']); if ($cart_quantity >= $products_order_min or $cart_qty >= $products_order_min) { if ($cart_quantity % $products_order_units == 0 and $news_qty >= $products_order_min) { $_SESSION['cart']->add_cart($_POST['products_id'], intval($news_qty), $_POST['id'], true, $_POST['to_wl_id']); } else { $_SESSION['error_cart_msg'] = $aLang['error_products_quantity_order_min_text'] . $aLang['error_products_units_invalid'] . $cart_quantity . ' - ' . $aLang['products_order_qty_unit_text_info'] . ' ' . $products_order_units; } } else { $_SESSION['error_cart_msg'] = $aLang['error_products_quantity_order_min_text'] . $aLang['error_products_quantity_invalid'] . $cart_quantity . ' - ' . $aLang['products_order_qty_min_text_info'] . ' ' . $products_order_min; } if ($_SESSION['error_cart_msg'] == '') { MyOOS_CoreApi::redirect(oos_href_link($goto_file, oos_get_all_get_parameters($parameters), 'NONSSL')); } else {
function update_quantity($products_id, $nQuantity = '', $attributes = '', $towlid = '') { $sProductsId = oos_get_uprid($products_id, $attributes); $nProductsId = oos_get_product_id($sProductsId); if (is_numeric($nProductsId) && isset($this->contents[$sProductsId]) && is_numeric($nQuantity)) { // Get database information $dbconn =& oosDBGetConn(); $oostable =& oosDBGetTables(); if (DECIMAL_CART_QUANTITY == '1') { $productstable = $oostable['products']; $decimal_sql = "SELECT products_quantity_decimal\r\n FROM {$productstable}\r\n WHERE products_id = '" . intval($nProductsId) . "'"; $products_quantity_decimal = $dbconn->GetOne($decimal_sql); if ($products_quantity_decimal == 0) { $nQuantity = intval($nQuantity); } } $this->contents[$sProductsId] = array('qty' => $nQuantity, 'towlid' => $towlid); if (isset($_SESSION['customer_id'])) { $customers_baskettable = $oostable['customers_basket']; $dbconn->Execute("UPDATE {$customers_baskettable}\r\n SET customers_basket_quantity = '" . oos_db_input($nQuantity) . "'\r\n WHERE customers_id = '" . intval($_SESSION['customer_id']) . "' AND\r\n products_id = '" . oos_db_input($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; } } elseif (strstr($option, TEXTAREA_PREFIX)) { if (trim($value) == NULL) { $blank_value = TRUE; } else { $option = substr($option, strlen(TEXTAREA_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'])) { $customers_basket_attributestable = $oostable['customers_basket_attributes']; $dbconn->Execute("UPDATE {$customers_basket_attributestable}\r\n SET products_options_value_id = '" . oos_db_input($value) . "',\r\n products_options_value_text = '" . oos_db_input($attr_value) . "'\r\n WHERE customers_id = '" . intval($_SESSION['customer_id']) . "'\r\n AND products_id = '" . oos_db_input($sProductsId) . "'\r\n AND products_options_id = '" . oos_db_input($option) . "'"); } } } } } }