function affiliate_insert($sql_data_array, $affiliate_parent = 0) { // LOCK TABLES @mysql_query("LOCK TABLES " . TABLE_AFFILIATE . " WRITE"); if ($affiliate_parent > 0) { $affiliate_root_query = vam_db_query("select affiliate_root, affiliate_rgt, affiliate_lft from " . TABLE_AFFILIATE . " where affiliate_id = '" . $affiliate_parent . "' "); // Check if we have a parent affiliate if ($affiliate_root_array = vam_db_fetch_array($affiliate_root_query)) { vam_db_query("update " . TABLE_AFFILIATE . " SET affiliate_lft = affiliate_lft + 2 WHERE affiliate_root = '" . $affiliate_root_array['affiliate_root'] . "' and affiliate_lft > " . $affiliate_root_array['affiliate_rgt'] . " AND affiliate_rgt >= " . $affiliate_root_array['affiliate_rgt'] . " "); vam_db_query("update " . TABLE_AFFILIATE . " SET affiliate_rgt = affiliate_rgt + 2 WHERE affiliate_root = '" . $affiliate_root_array['affiliate_root'] . "' and affiliate_rgt >= " . $affiliate_root_array['affiliate_rgt'] . " "); $sql_data_array['affiliate_root'] = $affiliate_root_array['affiliate_root']; $sql_data_array['affiliate_lft'] = $affiliate_root_array['affiliate_rgt']; $sql_data_array['affiliate_rgt'] = $affiliate_root_array['affiliate_rgt'] + 1; vam_db_perform(TABLE_AFFILIATE, $sql_data_array); $affiliate_id = vam_db_insert_id(); } // no parent -> new root } else { $sql_data_array['affiliate_lft'] = '1'; $sql_data_array['affiliate_rgt'] = '2'; vam_db_perform(TABLE_AFFILIATE, $sql_data_array); $affiliate_id = vam_db_insert_id(); vam_db_query("update " . TABLE_AFFILIATE . " set affiliate_root = '" . $affiliate_id . "' where affiliate_id = '" . $affiliate_id . "' "); } // UNLOCK TABLES @mysql_query("UNLOCK TABLES"); return $affiliate_id; }
function do_install() { $query = "select configuration_group_id from " . TABLE_CONFIGURATION_GROUP . " where configuration_group_key='" . $this->data['key'] . "'"; $rs = vam_db_query($query); if (!vam_db_fetch_array($rs)) { $query = "insert into " . TABLE_CONFIGURATION_GROUP . " (configuration_group_id, configuration_group_title, configuration_group_key, configuration_group_description, sort_order, visible) " . " values ('','" . $this->data['title'] . "','" . $this->data['key'] . "','" . $this->data['descr'] . "'," . ($this->data['sort_order'] == NULL ? "NULL" : $this->data['sort_order']) . "," . ($this->data['visible'] == NULL ? "NULL" : $this->data['visible']) . ")"; vam_db_query($query); if ($this->data['sort_order'] == NULL) { $sid = vam_db_insert_id(); $query = "update " . TABLE_CONFIGURATION_GROUP . " set sort_order=" . $sid . " where configuration_group_id=" . $sid; vam_db_query($query); } } }
function ItemAttributsSetUp($current_product_id) { // I found the easiest way to do this is just delete the current attributes & start over =) // download function start $delete_sql = vam_db_query("SELECT products_attributes_id FROM " . TABLE_PRODUCTS_ATTRIBUTES . " WHERE products_id = '" . $current_product_id . "'"); while ($delete_res = vam_db_fetch_array($delete_sql)) { $delete_download_sql = vam_db_query("SELECT products_attributes_filename FROM " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD . " WHERE products_attributes_id = '" . $delete_res['prducts_attributes_id'] . "'"); $delete_download_file = vam_db_fetch_array($delete_download_sql); vam_db_query("DELETE FROM " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD . " WHERE products_attributes_id = '" . $delete_res['products_attributes_id'] . "'"); } // download function end vam_db_query("DELETE FROM " . TABLE_PRODUCTS_ATTRIBUTES . " WHERE products_id = '" . $current_product_id . "'"); // Simple, yet effective.. loop through the selected Option Values.. find the proper price & prefix.. insert.. yadda yadda yadda. for ($i = 0; $i < sizeof($_POST['optionValues']); $i++) { $query = "SELECT * FROM " . TABLE_PRODUCTS_OPTIONS_VALUES_TO_PRODUCTS_OPTIONS . " where products_options_values_id = '" . $_POST['optionValues'][$i] . "'"; $result = vam_db_query($query); $matches = vam_db_num_rows($result); while ($line = vam_db_fetch_array($result)) { $optionsID = $line['products_options_id']; } $cv_id = $_POST['optionValues'][$i]; $value_price = $_POST[$cv_id . '_price']; if (PRICE_IS_BRUTTO == 'true') { $value_price = $value_price / (vam_get_tax_rate(vam_get_tax_class_id($current_product_id)) + 100) * 100; } $value_price = vam_round($value_price, PRICE_PRECISION); $value_prefix = $_POST[$cv_id . '_prefix']; $value_sortorder = $_POST[$cv_id . '_sortorder']; $value_weight_prefix = $_POST[$cv_id . '_weight_prefix']; $value_model = $_POST[$cv_id . '_model']; $value_stock = $_POST[$cv_id . '_stock']; $value_weight = $_POST[$cv_id . '_weight']; vam_db_query("INSERT INTO " . TABLE_PRODUCTS_ATTRIBUTES . " (products_id, options_id, options_values_id, options_values_price, price_prefix ,attributes_model, attributes_stock, options_values_weight, weight_prefix,sortorder) VALUES ('" . $current_product_id . "', '" . $optionsID . "', '" . $_POST['optionValues'][$i] . "', '" . $value_price . "', '" . $value_prefix . "', '" . $value_model . "', '" . $value_stock . "', '" . $value_weight . "', '" . $value_weight_prefix . "','" . $value_sortorder . "')") or die(mysql_error()); $products_attributes_id = vam_db_insert_id(); if ($_POST[$cv_id . '_download_file'] != '') { if (DOWNLOAD_ENABLED == 'true') { $value_download_file = $_POST[$cv_id . '_download_file']; $value_download_expire = $_POST[$cv_id . '_download_expire']; $value_download_count = $_POST[$cv_id . '_download_count']; $value_is_pin = $_POST[$cv_id . '_ispin']; $products_attributes_is_pin = isset($value_is_pin) ? 1 : 0; vam_db_query("INSERT INTO " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD . " (products_attributes_id, products_attributes_filename, products_attributes_maxdays, products_attributes_maxcount, products_attributes_is_pin) VALUES ('" . $products_attributes_id . "', '" . $value_download_file . "', '" . $value_download_expire . "', '" . $value_download_count . "', '" . $products_attributes_is_pin . "')") or die(mysql_error()); } } } }
$messageStack->add(ERROR_BANNER_GROUP_REQUIRED, 'error'); $banner_error = true; } if (empty($html_text)) { if (!($banners_image =& vam_try_upload('banners_image', DIR_FS_CATALOG_IMAGES . 'banner/' . $banners_image_target)) && $_POST['banners_image_local'] == '') { $banner_error = true; } } if (!$banner_error) { $db_image_location = vam_not_null($banners_image_local) ? $banners_image_local : $banners_image_target . $banners_image->filename; $sql_data_array = array('banners_title' => $banners_title, 'banners_url' => $banners_url, 'banners_image' => $db_image_location, 'banners_group' => $banners_group, 'banners_html_text' => $html_text); if ($_GET['action'] == 'insert') { $insert_sql_data = array('date_added' => 'now()', 'status' => '1'); $sql_data_array = vam_array_merge($sql_data_array, $insert_sql_data); vam_db_perform(TABLE_BANNERS, $sql_data_array); $banners_id = vam_db_insert_id(); $messageStack->add_session(SUCCESS_BANNER_INSERTED, 'success'); } elseif ($_GET['action'] == 'update') { vam_db_perform(TABLE_BANNERS, $sql_data_array, 'update', 'banners_id = \'' . $banners_id . '\''); $messageStack->add_session(SUCCESS_BANNER_UPDATED, 'success'); } if ($_POST['expires_date']) { $expires_date = vam_db_prepare_input($_POST['expires_date']); list($day, $month, $year) = explode('/', $expires_date); $expires_date = $year . (strlen($month) == 1 ? '0' . $month : $month) . (strlen($day) == 1 ? '0' . $day : $day); vam_db_query("update " . TABLE_BANNERS . " set expires_date = '" . vam_db_input($expires_date) . "', expires_impressions = null where banners_id = '" . $banners_id . "'"); } elseif ($_POST['impressions']) { $impressions = vam_db_prepare_input($_POST['impressions']); vam_db_query("update " . TABLE_BANNERS . " set expires_impressions = '" . vam_db_input($impressions) . "', expires_date = null where banners_id = '" . $banners_id . "'"); } if ($_POST['date_scheduled']) {
switch ($_GET['action']) { case 'insert': case 'save': $currency_id = vam_db_prepare_input($_GET['cID']); $title = vam_db_prepare_input($_POST['title']); $code = vam_db_prepare_input($_POST['code']); $symbol_left = vam_db_prepare_input($_POST['symbol_left']); $symbol_right = vam_db_prepare_input($_POST['symbol_right']); $decimal_point = vam_db_prepare_input($_POST['decimal_point']); $thousands_point = vam_db_prepare_input($_POST['thousands_point']); $decimal_places = vam_db_prepare_input($_POST['decimal_places']); $value = vam_db_prepare_input($_POST['value']); $sql_data_array = array('title' => $title, 'code' => $code, 'symbol_left' => $symbol_left, 'symbol_right' => $symbol_right, 'decimal_point' => $decimal_point, 'thousands_point' => $thousands_point, 'decimal_places' => $decimal_places, 'value' => $value); if ($_GET['action'] == 'insert') { vam_db_perform(TABLE_CURRENCIES, $sql_data_array); $currency_id = vam_db_insert_id(); } elseif ($_GET['action'] == 'save') { vam_db_perform(TABLE_CURRENCIES, $sql_data_array, 'update', "currencies_id = '" . vam_db_input($currency_id) . "'"); } if ($_POST['default'] == 'on') { vam_db_query("update " . TABLE_CONFIGURATION . " set configuration_value = '" . vam_db_input($code) . "' where configuration_key = 'DEFAULT_CURRENCY'"); } vam_redirect(vam_href_link(FILENAME_CURRENCIES, 'page=' . $_GET['page'] . '&cID=' . $currency_id)); break; case 'deleteconfirm': $currencies_id = vam_db_prepare_input($_GET['cID']); $currency_query = vam_db_query("select currencies_id from " . TABLE_CURRENCIES . " where code = '" . DEFAULT_CURRENCY . "'"); $currency = vam_db_fetch_array($currency_query); if ($currency['currencies_id'] == $currencies_id) { vam_db_query("update " . TABLE_CONFIGURATION . " set configuration_value = '' where configuration_key = 'DEFAULT_CURRENCY'"); }
$price_result = vam_db_query('SELECT customers_group_price FROM products_groups WHERE products_id="' . $add_product_products_id . '" AND customers_group_id="' . $cust_group_id . '"'); $price_array = vam_db_fetch_array($price_result); if ($price_array) { // set the price of the new product to the group specific price. $product['products_price'] = $price_array['customers_group_price']; } } } } //end sppc patch $sql_data_array = array('orders_id' => vam_db_prepare_input($oID), 'products_id' => vam_db_prepare_input($add_product_products_id), 'products_model' => vam_db_prepare_input($product['products_model']), 'products_name' => vam_db_prepare_input($product['products_name']), 'products_price' => vam_db_prepare_input($product['products_price']) + $AddedOptionsPrice, 'final_price' => $product['products_price'] * $_POST['add_product_quantity'], 'products_tax' => vam_db_prepare_input($products_tax), 'products_quantity' => vam_db_prepare_input($_POST['add_product_quantity']), 'allow_tax' => '0'); vam_db_perform(TABLE_ORDERS_PRODUCTS, $sql_data_array); $new_product_id = vam_db_insert_id(); if (isset($_POST['add_product_options'])) { foreach ($_POST['add_product_options'] as $option_id => $option_value_id) { $sql_data_array = array('orders_id' => vam_db_prepare_input($oID), 'orders_products_id' => vam_db_prepare_input($new_product_id), 'products_options' => vam_db_prepare_input($option_names[$option_id]), 'products_options_values' => vam_db_prepare_input($option_values_names[$option_value_id]), 'options_values_price' => vam_db_prepare_input($option_value_details[$option_id][$option_value_id]['options_values_price']), 'price_prefix' => vam_db_prepare_input($option_value_details[$option_id][$option_value_id]['price_prefix'])); vam_db_perform(TABLE_ORDERS_PRODUCTS_ATTRIBUTES, $sql_data_array); //add on for downloads if (DOWNLOAD_ENABLED == 'true' && isset($filename[$option_id])) { $Query = "INSERT INTO " . TABLE_ORDERS_PRODUCTS_DOWNLOAD . " SET\n\t\t\t\torders_id = '" . vam_db_prepare_input($oID) . "',\n\t\t\t\torders_products_id = '" . vam_db_prepare_input($new_product_id) . "',\n\t\t\t\torders_products_filename = '" . vam_db_prepare_input($filename[$option_id]) . "',\n\t\t\t\tdownload_maxdays = '" . vam_db_prepare_input($maxdays[$option_id]) . "',\n\t download_count = '" . vam_db_prepare_input($maxcount[$option_id]) . "'"; vam_db_query($Query); } //end if (DOWNLOAD_ENABLED == 'true') { //end downloads } } // Update inventory Quantity // This is only done if store is set up to use stock
require 'includes/application_top.php'; $action = isset($_GET['action']) ? $_GET['action'] : ''; if (vam_not_null($action)) { switch ($action) { case 'insert': case 'save': if (isset($_GET['auID'])) { $authors_id = vam_db_prepare_input($_GET['auID']); } $authors_name = vam_db_prepare_input($_POST['authors_name']); $sql_data_array = array('authors_name' => $authors_name); if ($action == 'insert') { $insert_sql_data = array('date_added' => 'now()'); $sql_data_array = array_merge($sql_data_array, $insert_sql_data); vam_db_perform(TABLE_AUTHORS, $sql_data_array); $authors_id = vam_db_insert_id(); } elseif ($action == 'save') { $update_sql_data = array('last_modified' => 'now()'); $sql_data_array = array_merge($sql_data_array, $update_sql_data); vam_db_perform(TABLE_AUTHORS, $sql_data_array, 'update', "authors_id = '" . (int) $authors_id . "'"); } $languages = vam_get_languages(); for ($i = 0, $n = sizeof($languages); $i < $n; $i++) { $authors_desc_array = $_POST['authors_description']; $authors_url_array = $_POST['authors_url']; $language_id = $languages[$i]['id']; $sql_data_array = array('authors_description' => vam_db_prepare_input($authors_desc_array[$language_id]), 'authors_url' => vam_db_prepare_input($authors_url_array[$language_id])); if ($action == 'insert') { $insert_sql_data = array('authors_id' => $authors_id, 'languages_id' => $language_id); $sql_data_array = array_merge($sql_data_array, $insert_sql_data); vam_db_perform(TABLE_AUTHORS_INFO, $sql_data_array);
//insert a new news article. if ($_POST['headline']) { if ($_POST['news_page_url'] == '' && file_exists(DIR_FS_CATALOG . '.htaccess') && AUTOMATIC_SEO_URL == 'true') { $alias = $_POST['headline']; $alias = make_alias($alias); $news_page_url = $alias; } else { $news_page_url = $_POST['news_page_url']; } $sql_data_array = array('headline' => vam_db_prepare_input($_POST['headline']), 'news_page_url' => vam_db_prepare_input($news_page_url), 'content' => vam_db_prepare_input($_POST['content']), 'date_added' => 'now()', 'language' => vam_db_prepare_input($_POST['item_language']), 'status' => '1'); if ($_FILES['articles_image']['error'] == 0) { $articles_image = upload_file($_FILES, $_SERVER['DOCUMENT_ROOT'] . '/images/news/', 'articles_image'); $sql_data_array['articles_image'] = vam_db_prepare_input($articles_image); } vam_db_perform(TABLE_LATEST_NEWS, $sql_data_array); $news_id = vam_db_insert_id(); //not actually used ATM -- just there in case } // vam_redirect(vam_href_link(FILENAME_LATEST_NEWS)); break; case 'update_latest_news': //user wants to modify a news article. if ($_GET['news_id']) { $sql_data_array = array('headline' => vam_db_prepare_input($_POST['headline']), 'news_page_url' => vam_db_prepare_input($_POST['news_page_url']), 'content' => vam_db_prepare_input($_POST['content']), 'date_added' => vam_db_prepare_input($_POST['date_added']), 'language' => vam_db_prepare_input($_POST['item_language'])); if ($_FILES['articles_image']['error'] == 0) { $articles_image = upload_file($_FILES, $_SERVER['DOCUMENT_ROOT'] . '/images/news/', 'articles_image'); $sql_data_array['articles_image'] = vam_db_prepare_input($articles_image); } vam_db_perform(TABLE_LATEST_NEWS, $sql_data_array, 'update', "news_id = '" . vam_db_prepare_input($_GET['news_id']) . "'"); } // vam_redirect(vam_href_link(FILENAME_LATEST_NEWS));
http://www.mainframes.co.uk Released under the GNU General Public License ------------------------------------------------------------------------------*/ require 'includes/application_top.php'; switch ($_GET['action']) { case 'insert': case 'save': $blacklist_id = vam_db_prepare_input($_GET['bID']); $blacklist_card_number = vam_db_prepare_input($_POST['blacklist_card_number']); $sql_data_array = array('blacklist_card_number' => $blacklist_card_number); if ($_GET['action'] == 'insert') { $insert_sql_data = array('date_added' => 'now()'); $sql_data_array = vam_array_merge($sql_data_array, $insert_sql_data); vam_db_perform(TABLE_BLACKLIST, $sql_data_array); $blacklist_id = vam_db_insert_id(); } elseif ($_GET['action'] == 'save') { $update_sql_data = array('last_modified' => 'now()'); $sql_data_array = vam_array_merge($sql_data_array, $update_sql_data); vam_db_perform(TABLE_BLACKLIST, $sql_data_array, 'update', "blacklist_id = '" . vam_db_input($blacklist_id) . "'"); } if (USE_CACHE == 'true') { vam_reset_cache_block('blacklist'); } vam_redirect(vam_href_link(FILENAME_BLACKLIST, 'page=' . $_GET['page'] . '&bID=' . $blacklist_id)); break; case 'deleteconfirm': $blacklist_id = vam_db_prepare_input($_GET['bID']); vam_db_query("delete from " . TABLE_BLACKLIST . " where blacklist_id = '" . vam_db_input($blacklist_id) . "'"); if (USE_CACHE == 'true') { vam_reset_cache_block('manufacturers');
$page_info = 'option_page=' . $_GET['option_page'] . '&value_page=' . $_GET['value_page'] . '&attribute_page=' . $_GET['attribute_page']; switch ($_GET['action']) { case 'add_product_options': for ($i = 0, $n = sizeof($languages); $i < $n; $i++) { $option_name = $_POST['option_name']; $option_rows = (int) $_POST['option_rows']; $option_size = (int) $_POST['option_size']; $option_length = (int) $_POST['option_length']; $option_type = (int) $_POST['options_type']; vam_db_query("insert into " . TABLE_PRODUCTS_OPTIONS . " (products_options_id,products_options_name, language_id,products_options_type,products_options_length,products_options_rows,products_options_size) values ('" . $_POST['products_options_id'] . "', '" . $option_name[$languages[$i]['id']] . "', '" . $languages[$i]['id'] . "','" . $option_type . "','" . $option_length . "','" . $option_rows . "','" . $option_size . "')"); } vam_redirect(vam_href_link(FILENAME_PRODUCTS_OPTIONS, $page_info)); break; case 'add_product_attributes': vam_db_query("insert into " . TABLE_PRODUCTS_ATTRIBUTES . " values ('', '" . $_POST['products_id'] . "', '" . $_POST['options_id'] . "', '" . $_POST['values_id'] . "', '" . $_POST['value_price'] . "', '" . $_POST['price_prefix'] . "')"); $products_attributes_id = vam_db_insert_id(); if (DOWNLOAD_ENABLED == 'true' && $_POST['products_attributes_filename'] != '') { vam_db_query("insert into " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD . " values (" . $products_attributes_id . ", '" . $_POST['products_attributes_filename'] . "', '" . $_POST['products_attributes_maxdays'] . "', '" . $_POST['products_attributes_maxcount'] . "')"); } vam_redirect(vam_href_link(FILENAME_PRODUCTS_OPTIONS, $page_info)); break; case 'update_option_name': for ($i = 0, $n = sizeof($languages); $i < $n; $i++) { $option_name = $_POST['option_name']; $id = (int) $_POST['option_id']; $option_rows = (int) $_POST['option_rows']; $option_size = (int) $_POST['option_size']; $option_length = (int) $_POST['option_length']; $option_type = (int) $_POST['options_type']; vam_db_query("update " . TABLE_PRODUCTS_OPTIONS . " set products_options_name = '" . $option_name[$languages[$i]['id']] . "' where products_options_id = '" . $id . "' and language_id = '" . $languages[$i]['id'] . "'"); // update fields
switch ($action) { case 'insert': case 'save': if (isset($_GET['fID'])) { $fields_id = vam_db_prepare_input($_GET['fID']); } //$fields_name = vam_db_prepare_input($_POST['fields_name']); $fields_input_type = vam_db_prepare_input($_POST['fields_input_type']); $fields_input_value = vam_db_prepare_input($_POST['fields_input_value']); $fields_required_status = vam_db_prepare_input($_POST['fields_required_status']); $fields_size = vam_db_prepare_input($_POST['fields_size']); $fields_required_email = vam_db_prepare_input($_POST['fields_required_email']); $sql_data_array = array('fields_status' => 1, 'fields_input_type' => $fields_input_type, 'fields_input_value' => $fields_input_value, 'fields_required_status' => $fields_required_status, 'fields_size' => $fields_size, 'fields_required_email' => $fields_required_email); if ($action == 'insert') { vam_db_perform(TABLE_EXTRA_FIELDS, $sql_data_array); $fields_id = vam_db_insert_id(); } elseif ($action == 'save') { vam_db_perform(TABLE_EXTRA_FIELDS, $sql_data_array, 'update', "fields_id = '" . (int) $fields_id . "'"); } $languages = vam_get_languages(); for ($i = 0, $n = sizeof($languages); $i < $n; $i++) { $fields_name_array = $_POST['fields_name']; $language_id = $languages[$i]['id']; $sql_data_array = array('fields_name' => vam_db_prepare_input($fields_name_array[$language_id])); if ($action == 'insert') { $insert_sql_data = array('fields_id' => $fields_id, 'languages_id' => $language_id); $sql_data_array = array_merge($sql_data_array, $insert_sql_data); vam_db_perform(TABLE_EXTRA_FIELDS_INFO, $sql_data_array); } elseif ($action == 'save') { vam_db_perform(TABLE_EXTRA_FIELDS_INFO, $sql_data_array, 'update', "fields_id = '" . (int) $fields_id . "' and languages_id = '" . (int) $language_id . "'"); }
$topics_id = vam_db_prepare_input($_POST['topics_id']); if ($_POST['copy_as'] == 'link') { if ($topics_id != $current_topic_id) { $check_query = vam_db_query("select count(*) as total from " . TABLE_ARTICLES_TO_TOPICS . " where articles_id = '" . (int) $articles_id . "' and topics_id = '" . (int) $topics_id . "'"); $check = vam_db_fetch_array($check_query); if ($check['total'] < '1') { vam_db_query("insert into " . TABLE_ARTICLES_TO_TOPICS . " (articles_id, topics_id) values ('" . (int) $articles_id . "', '" . (int) $topics_id . "')"); } } else { $messageStack->add_session(ERROR_CANNOT_LINK_TO_SAME_TOPIC, 'error'); } } elseif ($_POST['copy_as'] == 'duplicate') { $article_query = vam_db_query("select articles_date_available, authors_id, articles_page_url, sort_order, articles_image from " . TABLE_ARTICLES . " where articles_id = '" . (int) $articles_id . "'"); $article = vam_db_fetch_array($article_query); vam_db_query("insert into " . TABLE_ARTICLES . " (articles_date_added, articles_date_available, articles_status, authors_id, articles_page_url, sort_order) values (now(), '" . vam_db_input($article['articles_date_available']) . "', '0', '" . (int) $article['authors_id'] . "', '" . (int) $article['articles_page_url'] . "', '" . (int) $article['sort_order'] . "')"); $dup_articles_id = vam_db_insert_id(); $description_query = vam_db_query("select language_id, articles_name, articles_description, articles_url, articles_head_title_tag, articles_head_desc_tag, articles_head_keywords_tag from " . TABLE_ARTICLES_DESCRIPTION . " where articles_id = '" . (int) $articles_id . "'"); while ($description = vam_db_fetch_array($description_query)) { vam_db_query("insert into " . TABLE_ARTICLES_DESCRIPTION . " (articles_id, language_id, articles_name, articles_description, articles_url, articles_head_title_tag, articles_head_desc_tag, articles_head_keywords_tag, articles_viewed) values ('" . (int) $dup_articles_id . "', '" . (int) $description['language_id'] . "', '" . vam_db_input($description['articles_name']) . "', '" . vam_db_input($description['articles_description']) . "', '" . vam_db_input($description['articles_url']) . "', '" . vam_db_input($description['articles_head_title_tag']) . "', '" . vam_db_input($description['articles_head_desc_tag']) . "', '" . vam_db_input($description['articles_head_keywords_tag']) . "', '0')"); } vam_db_query("insert into " . TABLE_ARTICLES_TO_TOPICS . " (articles_id, topics_id) values ('" . (int) $dup_articles_id . "', '" . (int) $topics_id . "')"); $articles_id = $dup_articles_id; } if (USE_CACHE == 'true') { vam_reset_cache_block('topics'); } } vam_redirect(vam_href_link(FILENAME_ARTICLES, 'tPath=' . $topics_id . '&aID=' . $articles_id)); break; } }
vam_db_query("update " . TABLE_SPECIFICATIONS_VALUES . " \n set specifications_id = '" . $move_to_value_id . "'\n where specification_values_id = '" . $specification_values_id . "'\n "); } vam_redirect(vam_href_link(FILENAME_PRODUCTS_SPECIFICATIONS, 'sgpath=' . $specs_group_path . '&spath=' . $move_to_value_id . '&value=1&vid=' . $specification_values_id)); break; // Copy a Specification Value // Copy a Specification Value case 'copy_value_confirm': if (isset($_POST['specification_values_id']) && $_POST['specification_values_id'] != 0 && $_POST['copy_to_value_id'] != 0) { $specification_values_id = (int) $_POST['specification_values_id']; $copy_to_value_id = (int) $_POST['copy_to_value_id']; $filter_query_raw = "select value_sort_order\n from " . TABLE_SPECIFICATIONS_VALUES . " \n where specification_values_id = '" . $specification_values_id . "'\n "; $filter_query = vam_db_query($filter_query_raw); $filter_array = vam_db_fetch_array($filter_query); $sql_data_array = array('specifications_id' => $copy_to_value_id, 'value_sort_order' => $filter_array['value_sort_order']); vam_db_perform(TABLE_SPECIFICATIONS_VALUES, $sql_data_array); $new_specification_values_id = vam_db_insert_id(); for ($i = 0, $n = sizeof($languages); $i < $n; $i++) { $language_id = (int) $languages[$i]['id']; $filter_query_raw = "select specification_value,\n value_sort_order\n from " . TABLE_SPECIFICATIONS_VALUES_DESCRIPTION . " \n where specification_values_id = '" . $specification_values_id . "'\n "; $filter_query = vam_db_query($filter_query_raw); $filter_array = vam_db_fetch_array($filter_query); $sql_data_array = array('specification_values_id' => $new_specification_values_id, 'language_id' => $language_id, 'specification_value' => $filter_array['specification_value']); vam_db_perform(TABLE_SPECIFICATIONS_VALUES_DESCRIPTION, $sql_data_array); } } // if (isset ($_POST['specification_values_id'] vam_redirect(vam_href_link(FILENAME_PRODUCTS_SPECIFICATIONS, 'sgpath=' . $specs_group_path . '&spath=' . $copy_to_value_id . '&value=1&vid=' . $new_specification_values_id)); break; // Delete a Specification Value // Delete a Specification Value case 'delete_value_confirm':
function confirmation() { global $cartID, $customer_id, $languages_id, $order, $order_total_modules; if (isset($_SESSION['cartID'])) { $insert_order = false; if (isset($_SESSION['cart_qiwi_id'])) { $order_id = substr($_SESSION['cart_qiwi_id'], strpos($_SESSION['cart_qiwi_id'], '-') + 1); $curr_check = vam_db_query("select currency from " . TABLE_ORDERS . " where orders_id = '" . (int) $order_id . "'"); $curr = vam_db_fetch_array($curr_check); if ($curr['currency'] != $order->info['currency'] || $cartID != substr($_SESSION['cart_qiwi_id'], 0, strlen($cartID))) { $check_query = vam_db_query('select orders_id from ' . TABLE_ORDERS_STATUS_HISTORY . ' where orders_id = "' . (int) $order_id . '" limit 1'); if (vam_db_num_rows($check_query) < 1) { vam_db_query('delete from ' . TABLE_ORDERS . ' where orders_id = "' . (int) $order_id . '"'); vam_db_query('delete from ' . TABLE_ORDERS_TOTAL . ' where orders_id = "' . (int) $order_id . '"'); vam_db_query('delete from ' . TABLE_ORDERS_STATUS_HISTORY . ' where orders_id = "' . (int) $order_id . '"'); vam_db_query('delete from ' . TABLE_ORDERS_PRODUCTS . ' where orders_id = "' . (int) $order_id . '"'); vam_db_query('delete from ' . TABLE_ORDERS_PRODUCTS_ATTRIBUTES . ' where orders_id = "' . (int) $order_id . '"'); vam_db_query('delete from ' . TABLE_ORDERS_PRODUCTS_DOWNLOAD . ' where orders_id = "' . (int) $order_id . '"'); } $insert_order = true; } } else { $insert_order = true; } if ($insert_order == true) { $order_totals = array(); if (is_array($order_total_modules->modules)) { reset($order_total_modules->modules); while (list(, $value) = each($order_total_modules->modules)) { $class = substr($value, 0, strrpos($value, '.')); if ($GLOBALS[$class]->enabled) { for ($i = 0, $n = sizeof($GLOBALS[$class]->output); $i < $n; $i++) { if (vam_not_null($GLOBALS[$class]->output[$i]['title']) && vam_not_null($GLOBALS[$class]->output[$i]['text'])) { $order_totals[] = array('code' => $GLOBALS[$class]->code, 'title' => $GLOBALS[$class]->output[$i]['title'], 'text' => $GLOBALS[$class]->output[$i]['text'], 'value' => $GLOBALS[$class]->output[$i]['value'], 'sort_order' => $GLOBALS[$class]->sort_order); } } } } } if ($_SESSION['customers_status']['customers_status_ot_discount_flag'] == 1) { $discount = $_SESSION['customers_status']['customers_status_ot_discount']; } else { $discount = '0.00'; } if ($_SERVER["HTTP_X_FORWARDED_FOR"]) { $customers_ip = $_SERVER["HTTP_X_FORWARDED_FOR"]; } else { $customers_ip = $_SERVER["REMOTE_ADDR"]; } $sql_data_array = array('customers_id' => $_SESSION['customer_id'], 'customers_name' => $order->customer['firstname'] . ' ' . $order->customer['lastname'], 'customers_cid' => $order->customer['csID'], 'customers_vat_id' => $_SESSION['customer_vat_id'], 'customers_company' => $order->customer['company'], 'customers_status' => $_SESSION['customers_status']['customers_status_id'], 'customers_status_name' => $_SESSION['customers_status']['customers_status_name'], 'customers_status_image' => $_SESSION['customers_status']['customers_status_image'], 'customers_status_discount' => $discount, 'customers_street_address' => $order->customer['street_address'], 'customers_suburb' => $order->customer['suburb'], 'customers_city' => $order->customer['city'], 'customers_postcode' => $order->customer['postcode'], 'customers_state' => $order->customer['state'], 'customers_country' => $order->customer['country']['title'], 'customers_telephone' => $order->customer['telephone'], 'customers_email_address' => $order->customer['email_address'], 'customers_address_format_id' => $order->customer['format_id'], 'delivery_name' => $order->delivery['firstname'] . ' ' . $order->delivery['lastname'], 'delivery_company' => $order->delivery['company'], 'delivery_street_address' => $order->delivery['street_address'], 'delivery_suburb' => $order->delivery['suburb'], 'delivery_city' => $order->delivery['city'], 'delivery_postcode' => $order->delivery['postcode'], 'delivery_state' => $order->delivery['state'], 'delivery_country' => $order->delivery['country']['title'], 'delivery_address_format_id' => $order->delivery['format_id'], 'billing_name' => $order->billing['firstname'] . ' ' . $order->billing['lastname'], 'billing_company' => $order->billing['company'], 'billing_street_address' => $order->billing['street_address'], 'billing_suburb' => $order->billing['suburb'], 'billing_city' => $order->billing['city'], 'billing_postcode' => $order->billing['postcode'], 'billing_state' => $order->billing['state'], 'billing_country' => $order->billing['country']['title'], 'billing_address_format_id' => $order->billing['format_id'], 'payment_method' => $order->info['payment_method'], 'payment_class' => $order->info['payment_class'], 'shipping_method' => $order->info['shipping_method'], 'shipping_class' => $order->info['shipping_class'], 'language' => $_SESSION['language'], 'comments' => $order->info['comments'], 'customers_ip' => $customers_ip, 'orig_reference' => $order->customer['orig_reference'], 'login_reference' => $order->customer['login_reference'], 'cc_type' => $order->info['cc_type'], 'cc_owner' => $order->info['cc_owner'], 'cc_number' => $order->info['cc_number'], 'cc_expires' => $order->info['cc_expires'], 'date_purchased' => 'now()', 'orders_status' => $order->info['order_status'], 'currency' => $order->info['currency'], 'currency_value' => $order->info['currency_value']); vam_db_perform(TABLE_ORDERS, $sql_data_array); $insert_id = vam_db_insert_id(); $customer_notification = SEND_EMAILS == 'true' ? '1' : '0'; $sql_data_array = array('orders_id' => $insert_id, 'orders_status_id' => $order->info['order_status'], 'date_added' => 'now()', 'customer_notified' => $customer_notification, 'comments' => $order->info['comments']); vam_db_perform(TABLE_ORDERS_STATUS_HISTORY, $sql_data_array); for ($i = 0, $n = sizeof($order_totals); $i < $n; $i++) { $sql_data_array = array('orders_id' => $insert_id, 'title' => $order_totals[$i]['title'], 'text' => $order_totals[$i]['text'], 'value' => $order_totals[$i]['value'], 'class' => $order_totals[$i]['code'], 'sort_order' => $order_totals[$i]['sort_order']); vam_db_perform(TABLE_ORDERS_TOTAL, $sql_data_array); } for ($i = 0, $n = sizeof($order->products); $i < $n; $i++) { $sql_data_array = array('orders_id' => $insert_id, 'products_id' => vam_get_prid($order->products[$i]['id']), 'products_model' => $order->products[$i]['model'], 'products_name' => $order->products[$i]['name'], 'products_price' => $order->products[$i]['price'], 'final_price' => $order->products[$i]['final_price'], 'products_tax' => $order->products[$i]['tax'], 'products_quantity' => $order->products[$i]['qty']); vam_db_perform(TABLE_ORDERS_PRODUCTS, $sql_data_array); $order_products_id = vam_db_insert_id(); $attributes_exist = '0'; if (isset($order->products[$i]['attributes'])) { $attributes_exist = '1'; for ($j = 0, $n2 = sizeof($order->products[$i]['attributes']); $j < $n2; $j++) { if (DOWNLOAD_ENABLED == 'true') { $attributes_query = "select popt.products_options_name, poval.products_options_values_name, pa.options_values_price, pa.price_prefix, pad.products_attributes_maxdays, pad.products_attributes_maxcount , pad.products_attributes_filename, pad.products_attributes_is_pin\n from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_OPTIONS_VALUES . " poval, " . TABLE_PRODUCTS_ATTRIBUTES . " pa\n left join " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD . " pad\n on pa.products_attributes_id=pad.products_attributes_id\n where pa.products_id = '" . $order->products[$i]['id'] . "'\n and pa.options_id = '" . $order->products[$i]['attributes'][$j]['option_id'] . "'\n and pa.options_id = popt.products_options_id\n and pa.options_values_id = '" . $order->products[$i]['attributes'][$j]['value_id'] . "'\n and pa.options_values_id = poval.products_options_values_id\n and popt.language_id = '" . $_SESSION['languages_id'] . "'\n and poval.language_id = '" . $_SESSION['languages_id'] . "'"; $attributes = vam_db_query($attributes_query); } else { $attributes = vam_db_query("select popt.products_options_name, poval.products_options_values_name, pa.options_values_price, pa.price_prefix from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_OPTIONS_VALUES . " poval, " . TABLE_PRODUCTS_ATTRIBUTES . " pa where pa.products_id = '" . $order->products[$i]['id'] . "' and pa.options_id = '" . $order->products[$i]['attributes'][$j]['option_id'] . "' and pa.options_id = popt.products_options_id and pa.options_values_id = '" . $order->products[$i]['attributes'][$j]['value_id'] . "' and pa.options_values_id = poval.products_options_values_id and popt.language_id = '" . $_SESSION['languages_id'] . "' and poval.language_id = '" . $_SESSION['languages_id'] . "'"); } // update attribute stock vam_db_query("UPDATE " . TABLE_PRODUCTS_ATTRIBUTES . " set\n\t\t\t\t\t\t attributes_stock=attributes_stock - '" . $order->products[$i]['qty'] . "'\n\t\t\t\t\t\t where\n\t\t\t\t\t\t products_id='" . $order->products[$i]['id'] . "'\n\t\t\t\t\t\t and options_values_id='" . $order->products[$i]['attributes'][$j]['value_id'] . "'\n\t\t\t\t\t\t and options_id='" . $order->products[$i]['attributes'][$j]['option_id'] . "'\n\t\t\t\t\t\t "); $attributes_values = vam_db_fetch_array($attributes); $sql_data_array = array('orders_id' => $insert_id, 'orders_products_id' => $order_products_id, 'products_options' => $attributes_values['products_options_name'], 'products_options_values' => $attributes_values['products_options_values_name'], 'options_values_price' => $attributes_values['options_values_price'], 'price_prefix' => $attributes_values['price_prefix']); vam_db_perform(TABLE_ORDERS_PRODUCTS_ATTRIBUTES, $sql_data_array); if (DOWNLOAD_ENABLED == 'true' && (isset($attributes_values['products_attributes_filename']) && vam_not_null($attributes_values['products_attributes_filename']) or $attributes_values['products_attributes_is_pin'])) { //PIN add for ($pincycle = 0; $pincycle < $order->products[$i]['qty']; $pincycle++) { if ($attributes_values['products_attributes_is_pin']) { $pin_query = vam_db_query("SELECT products_pin_id, products_pin_code FROM " . TABLE_PRODUCTS_PINS . " WHERE products_id = '" . $order->products[$i]['id'] . "' AND products_pin_used='0' LIMIT 1"); if (vam_db_num_rows($pin_query) == '0') { // We have no PIN for this product // insert some error notifying here $pin = PIN_NOT_AVAILABLE; } else { $pin_res = vam_db_fetch_array($pin_query); $pin = $pin_res['products_pin_code']; vam_db_query("UPDATE " . TABLE_PRODUCTS_PINS . " SET products_pin_used='" . $insert_id . "' WHERE products_pin_id = '" . $pin_res['products_pin_id'] . "'"); } } //PIN $sql_data_array = array('orders_id' => $insert_id, 'orders_products_id' => $order_products_id, 'orders_products_filename' => $attributes_values['products_attributes_filename'], 'download_maxdays' => $attributes_values['products_attributes_maxdays'], 'download_count' => $attributes_values['products_attributes_maxcount'], 'download_is_pin' => $attributes_values['products_attributes_is_pin'], 'download_pin_code' => $pin); vam_db_perform(TABLE_ORDERS_PRODUCTS_DOWNLOAD, $sql_data_array); } } } } } $_SESSION['cart_qiwi_id'] = $cartID . '-' . $insert_id; } // Выписываем qiwi счёт для покупателя if ($insert_order == true) { require_once DIR_WS_CLASSES . 'nusoap/nusoap.php'; $client = new nusoap_client("https://mobw.ru/services/ishop", false); // создаем клиента для отправки запроса на QIWI $error = $client->getError(); //if ( !empty($error) ) { // обрабатываем возможные ошибки и в случае их возникновения откатываем транзакцию в своей системе //echo -1; //exit(); //} $client->useHTTPPersistentConnection(); // Параметры для передачи данных о платеже: // login - Ваш ID в системе QIWI // password - Ваш пароль // user - Телефон покупателя (10 символов, например 916820XXXX) // amount - Сумма платежа в рублях // comment - Комментарий, который пользователь увидит в своем личном кабинете или платежном автомате // txn - Наш внутренний уникальный номер транзакции // lifetime - Время жизни платежа до его автоматической отмены // alarm - Оповещать ли клиента через СМС или звонком о выписанном счете // create - 0 - только для зарегистрированных пользователей QIWI, 1 - для всех $params = array('login' => MODULE_PAYMENT_QIWI_ID, 'password' => MODULE_PAYMENT_QIWI_SECRET_KEY, 'user' => $_SESSION['qiwi_telephone'] == '' ? $_POST['qiwi_telephone'] : $_SESSION['qiwi_telephone'], 'amount' => number_format($order->info['total'], 0, '', ''), 'comment' => substr($_SESSION['cart_qiwi_id'], strpos($_SESSION['cart_qiwi_id'], '-') + 1), 'txn' => substr($_SESSION['cart_qiwi_id'], strpos($_SESSION['cart_qiwi_id'], '-') + 1), 'lifetime' => date("d.m.Y H:i:s", strtotime("+2 weeks")), 'alarm' => 1, 'create' => 1); // собственно запрос: $result = $client->call('createBill', $params, "http://server.ishop.mw.ru/"); //if ($client->fault) { //echo -1; //exit(); //} else { //$err = $client->getError(); //if ($err) { //echo -1; //exit(); //} else { //echo $result; //exit(); //} //} vam_db_query("INSERT INTO " . TABLE_PERSONS . " (orders_id, name, address) VALUES ('" . vam_db_prepare_input((int) substr($_SESSION['cart_qiwi_id'], strpos($_SESSION['cart_qiwi_id'], '-') + 1)) . "', '" . vam_db_prepare_input($_SESSION['kvit_name']) . "', '" . vam_db_prepare_input($_SESSION['qiwi_telephone']) . "')"); } } return array('title' => MODULE_PAYMENT_QIWI_TEXT_DESCRIPTION); }
$manufacturer_query = vam_db_query("select manufacturers_description from " . TABLE_MANUFACTURERS_INFO . " where manufacturers_id = '" . (int) $manufacturer_id . "' and languages_id = '" . (int) $language_id . "'"); $manufacturer = vam_db_fetch_array($manufacturer_query); return $manufacturer['manufacturers_description']; } // EOF manufacturers meta tags switch ($_GET['action']) { case 'insert': case 'save': $manufacturers_id = vam_db_prepare_input($_GET['mID']); $manufacturers_name = vam_db_prepare_input($_POST['manufacturers_name']); $sql_data_array = array('manufacturers_name' => $manufacturers_name); if ($_GET['action'] == 'insert') { $insert_sql_data = array('date_added' => 'now()'); $sql_data_array = vam_array_merge($sql_data_array, $insert_sql_data); vam_db_perform(TABLE_MANUFACTURERS, $sql_data_array); $manufacturers_id = vam_db_insert_id(); } elseif ($_GET['action'] == 'save') { $update_sql_data = array('last_modified' => 'now()'); $sql_data_array = vam_array_merge($sql_data_array, $update_sql_data); vam_db_perform(TABLE_MANUFACTURERS, $sql_data_array, 'update', "manufacturers_id = '" . vam_db_input($manufacturers_id) . "'"); } $dir_manufacturers = DIR_FS_CATALOG_IMAGES . "/manufacturers"; if ($manufacturers_image =& vam_try_upload('manufacturers_image', $dir_manufacturers)) { vam_db_query("update " . TABLE_MANUFACTURERS . " set\r\n manufacturers_image ='manufacturers/" . $manufacturers_image->filename . "'\r\n where manufacturers_id = '" . vam_db_input($manufacturers_id) . "'"); } $languages = vam_get_languages(); for ($i = 0, $n = sizeof($languages); $i < $n; $i++) { $manufacturers_url_array = $_POST['manufacturers_url']; // BOF manufacturers descriptions + meta tags $manufacturers_meta_title_array = $_POST['manufacturers_meta_title']; $manufacturers_meta_keywords_array = $_POST['manufacturers_meta_keywords'];
$affiliate_banner_error = true; $_GET['action'] = 'new'; } else { $image_location = DIR_FS_CATALOG_IMAGES . $_FILES['affiliate_banners_image']['name']; move_uploaded_file($_FILES['affiliate_banners_image']['tmp_name'], $image_location); @chmod($image_location, 0644); $db_image_location = $_FILES['affiliate_banners_image']['name']; if (!$affiliate_products_id) { $affiliate_products_id = "0"; } $sql_data_array = array('affiliate_banners_title' => $affiliate_banners_title, 'affiliate_products_id' => $affiliate_products_id, 'affiliate_banners_image' => $db_image_location, 'affiliate_banners_group' => $affiliate_banners_group); if ($_GET['action'] == 'insert') { $insert_sql_data = array('affiliate_date_added' => 'now()', 'affiliate_status' => '1'); $sql_data_array = array_merge($sql_data_array, $insert_sql_data); vam_db_perform(TABLE_AFFILIATE_BANNERS, $sql_data_array); $affiliate_banners_id = vam_db_insert_id(); // Banner ID 1 is generic Product Banner if ($affiliate_banners_id == 1) { vam_db_query("update " . TABLE_AFFILIATE_BANNERS . " set affiliate_banners_id = affiliate_banners_id + 1"); } $messageStack->add_session(SUCCESS_BANNER_INSERTED, 'success'); } elseif ($_GET['action'] == 'update') { $insert_sql_data = array('affiliate_date_status_change' => 'now()'); $sql_data_array = array_merge($sql_data_array, $insert_sql_data); vam_db_perform(TABLE_AFFILIATE_BANNERS, $sql_data_array, 'update', 'affiliate_banners_id = \'' . $affiliate_banners_id . '\''); $messageStack->add_session(SUCCESS_BANNER_UPDATED, 'success'); } vam_redirect(vam_href_link(FILENAME_AFFILIATE_BANNER_MANAGER, 'page=' . $_GET['page'] . '&abID=' . $affiliate_banners_id)); } } break;
$sql_data_array['entry_company'] = $entry_company; } if (ACCOUNT_SUBURB == 'true') { $sql_data_array['entry_suburb'] = $entry_suburb; } if (ACCOUNT_STATE == 'true') { if ($zone_id > 0) { $sql_data_array['entry_zone_id'] = $entry_zone_id; $sql_data_array['entry_state'] = ''; } else { $sql_data_array['entry_zone_id'] = '0'; $sql_data_array['entry_state'] = $entry_state; } } vam_db_perform(TABLE_ADDRESS_BOOK, $sql_data_array); $address_id = vam_db_insert_id(); vam_db_query("update " . TABLE_CUSTOMERS . " set customers_default_address_id = '" . $address_id . "' where customers_id = '" . $cc_id . "'"); vam_db_query("insert into " . TABLE_CUSTOMERS_INFO . " (customers_info_id, customers_info_number_of_logons, customers_info_date_account_created) values ('" . $cc_id . "', '0', now())"); // Create insert into admin access table if admin is created. if ($customers_status_c == '0') { vam_db_query("INSERT into " . TABLE_ADMIN_ACCESS . " (customers_id,start) VALUES ('" . $cc_id . "','1')"); } // Create eMail if ($customers_send_mail == 'yes') { // assign language to template for caching $vamTemplate->assign('language', $_SESSION['language']); $vamTemplate->caching = false; $vamTemplate->assign('tpl_path', 'templates/' . CURRENT_TEMPLATE . '/'); $vamTemplate->assign('logo_path', HTTP_SERVER . DIR_WS_CATALOG . 'templates/' . CURRENT_TEMPLATE . '/img/'); $vamTemplate->assign('NAME', $customers_lastname . ' ' . $customers_firstname); $vamTemplate->assign('EMAIL', $customers_email_address);
$sql_data_array['entry_company'] = $company; } if (ACCOUNT_SUBURB == 'true') { $sql_data_array['entry_suburb'] = $suburb; } if (ACCOUNT_STATE == 'true') { if ($zone_id > 0) { $sql_data_array['entry_zone_id'] = $zone_id; $sql_data_array['entry_state'] = ''; } else { $sql_data_array['entry_zone_id'] = '0'; $sql_data_array['entry_state'] = $state; } } vam_db_perform(TABLE_ADDRESS_BOOK, $sql_data_array); $_SESSION['sendto'] = vam_db_insert_id(); vam_redirect(vam_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL')); } // process the selected shipping destination } elseif (isset($_POST['address'])) { $reset_shipping = false; if (isset($_SESSION['sendto'])) { if ($_SESSION['sendto'] != $_POST['address']) { if (isset($_SESSION['shipping'])) { $reset_shipping = true; } } } $_SESSION['sendto'] = $_POST['address']; $check_address_query = vam_db_query("select count(*) as total from " . TABLE_ADDRESS_BOOK . " where customers_id = '" . $_SESSION['customer_id'] . "' and address_book_id = '" . $_SESSION['sendto'] . "'"); $check_address = vam_db_fetch_array($check_address_query);
if (DOWNLOAD_ENABLED != 'true' || !$stock_values['products_attributes_filename'] || $stock_values['products_attributes_is_pin'] == 1) { $stock_left = $stock_values['products_quantity'] - $order->products[$i]['qty']; } else { $stock_left = $stock_values['products_quantity']; } vam_db_query("update " . TABLE_PRODUCTS . " set products_quantity = '" . $stock_left . "' where products_id = '" . vam_get_prid($order->products[$i]['id']) . "'"); if ($stock_left < 1 && STOCK_ALLOW_CHECKOUT == 'false') { vam_db_query("update " . TABLE_PRODUCTS . " set products_status = '0' where products_id = '" . vam_get_prid($order->products[$i]['id']) . "'"); } } } // Update products_ordered (for bestsellers list) vam_db_query("update " . TABLE_PRODUCTS . " set products_ordered = products_ordered + " . sprintf('%d', $order->products[$i]['qty']) . " where products_id = '" . vam_get_prid($order->products[$i]['id']) . "'"); $sql_data_array = array('orders_id' => $insert_id, 'products_id' => vam_get_prid($order->products[$i]['id']), 'products_model' => $order->products[$i]['model'], 'products_name' => $order->products[$i]['name'], 'products_shipping_time' => $order->products[$i]['shipping_time'], 'products_price' => $order->products[$i]['price'], 'final_price' => $order->products[$i]['final_price'], 'products_tax' => $order->products[$i]['tax'], 'products_discount_made' => $order->products[$i]['discount_allowed'], 'products_quantity' => $order->products[$i]['qty'], 'allow_tax' => $_SESSION['customers_status']['customers_status_show_price_tax']); vam_db_perform(TABLE_ORDERS_PRODUCTS, $sql_data_array); $order_products_id = vam_db_insert_id(); // Aenderung Specials Quantity Anfang $specials_result = vam_db_query("SELECT products_id, specials_quantity from " . TABLE_SPECIALS . " WHERE products_id = '" . vam_get_prid($order->products[$i]['id']) . "' "); if (vam_db_num_rows($specials_result)) { $spq = vam_db_fetch_array($specials_result); $new_sp_quantity = $spq['specials_quantity'] - $order->products[$i]['qty']; if ($new_sp_quantity >= 1) { vam_db_query("update " . TABLE_SPECIALS . " set specials_quantity = '" . $new_sp_quantity . "' where products_id = '" . vam_get_prid($order->products[$i]['id']) . "' "); } else { vam_db_query("update " . TABLE_SPECIALS . " set status = '0', specials_quantity = '" . $new_sp_quantity . "' where products_id = '" . vam_get_prid($order->products[$i]['id']) . "' "); } } // Aenderung Ende $order_total_modules->update_credit_account($i); // GV Code ICW ADDED FOR CREDIT CLASS SYSTEM //------insert customer choosen option to order--------
$vamTemplate->assign('AMMOUNT', $currencies->format($_POST['amount'])); $vamTemplate->assign('MESSAGE', $_POST['message']); $vamTemplate->assign('GIFT_ID', $id1); $vamTemplate->assign('WEBSITE', HTTP_SERVER . DIR_WS_CATALOG); if (SEARCH_ENGINE_FRIENDLY_URLS == 'true') { $link = HTTP_SERVER . DIR_WS_CATALOG . 'gv_redeem.php' . '/gv_no,' . $id1; } else { $link = HTTP_SERVER . DIR_WS_CATALOG . 'gv_redeem.php' . '?gv_no=' . $id1; } $vamTemplate->assign('GIFT_LINK', $link); $html_mail = $vamTemplate->fetch(CURRENT_TEMPLATE . '/admin/mail/' . $_SESSION['language'] . '/send_gift.html'); $txt_mail = $vamTemplate->fetch(CURRENT_TEMPLATE . '/admin/mail/' . $_SESSION['language'] . '/send_gift.txt'); vam_php_mail(EMAIL_BILLING_ADDRESS, EMAIL_BILLING_NAME, $_POST['email_to'], '', '', EMAIL_BILLING_REPLY_ADDRESS, EMAIL_BILLING_REPLY_ADDRESS_NAME, '', '', EMAIL_BILLING_SUBJECT, $html_mail, $txt_mail); // Now create the coupon email entry $insert_query = vam_db_query("insert into " . TABLE_COUPONS . " (coupon_code, coupon_type, coupon_amount, date_created) values ('" . $id1 . "', 'G', '" . $_POST['amount'] . "', now())"); $insert_id = vam_db_insert_id($insert_query); $insert_query = vam_db_query("insert into " . TABLE_COUPON_EMAIL_TRACK . " (coupon_id, customer_id_sent, sent_firstname, emailed_to, date_sent) values ('" . $insert_id . "', '0', 'Admin', '" . $_POST['email_to'] . "', now() )"); } vam_redirect(vam_href_link(FILENAME_GV_MAIL, 'mail_sent_to=' . urlencode($mail_sent_to))); } if ($_GET['action'] == 'preview' && !$_POST['customers_email_address'] && !$_POST['email_to']) { $messageStack->add(ERROR_NO_CUSTOMER_SELECTED, 'error'); } if ($_GET['action'] == 'preview' && !$_POST['amount']) { $messageStack->add(ERROR_NO_AMOUNT_SELECTED, 'error'); } if ($_GET['mail_sent_to']) { $messageStack->add(sprintf(NOTICE_EMAIL_SENT_TO, $_GET['mail_sent_to']), 'notice'); } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
$sql_data_array['entry_company'] = $company; } if (ACCOUNT_SUBURB == 'true') { $sql_data_array['entry_suburb'] = $suburb; } if (ACCOUNT_STATE == 'true') { if ($zone_id > 0) { $sql_data_array['entry_zone_id'] = $zone_id; $sql_data_array['entry_state'] = ''; } else { $sql_data_array['entry_zone_id'] = '0'; $sql_data_array['entry_state'] = $state; } } vam_db_perform(TABLE_ADDRESS_BOOK, $sql_data_array); $_SESSION['billto'] = vam_db_insert_id(); if (isset($_SESSION['payment'])) { unset($_SESSION['payment']); } vam_redirect(vam_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL')); } // process the selected billing destination } elseif (isset($_POST['address'])) { $reset_payment = false; if (isset($_SESSION['billto'])) { if ($billto != $_POST['address']) { if (isset($_SESSION['payment'])) { $reset_payment = true; } } }
function confirmation() { global $cartID, $customer_id, $languages_id, $order, $order_total_modules; if (isset($_SESSION['cartID'])) { $insert_order = false; if (isset($_SESSION['cart_yandex_id'])) { $order_id = substr($_SESSION['cart_yandex_id'], strpos($_SESSION['cart_yandex_id'], '-') + 1); $curr_check = vam_db_query("select currency from " . TABLE_ORDERS . " where orders_id = '" . (int) $order_id . "'"); $curr = vam_db_fetch_array($curr_check); if ($curr['currency'] != $order->info['currency'] || $cartID != substr($_SESSION['cart_yandex_id'], 0, strlen($cartID))) { $check_query = vam_db_query('select orders_id from ' . TABLE_ORDERS_STATUS_HISTORY . ' where orders_id = "' . (int) $order_id . '" limit 1'); if (vam_db_num_rows($check_query) < 1) { vam_db_query('delete from ' . TABLE_ORDERS . ' where orders_id = "' . (int) $order_id . '"'); vam_db_query('delete from ' . TABLE_ORDERS_TOTAL . ' where orders_id = "' . (int) $order_id . '"'); vam_db_query('delete from ' . TABLE_ORDERS_STATUS_HISTORY . ' where orders_id = "' . (int) $order_id . '"'); vam_db_query('delete from ' . TABLE_ORDERS_PRODUCTS . ' where orders_id = "' . (int) $order_id . '"'); vam_db_query('delete from ' . TABLE_ORDERS_PRODUCTS_ATTRIBUTES . ' where orders_id = "' . (int) $order_id . '"'); vam_db_query('delete from ' . TABLE_ORDERS_PRODUCTS_DOWNLOAD . ' where orders_id = "' . (int) $order_id . '"'); } $insert_order = true; } } else { $insert_order = true; } if ($insert_order == true) { $order_totals = array(); if (is_array($order_total_modules->modules)) { reset($order_total_modules->modules); while (list(, $value) = each($order_total_modules->modules)) { $class = substr($value, 0, strrpos($value, '.')); if ($GLOBALS[$class]->enabled) { for ($i = 0, $n = sizeof($GLOBALS[$class]->output); $i < $n; $i++) { if (vam_not_null($GLOBALS[$class]->output[$i]['title']) && vam_not_null($GLOBALS[$class]->output[$i]['text'])) { $order_totals[] = array('code' => $GLOBALS[$class]->code, 'title' => $GLOBALS[$class]->output[$i]['title'], 'text' => $GLOBALS[$class]->output[$i]['text'], 'value' => $GLOBALS[$class]->output[$i]['value'], 'sort_order' => $GLOBALS[$class]->sort_order); } } } } } if ($_SESSION['customers_status']['customers_status_ot_discount_flag'] == 1) { $discount = $_SESSION['customers_status']['customers_status_ot_discount']; } else { $discount = '0.00'; } if ($_SERVER["HTTP_X_FORWARDED_FOR"]) { $customers_ip = $_SERVER["HTTP_X_FORWARDED_FOR"]; } else { $customers_ip = $_SERVER["REMOTE_ADDR"]; } $sql_data_array = array('customers_id' => $_SESSION['customer_id'], 'customers_name' => $order->customer['firstname'] . ' ' . $order->customer['lastname'], 'customers_cid' => $order->customer['csID'], 'customers_vat_id' => $_SESSION['customer_vat_id'], 'customers_company' => $order->customer['company'], 'customers_status' => $_SESSION['customers_status']['customers_status_id'], 'customers_status_name' => $_SESSION['customers_status']['customers_status_name'], 'customers_status_image' => $_SESSION['customers_status']['customers_status_image'], 'customers_status_discount' => $discount, 'customers_street_address' => $order->customer['street_address'], 'customers_suburb' => $order->customer['suburb'], 'customers_city' => $order->customer['city'], 'customers_postcode' => $order->customer['postcode'], 'customers_state' => $order->customer['state'], 'customers_country' => $order->customer['country']['title'], 'customers_telephone' => $order->customer['telephone'], 'customers_email_address' => $order->customer['email_address'], 'customers_address_format_id' => $order->customer['format_id'], 'delivery_name' => $order->delivery['firstname'] . ' ' . $order->delivery['lastname'], 'delivery_company' => $order->delivery['company'], 'delivery_street_address' => $order->delivery['street_address'], 'delivery_suburb' => $order->delivery['suburb'], 'delivery_city' => $order->delivery['city'], 'delivery_postcode' => $order->delivery['postcode'], 'delivery_state' => $order->delivery['state'], 'delivery_country' => $order->delivery['country']['title'], 'delivery_address_format_id' => $order->delivery['format_id'], 'billing_name' => $order->billing['firstname'] . ' ' . $order->billing['lastname'], 'billing_company' => $order->billing['company'], 'billing_street_address' => $order->billing['street_address'], 'billing_suburb' => $order->billing['suburb'], 'billing_city' => $order->billing['city'], 'billing_postcode' => $order->billing['postcode'], 'billing_state' => $order->billing['state'], 'billing_country' => $order->billing['country']['title'], 'billing_address_format_id' => $order->billing['format_id'], 'payment_method' => $order->info['payment_method'], 'payment_class' => $order->info['payment_class'], 'shipping_method' => $order->info['shipping_method'], 'shipping_class' => $order->info['shipping_class'], 'language' => $_SESSION['language'], 'comments' => $order->info['comments'], 'customers_ip' => $customers_ip, 'orig_reference' => $order->customer['orig_reference'], 'login_reference' => $order->customer['login_reference'], 'cc_type' => $order->info['cc_type'], 'cc_owner' => $order->info['cc_owner'], 'cc_number' => $order->info['cc_number'], 'cc_expires' => $order->info['cc_expires'], 'date_purchased' => 'now()', 'orders_status' => $order->info['order_status'], 'currency' => $order->info['currency'], 'currency_value' => $order->info['currency_value']); vam_db_perform(TABLE_ORDERS, $sql_data_array); $insert_id = vam_db_insert_id(); $customer_notification = SEND_EMAILS == 'true' ? '1' : '0'; $sql_data_array = array('orders_id' => $insert_id, 'orders_status_id' => $order->info['order_status'], 'date_added' => 'now()', 'customer_notified' => $customer_notification, 'comments' => $order->info['comments']); vam_db_perform(TABLE_ORDERS_STATUS_HISTORY, $sql_data_array); for ($i = 0, $n = sizeof($order_totals); $i < $n; $i++) { $sql_data_array = array('orders_id' => $insert_id, 'title' => $order_totals[$i]['title'], 'text' => $order_totals[$i]['text'], 'value' => $order_totals[$i]['value'], 'class' => $order_totals[$i]['code'], 'sort_order' => $order_totals[$i]['sort_order']); vam_db_perform(TABLE_ORDERS_TOTAL, $sql_data_array); } for ($i = 0, $n = sizeof($order->products); $i < $n; $i++) { $sql_data_array = array('orders_id' => $insert_id, 'products_id' => vam_get_prid($order->products[$i]['id']), 'products_model' => $order->products[$i]['model'], 'products_name' => $order->products[$i]['name'], 'products_price' => $order->products[$i]['price'], 'final_price' => $order->products[$i]['final_price'], 'products_tax' => $order->products[$i]['tax'], 'products_quantity' => $order->products[$i]['qty']); vam_db_perform(TABLE_ORDERS_PRODUCTS, $sql_data_array); $order_products_id = vam_db_insert_id(); $attributes_exist = '0'; if (isset($order->products[$i]['attributes'])) { $attributes_exist = '1'; for ($j = 0, $n2 = sizeof($order->products[$i]['attributes']); $j < $n2; $j++) { if (DOWNLOAD_ENABLED == 'true') { $attributes_query = "select popt.products_options_name, poval.products_options_values_name, pa.options_values_price, pa.price_prefix, pad.products_attributes_maxdays, pad.products_attributes_maxcount , pad.products_attributes_filename, pad.products_attributes_is_pin\n from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_OPTIONS_VALUES . " poval, " . TABLE_PRODUCTS_ATTRIBUTES . " pa\n left join " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD . " pad\n on pa.products_attributes_id=pad.products_attributes_id\n where pa.products_id = '" . $order->products[$i]['id'] . "'\n and pa.options_id = '" . $order->products[$i]['attributes'][$j]['option_id'] . "'\n and pa.options_id = popt.products_options_id\n and pa.options_values_id = '" . $order->products[$i]['attributes'][$j]['value_id'] . "'\n and pa.options_values_id = poval.products_options_values_id\n and popt.language_id = '" . $_SESSION['languages_id'] . "'\n and poval.language_id = '" . $_SESSION['languages_id'] . "'"; $attributes = vam_db_query($attributes_query); } else { $attributes = vam_db_query("select popt.products_options_name, poval.products_options_values_name, pa.options_values_price, pa.price_prefix from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_OPTIONS_VALUES . " poval, " . TABLE_PRODUCTS_ATTRIBUTES . " pa where pa.products_id = '" . $order->products[$i]['id'] . "' and pa.options_id = '" . $order->products[$i]['attributes'][$j]['option_id'] . "' and pa.options_id = popt.products_options_id and pa.options_values_id = '" . $order->products[$i]['attributes'][$j]['value_id'] . "' and pa.options_values_id = poval.products_options_values_id and popt.language_id = '" . $_SESSION['languages_id'] . "' and poval.language_id = '" . $_SESSION['languages_id'] . "'"); } // update attribute stock vam_db_query("UPDATE " . TABLE_PRODUCTS_ATTRIBUTES . " set\n\t\t\t\t\t\t attributes_stock=attributes_stock - '" . $order->products[$i]['qty'] . "'\n\t\t\t\t\t\t where\n\t\t\t\t\t\t products_id='" . $order->products[$i]['id'] . "'\n\t\t\t\t\t\t and options_values_id='" . $order->products[$i]['attributes'][$j]['value_id'] . "'\n\t\t\t\t\t\t and options_id='" . $order->products[$i]['attributes'][$j]['option_id'] . "'\n\t\t\t\t\t\t "); $attributes_values = vam_db_fetch_array($attributes); $sql_data_array = array('orders_id' => $insert_id, 'orders_products_id' => $order_products_id, 'products_options' => $attributes_values['products_options_name'], 'products_options_values' => $attributes_values['products_options_values_name'], 'options_values_price' => $attributes_values['options_values_price'], 'price_prefix' => $attributes_values['price_prefix']); vam_db_perform(TABLE_ORDERS_PRODUCTS_ATTRIBUTES, $sql_data_array); if (DOWNLOAD_ENABLED == 'true' && (isset($attributes_values['products_attributes_filename']) && vam_not_null($attributes_values['products_attributes_filename']) or $attributes_values['products_attributes_is_pin'])) { //PIN add for ($pincycle = 0; $pincycle < $order->products[$i]['qty']; $pincycle++) { if ($attributes_values['products_attributes_is_pin']) { $pin_query = vam_db_query("SELECT products_pin_id, products_pin_code FROM " . TABLE_PRODUCTS_PINS . " WHERE products_id = '" . $order->products[$i]['id'] . "' AND products_pin_used='0' LIMIT 1"); if (vam_db_num_rows($pin_query) == '0') { // We have no PIN for this product // insert some error notifying here $pin = PIN_NOT_AVAILABLE; } else { $pin_res = vam_db_fetch_array($pin_query); $pin = $pin_res['products_pin_code']; vam_db_query("UPDATE " . TABLE_PRODUCTS_PINS . " SET products_pin_used='" . $insert_id . "' WHERE products_pin_id = '" . $pin_res['products_pin_id'] . "'"); } } //PIN $sql_data_array = array('orders_id' => $insert_id, 'orders_products_id' => $order_products_id, 'orders_products_filename' => $attributes_values['products_attributes_filename'], 'download_maxdays' => $attributes_values['products_attributes_maxdays'], 'download_count' => $attributes_values['products_attributes_maxcount'], 'download_is_pin' => $attributes_values['products_attributes_is_pin'], 'download_pin_code' => $pin); vam_db_perform(TABLE_ORDERS_PRODUCTS_DOWNLOAD, $sql_data_array); } } } } } $_SESSION['cart_yandex_id'] = $cartID . '-' . $insert_id; } } return array('title' => MODULE_PAYMENT_YANDEX_MERCHANT_TEXT_DESCRIPTION); }
$zone_id = vam_db_prepare_input($_POST['zone_id']); vam_db_query("update " . TABLE_ZONES_TO_GEO_ZONES . " set geo_zone_id = '" . vam_db_input($zID) . "', zone_country_id = '" . vam_db_input($zone_country_id) . "', zone_id = " . (vam_db_input($zone_id) ? "'" . vam_db_input($zone_id) . "'" : 'null') . ", last_modified = now() where association_id = '" . vam_db_input($sID) . "'"); vam_redirect(vam_href_link(FILENAME_GEO_ZONES, 'zpage=' . $_GET['zpage'] . '&zID=' . $_GET['zID'] . '&action=list&spage=' . $_GET['spage'] . '&sID=' . $_GET['sID'])); break; case 'deleteconfirm_sub': $sID = vam_db_prepare_input($_GET['sID']); vam_db_query("delete from " . TABLE_ZONES_TO_GEO_ZONES . " where association_id = '" . vam_db_input($sID) . "'"); vam_redirect(vam_href_link(FILENAME_GEO_ZONES, 'zpage=' . $_GET['zpage'] . '&zID=' . $_GET['zID'] . '&action=list&spage=' . $_GET['spage'])); break; } switch ($_GET['action']) { case 'insert_zone': $geo_zone_name = vam_db_prepare_input($_POST['geo_zone_name']); $geo_zone_description = vam_db_prepare_input($_POST['geo_zone_description']); vam_db_query("insert into " . TABLE_GEO_ZONES . " (geo_zone_name, geo_zone_description, date_added) values ('" . vam_db_input($geo_zone_name) . "', '" . vam_db_input($geo_zone_description) . "', now())"); $new_zone_id = vam_db_insert_id(); vam_redirect(vam_href_link(FILENAME_GEO_ZONES, 'zpage=' . $_GET['zpage'] . '&zID=' . $new_zone_id)); break; case 'save_zone': $zID = vam_db_prepare_input($_GET['zID']); $geo_zone_name = vam_db_prepare_input($_POST['geo_zone_name']); $geo_zone_description = vam_db_prepare_input($_POST['geo_zone_description']); vam_db_query("update " . TABLE_GEO_ZONES . " set geo_zone_name = '" . vam_db_input($geo_zone_name) . "', geo_zone_description = '" . vam_db_input($geo_zone_description) . "', last_modified = now() where geo_zone_id = '" . vam_db_input($zID) . "'"); vam_redirect(vam_href_link(FILENAME_GEO_ZONES, 'zpage=' . $_GET['zpage'] . '&zID=' . $_GET['zID'])); break; case 'deleteconfirm_zone': $zID = vam_db_prepare_input($_GET['zID']); vam_db_query("delete from " . TABLE_GEO_ZONES . " where geo_zone_id = '" . vam_db_input($zID) . "'"); vam_db_query("delete from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . vam_db_input($zID) . "'"); vam_redirect(vam_href_link(FILENAME_GEO_ZONES, 'zpage=' . $_GET['zpage'])); break;
} } $customers_statuses_array = vam_get_customers_statuses(); if (strpos($group_ids, 'c_all_group')) { $group_ids = 'c_all_group,'; for ($i = 0; $n = sizeof($customers_statuses_array), $i < $n; $i++) { $group_ids .= 'c_' . $customers_statuses_array[$i]['id'] . '_group,'; } } $sql_data_array = array('products_id' => $product, 'group_ids' => $group_ids, 'content_name' => $content_title, 'content_file' => $content_file_name, 'content_link' => $content_link, 'file_comment' => $file_comment, 'languages_id' => $content_language); if ($_GET['id'] == 'update_product') { vam_db_perform(TABLE_PRODUCTS_CONTENT, $sql_data_array, 'update', "content_id = '" . $coID . "'"); $content_id = vam_db_insert_id(); } else { vam_db_perform(TABLE_PRODUCTS_CONTENT, $sql_data_array); $content_id = vam_db_insert_id(); } // if get id // rename filename vam_redirect(vam_href_link(FILENAME_CONTENT_MANAGER, 'pID=' . $product)); } // if error } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html <?php echo HTML_PARAMS; ?> > <head> <meta http-equiv="Content-Type" content="text/html; charset=<?php
--------------------------------------------------------------*/ require 'includes/application_top.php'; require DIR_WS_CLASSES . 'currencies.php'; $currencies = new currencies(); switch ($_GET['action']) { case 'insert': case 'save': $campaigns_id = vam_db_prepare_input($_GET['cID']); $campaigns_name = vam_db_prepare_input($_POST['campaigns_name']); $campaigns_refID = vam_db_prepare_input($_POST['campaigns_refID']); $sql_data_array = array('campaigns_name' => $campaigns_name, 'campaigns_refID' => $campaigns_refID); if ($_GET['action'] == 'insert') { $insert_sql_data = array('date_added' => 'now()'); $sql_data_array = vam_array_merge($sql_data_array, $insert_sql_data); vam_db_perform(TABLE_CAMPAIGNS, $sql_data_array); $campaigns_id = vam_db_insert_id(); } elseif ($_GET['action'] == 'save') { $update_sql_data = array('last_modified' => 'now()'); $sql_data_array = vam_array_merge($sql_data_array, $update_sql_data); vam_db_perform(TABLE_CAMPAIGNS, $sql_data_array, 'update', "campaigns_id = '" . vam_db_input($campaigns_id) . "'"); } vam_redirect(vam_href_link(FILENAME_CAMPAIGNS, 'page=' . $_GET['page'] . '&cID=' . $campaigns_id)); break; case 'deleteconfirm': $campaigns_id = vam_db_prepare_input($_GET['cID']); vam_db_query("delete from " . TABLE_CAMPAIGNS . " where campaigns_id = '" . vam_db_input($campaigns_id) . "'"); vam_db_query("delete from " . TABLE_CAMPAIGNS_IP . " where campaign = '" . vam_db_input($campaigns_id) . "'"); if ($_POST['delete_refferers'] == 'on') { vam_db_query("update " . TABLE_ORDERS . " set refferers_id = '' where refferers_id = '" . vam_db_input($campaigns_id) . "'"); vam_db_query("update " . TABLE_CUSTOMERS . " set refferers_id = '' where refferers_id = '" . vam_db_input($campaigns_id) . "'"); }
if ($_GET['action']) { switch ($_GET['action']) { case 'new_order': $customers1_query = vam_db_query("select * from " . TABLE_CUSTOMERS . " where customers_id = '" . $_GET['cID'] . "'"); $customers1 = vam_db_fetch_array($customers1_query); $customers_query = vam_db_query("select * from " . TABLE_ADDRESS_BOOK . " where customers_id = '" . $_GET['cID'] . "'"); $customers = vam_db_fetch_array($customers_query); $country_query = vam_db_query("select countries_name from " . TABLE_COUNTRIES . " where status='1' and countries_id = '" . $customers['entry_country_id'] . "'"); $country = vam_db_fetch_array($country_query); $stat_query = vam_db_query("select * from " . TABLE_CUSTOMERS_STATUS . " where customers_status_id = '" . $customers1[customers_status] . "' "); $stat = vam_db_fetch_array($stat_query); $sql_data_array = array('customers_id' => vam_db_prepare_input($customers['customers_id']), 'customers_cid' => vam_db_prepare_input($customers1['customers_cid']), 'customers_vat_id' => vam_db_prepare_input($customers1['customers_vat_id']), 'customers_status' => vam_db_prepare_input($customers1['customers_status']), 'customers_status_name' => vam_db_prepare_input($stat['customers_status_name']), 'customers_status_image' => vam_db_prepare_input($stat['customers_status_image']), 'customers_status_discount' => vam_db_prepare_input($customers1[customers_personal_discount] ? $customers1[customers_personal_discount] : $stat['customers_status_discount']), 'customers_name' => vam_db_prepare_input($customers['entry_firstname'] . ' ' . $customers['entry_secondname'] . ' ' . $customers['entry_lastname']), 'customers_company' => vam_db_prepare_input($customers['entry_company']), 'customers_street_address' => vam_db_prepare_input($customers['entry_street_address']), 'customers_suburb' => vam_db_prepare_input($customers['entry_suburb']), 'customers_city' => vam_db_prepare_input($customers['entry_city']), 'customers_postcode' => vam_db_prepare_input($customers['entry_postcode']), 'customers_state' => vam_db_prepare_input($customers['entry_state']), 'customers_country' => vam_db_prepare_input($country['countries_name']), 'customers_telephone' => vam_db_prepare_input($customers1['customers_telephone']), 'customers_email_address' => vam_db_prepare_input($customers1['customers_email_address']), 'customers_address_format_id' => '5', 'customers_ip' => '0', 'delivery_name' => vam_db_prepare_input($customers['entry_firstname'] . ' ' . $customers['entry_secondname'] . ' ' . $customers['entry_lastname']), 'delivery_company' => vam_db_prepare_input($customers['entry_company']), 'delivery_street_address' => vam_db_prepare_input($customers['entry_street_address']), 'delivery_suburb' => vam_db_prepare_input($customers['entry_suburb']), 'delivery_city' => vam_db_prepare_input($customers['entry_city']), 'delivery_postcode' => vam_db_prepare_input($customers['entry_postcode']), 'delivery_state' => vam_db_prepare_input($customers['entry_state']), 'delivery_country' => vam_db_prepare_input($country['countries_name']), 'delivery_address_format_id' => '5', 'billing_name' => vam_db_prepare_input($customers['entry_firstname'] . ' ' . $customers['entry_secondname'] . ' ' . $customers['entry_lastname']), 'billing_company' => vam_db_prepare_input($customers['entry_company']), 'billing_street_address' => vam_db_prepare_input($customers['entry_street_address']), 'billing_suburb' => vam_db_prepare_input($customers['entry_suburb']), 'billing_city' => vam_db_prepare_input($customers['entry_city']), 'billing_postcode' => vam_db_prepare_input($customers['entry_postcode']), 'billing_state' => vam_db_prepare_input($customers['entry_state']), 'billing_country' => vam_db_prepare_input($country['countries_name']), 'billing_address_format_id' => '5', 'payment_method' => 'cod', 'cc_type' => '', 'cc_owner' => '', 'cc_number' => '', 'cc_expires' => '', 'cc_start' => '', 'cc_issue' => '', 'cc_cvv' => '', 'comments' => '', 'last_modified' => 'now()', 'date_purchased' => 'now()', 'orders_status' => '1', 'orders_date_finished' => '', 'currency' => DEFAULT_CURRENCY, 'currency_value' => '1.0000', 'account_type' => '0', 'payment_class' => 'cod', 'shipping_method' => SHIPPING_FLAT, 'shipping_class' => 'flat_flat', 'customers_ip' => '', 'language' => $_SESSION['language']); $insert_sql_data = array('currency_value' => '1.0000'); $sql_data_array = vam_array_merge($sql_data_array, $insert_sql_data); vam_db_perform(TABLE_ORDERS, $sql_data_array); $orders_id = vam_db_insert_id(); $sql_data_array = array('orders_id' => $orders_id, 'title' => ORDER_TOTAL, 'text' => '0', 'value' => '0', 'class' => 'ot_total'); $insert_sql_data = array('sort_order' => MODULE_ORDER_TOTAL_TOTAL_SORT_ORDER); $sql_data_array = vam_array_merge($sql_data_array, $insert_sql_data); vam_db_perform(TABLE_ORDERS_TOTAL, $sql_data_array); $sql_data_array = array('orders_id' => $orders_id, 'title' => ORDER_SUBTOTAL, 'text' => '0', 'value' => '0', 'class' => 'ot_subtotal'); $insert_sql_data = array('sort_order' => MODULE_ORDER_TOTAL_SUBTOTAL_SORT_ORDER); $sql_data_array = vam_array_merge($sql_data_array, $insert_sql_data); vam_db_perform(TABLE_ORDERS_TOTAL, $sql_data_array); vam_redirect(vam_href_link(FILENAME_ORDERS, 'oID=' . $orders_id . '&action=edit')); break; case 'statusconfirm': $customers_id = vam_db_prepare_input($_GET['cID']); $customer_updated = false; $check_status_query = vam_db_query("select customers_firstname, customers_secondname, customers_lastname, customers_email_address , customers_status, member_flag from " . TABLE_CUSTOMERS . " where customers_id = '" . vam_db_input($_GET['cID']) . "'"); $check_status = vam_db_fetch_array($check_status_query);
} if ($_POST['products_id']) { $affiliate_products_id = $_POST['products_id']; } if ($_GET['affiliate_banner_id']) { $affiliate_banner_id = $_GET['affiliate_banner_id']; } if ($_POST['affiliate_banner_id']) { $affiliate_banner_id = $_POST['affiliate_banner_id']; } if (!$link_to) { $link_to = "0"; } $sql_data_array = array('affiliate_id' => $_SESSION['affiliate_ref'], 'affiliate_clientdate' => $affiliate_clientdate, 'affiliate_clientbrowser' => $affiliate_clientbrowser, 'affiliate_clientip' => $affiliate_clientip, 'affiliate_clientreferer' => $affiliate_clientreferer, 'affiliate_products_id' => $affiliate_products_id, 'affiliate_banner_id' => $affiliate_banner_id); vam_db_perform(TABLE_AFFILIATE_CLICKTHROUGHS, $sql_data_array); $_SESSION['affiliate_clickthroughs_id'] = vam_db_insert_id(); // Banner has been clicked, update stats: if ($affiliate_banner_id && $_SESSION['affiliate_ref']) { $today = date('Y-m-d'); $sql = "select * from " . TABLE_AFFILIATE_BANNERS_HISTORY . " where affiliate_banners_id = '" . $affiliate_banner_id . "' and affiliate_banners_affiliate_id = '" . $_SESSION['affiliate_ref'] . "' and affiliate_banners_history_date = '" . $today . "'"; $banner_stats_query = vam_db_query($sql); // Banner has been shown today if (vam_db_fetch_array($banner_stats_query)) { vam_db_query("update " . TABLE_AFFILIATE_BANNERS_HISTORY . " set affiliate_banners_clicks = affiliate_banners_clicks + 1 where affiliate_banners_id = '" . $affiliate_banner_id . "' and affiliate_banners_affiliate_id = '" . $_SESSION['affiliate_ref'] . "' and affiliate_banners_history_date = '" . $today . "'"); // Initial entry if banner has not been shown } else { $sql_data_array = array('affiliate_banners_id' => $affiliate_banner_id, 'affiliate_banners_products_id' => $affiliate_products_id, 'affiliate_banners_affiliate_id' => $_SESSION['affiliate_ref'], 'affiliate_banners_clicks' => '1', 'affiliate_banners_history_date' => $today); vam_db_perform(TABLE_AFFILIATE_BANNERS_HISTORY, $sql_data_array); } } // Set Cookie if the customer comes back and orders it counts
$_SESSION['customer_first_name'] = $firstname; $_SESSION['customer_second_name'] = $secondname; $_SESSION['customer_country_id'] = $country_id; $_SESSION['customer_zone_id'] = $zone_id > 0 ? (int) $zone_id : '0'; $_SESSION['customer_default_address_id'] = (int) $_GET['edit']; $sql_data_array = array('customers_firstname' => $firstname, 'customers_secondname' => $secondname, 'customers_lastname' => $lastname, 'customers_default_address_id' => (int) $_GET['edit'], 'customers_last_modified' => 'now()'); if (ACCOUNT_GENDER == 'true') { $sql_data_array['customers_gender'] = $gender; } vam_db_perform(TABLE_CUSTOMERS, $sql_data_array, 'update', "customers_id = '" . (int) $_SESSION['customer_id'] . "'"); } } else { $sql_data_array['customers_id'] = (int) $_SESSION['customer_id']; $sql_data_array['address_date_added'] = 'now()'; vam_db_perform(TABLE_ADDRESS_BOOK, $sql_data_array); $new_address_book_id = vam_db_insert_id(); // reregister session variables if (isset($_POST['primary']) && $_POST['primary'] == 'on') { $_SESSION['customer_first_name'] = $firstname; $_SESSION['customer_second_name'] = $secondname; $_SESSION['customer_country_id'] = $country_id; $_SESSION['customer_zone_id'] = $zone_id > 0 ? (int) $zone_id : '0'; if (isset($_POST['primary']) && $_POST['primary'] == 'on') { $_SESSION['customer_default_address_id'] = $new_address_book_id; } $sql_data_array = array('customers_firstname' => $firstname, 'customers_secondname' => $secondname, 'customers_lastname' => $lastname, 'customers_last_modified' => 'now()', 'customers_date_added' => 'now()'); if (ACCOUNT_GENDER == 'true') { $sql_data_array['customers_gender'] = $gender; } if (isset($_POST['primary']) && $_POST['primary'] == 'on') { $sql_data_array['customers_default_address_id'] = $new_address_book_id;
$affiliate_billing_query = vam_db_query($sql); $affiliate_billing = vam_db_fetch_array($affiliate_billing_query); // Get affiliate Informations $sql = "\n SELECT a.*, c.countries_id, c.countries_name, c.countries_iso_code_2, c.countries_iso_code_3, c.address_format_id \n from " . TABLE_AFFILIATE . " a \n left join " . TABLE_ZONES . " z on (a.affiliate_zone_id = z.zone_id) \n left join " . TABLE_COUNTRIES . " c on (a.affiliate_country_id = c.countries_id)\n WHERE affiliate_id = '" . $affiliate_payment['affiliate_id'] . "' \n "; $affiliate_query = vam_db_query($sql); $affiliate = vam_db_fetch_array($affiliate_query); // Get need tax informations for the affiliate $affiliate_tax_rate = vam_get_affiliate_tax_rate(AFFILIATE_TAX_ID, $affiliate['affiliate_country_id'], $affiliate['affiliate_zone_id']); $affiliate_tax = vam_round($affiliate_billing['affiliate_payment'] * $affiliate_tax_rate / 100, 2); // Netto-Provision $affiliate_payment_total = $affiliate_billing['affiliate_payment']; // Bill the order $affiliate['affiliate_state'] = vam_get_zone_code($affiliate['affiliate_country_id'], $affiliate['affiliate_zone_id'], $affiliate['affiliate_state']); $sql_data_array = array('affiliate_id' => $affiliate_payment['affiliate_id'], 'affiliate_payment' => $affiliate_billing['affiliate_payment'] - $affiliate_tax, 'affiliate_payment_tax' => $affiliate_tax, 'affiliate_payment_total' => $affiliate_payment_total, 'affiliate_payment_date' => 'now()', 'affiliate_payment_status' => '0', 'affiliate_firstname' => $affiliate['affiliate_firstname'], 'affiliate_lastname' => $affiliate['affiliate_lastname'], 'affiliate_street_address' => $affiliate['affiliate_street_address'], 'affiliate_suburb' => $affiliate['affiliate_suburb'], 'affiliate_city' => $affiliate['affiliate_city'], 'affiliate_country' => $affiliate['countries_name'], 'affiliate_postcode' => $affiliate['affiliate_postcode'], 'affiliate_company' => $affiliate['affiliate_company'], 'affiliate_state' => $affiliate['affiliate_state'], 'affiliate_address_format_id' => $affiliate['address_format_id']); vam_db_perform(TABLE_AFFILIATE_PAYMENT, $sql_data_array); $insert_id = vam_db_insert_id(); // Set the Sales to Final State vam_db_query("update " . TABLE_AFFILIATE_SALES . " set affiliate_payment_id = '" . $insert_id . "', affiliate_billing_status = 1, affiliate_payment_date = now() where affiliate_id = '" . $affiliate_payment['affiliate_id'] . "' and affiliate_billing_status = 99"); // Notify Affiliate if (AFFILIATE_NOTIFY_AFTER_BILLING == 'true') { $check_status_query = vam_db_query("select af.affiliate_email_address, ap.affiliate_lastname, ap.affiliate_firstname, ap.affiliate_payment_status, ap.affiliate_payment_date, ap.affiliate_payment_date from " . TABLE_AFFILIATE_PAYMENT . " ap, " . TABLE_AFFILIATE . " af where affiliate_payment_id = '" . $insert_id . "' and af.affiliate_id = ap.affiliate_id "); $check_status = vam_db_fetch_array($check_status_query); $email = STORE_NAME . "\n" . EMAIL_SEPARATOR . "\n" . EMAIL_TEXT_AFFILIATE_PAYMENT_NUMBER . ' ' . $insert_id . "\n" . EMAIL_TEXT_INVOICE_URL . ' ' . vam_catalog_href_link(FILENAME_CATALOG_AFFILIATE_PAYMENT_INFO, 'payment_id=' . $insert_id, 'SSL') . "\n" . EMAIL_TEXT_PAYMENT_BILLED . ' ' . vam_date_long($check_status['affiliate_payment_date']) . "\n\n" . EMAIL_TEXT_NEW_PAYMENT; vam_php_mail(AFFILIATE_EMAIL_ADDRESS, EMAIL_SUPPORT_NAME, $check_status['affiliate_email_address'], $check_status['affiliate_firstname'] . ' ' . $check_status['affiliate_lastname'], '', EMAIL_SUPPORT_REPLY_ADDRESS, EMAIL_SUPPORT_REPLY_ADDRESS_NAME, '', '', EMAIL_TEXT_SUBJECT, nl2br($email), $email); } } $messageStack->add_session(SUCCESS_BILLING, 'success'); vam_redirect(vam_href_link(FILENAME_AFFILIATE_PAYMENT, vam_get_all_get_params(array('action')) . 'action=edit')); break; case 'update_payment': $pID = vam_db_prepare_input($_GET['pID']);
function process_row($item1, $filelayout, $filelayout_count, $default_these, $ep_separator, $languages, $custom_fields) { // first we clean up the row of data if (EP_EXCEL_SAFE_OUTPUT == true) { $items = $item1; } else { // chop blanks from each end $item1 = ltrim(rtrim($item1)); // blow it into an array, splitting on the tabs $items = explode($ep_separator, $item1); } // make sure all non-set things are set to ''; // and strip the quotes from the start and end of the stings. // escape any special chars for the database. foreach ($filelayout as $key => $value) { $i = $filelayout[$key]; if (isset($items[$i]) == false) { $items[$i] = ''; } else { // Check to see if either of the magic_quotes are turned on or off; // And apply filtering accordingly. if (function_exists('ini_get')) { //echo "Getting ready to check magic quotes<br />"; if (ini_get('magic_quotes_runtime') == 1) { // The magic_quotes_runtime are on, so lets account for them // check if the first & last character are quotes; // if it is, chop off the quotes. if (substr($items[$i], -1) == '"' && substr($items[$i], 0, 1) == '"') { $items[$i] = substr($items[$i], 2, strlen($items[$i]) - 4); } // now any remaining doubled double quotes should be converted to one doublequote if (EP_REPLACE_QUOTES == true) { if (EP_EXCEL_SAFE_OUTPUT == true) { $items[$i] = str_replace('\\"\\"', """, $items[$i]); } $items[$i] = str_replace('\\"', """, $items[$i]); $items[$i] = str_replace("\\'", "'", $items[$i]); } } else { // no magic_quotes are on // check if the last character is a quote; // if it is, chop off the 1st and last character of the string. if (substr($items[$i], -1) == '"' && substr($items[$i], 0, 1) == '"') { $items[$i] = substr($items[$i], 1, strlen($items[$i]) - 2); } // now any remaining doubled double quotes should be converted to one doublequote if (EP_REPLACE_QUOTES == true) { if (EP_EXCEL_SAFE_OUTPUT == true) { $items[$i] = str_replace('""', """, $items[$i]); } $items[$i] = str_replace('"', """, $items[$i]); $items[$i] = str_replace("'", "'", $items[$i]); } } } } } // ///////////////////////////////////////////////////////////// // Do specific functions without processing entire range of vars // ///////////////////////////// // first do product extra fields if (isset($items[$filelayout['v_products_extra_fields_id']])) { $v_products_model = $items[$filelayout['v_products_model']]; // EP for product extra fields Contrib by minhmaster DEVSOFTVN ========== $v_products_extra_fields_id = $items[$filelayout['v_products_extra_fields_id']]; // $v_products_id = $items[$filelayout['v_products_id']]; $v_products_extra_fields_value = $items[$filelayout['v_products_extra_fields_value']]; $sql = "SELECT p.products_id as v_products_id FROM " . TABLE_PRODUCTS . " as p WHERE p.products_model = '" . $v_products_model . "'"; $result = vam_db_query($sql); $row = vam_db_fetch_array($result); $sql_exist = "SELECT products_extra_fields_value FROM " . TABLE_PRODUCTS_TO_PRODUCTS_EXTRA_FIELDS . " WHERE (products_id ='" . $row['v_products_id'] . "') AND (products_extra_fields_id ='" . $v_products_extra_fields_id . "')"; if (vam_db_num_rows(vam_db_query($sql_exist)) > 0) { $sql_extra_field = "UPDATE " . TABLE_PRODUCTS_TO_PRODUCTS_EXTRA_FIELDS . " SET products_extra_fields_value='" . $v_products_extra_fields_value . "' WHERE (products_id ='" . $row['v_products_id'] . "') AND (products_extra_fields_id ='" . $v_products_extra_fields_id . "')"; $str_err_report = " {$v_products_extra_fields_id} | {$v_products_id} | {$v_products_model} | {$v_products_extra_fields_value} | <b><font color=black>" . EASY_EXTRA_FIELD_UPDATED . "</font></b><br />"; } else { $sql_extra_field = "INSERT INTO " . TABLE_PRODUCTS_TO_PRODUCTS_EXTRA_FIELDS . "(products_id,products_extra_fields_id,products_extra_fields_value) VALUES ('" . $row['v_products_id'] . "','" . $v_products_extra_fields_id . "','" . $v_products_extra_fields_value . "')"; $str_err_report = " {$v_products_extra_fields_id} | {$v_products_id} | {$v_products_model} | {$v_products_extra_fields_value} | <b><font color=green>" . EASY_EXTRA_FIELD_ADDED . "</font></b><br />"; } $result = vam_db_query($sql_extra_field); echo $str_err_report; // end (EP for product extra fields Contrib by minhmt DEVSOFTVN) ============ // ///////////////////// // or do product deletes } elseif ($items[$filelayout['v_status']] == EP_DELETE_IT) { // Get the ID $sql = "SELECT p.products_id as v_products_id FROM " . TABLE_PRODUCTS . " as p WHERE p.products_model = '" . $items[$filelayout['v_products_model']] . "'"; $result = vam_db_query($sql); $row = vam_db_fetch_array($result); if (vam_db_num_rows($result) == 1) { vam_db_query("delete from " . TABLE_PRODUCTS_TO_CATEGORIES . " where products_id = '" . $row['v_products_id'] . "'"); $product_categories_query = vam_db_query("select count(*) as total from " . TABLE_PRODUCTS_TO_CATEGORIES . " where products_id = '" . $row['v_products_id'] . "'"); $product_categories = vam_db_fetch_array($product_categories_query); if ($product_categories['total'] == '0') { // gather product attribute data $result = vam_db_query("select pov.products_options_values_id from " . TABLE_PRODUCTS_ATTRIBUTES . " pa left join " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov on pa.options_values_id=pov.products_options_values_id where pa.products_id = '" . (int) $row['v_products_id'] . "'"); $remove_attribs = array(); while ($tmp_attrib = vam_db_fetch_array($result)) { $remove_attribs[] = $tmp_attrib; } // check each attribute name for links to other products foreach ($remove_attribs as $rakey => $ravalue) { $product_attribs_query = vam_db_query("select count(*) as total from " . TABLE_PRODUCTS_ATTRIBUTES . " where options_values_id = '" . (int) $ravalue['products_options_values_id'] . "'"); $product_attribs = vam_db_fetch_array($product_attribs_query); // if no other products linked, remove attribute name if ((int) $product_attribs['total'] == 1) { vam_db_query("delete from " . TABLE_PRODUCTS_OPTIONS_VALUES . " where products_options_values_id = '" . (int) $ravalue['products_options_values_id'] . "'"); } } // remove attribute records vam_db_query("delete from " . TABLE_PRODUCTS_ATTRIBUTES . " where products_id = '" . (int) $row['v_products_id'] . "'"); // remove product vam_remove_product($row['v_products_id']); } if (USE_CACHE == 'true') { vam_reset_cache_block('categories'); vam_reset_cache_block('also_purchased'); } echo EASY_TEXT_DELETED . $items[$filelayout['v_products_model']] . EASY_TEXT_DELETED . "<br />"; } else { echo EASY_TEXT_NOT_DELETE . $items['v_products_model'] . EASY_TEXT_NOT_DELETE . "<br> "; } // ////////////////////////////////// // or do regular product processing // ////////////////////////////////// } else { // ///////////////////////////////////////////////////////////////////// // // Start: Support for other contributions in products table // // ///////////////////////////////////////////////////////////////////// $ep_additional_select = ''; if (EP_ADDITIONAL_IMAGES == true) { $ep_additional_select .= 'p.products_image_description as v_products_image_description,'; } if (EP_MORE_PICS_6_SUPPORT == true) { $ep_additional_select .= 'p.products_subimage1 as v_products_subimage1,p.products_subimage2 as v_products_subimage2,p.products_subimage3 as v_products_subimage3,p.products_subimage4 as v_products_subimage4,p.products_subimage5 as v_products_subimage5,p.products_subimage6 as v_products_subimage6,'; } if (EP_UNLIMITED_IMAGES == true) { $ep_additional_select .= 'p.products_image_array as v_products_image_array,'; } if (EP_ULTRPICS_SUPPORT == true) { $ep_additional_select .= 'products_image_med as v_products_image_med,products_image_lrg as v_products_image_lrg,products_image_sm_1 as v_products_image_sm_1,products_image_xl_1 as v_products_image_xl_1,products_image_sm_2 as v_products_image_sm_2,products_image_xl_2 as v_products_image_xl_2,products_image_sm_3 as v_products_image_sm_3,products_image_xl_3 as v_products_image_xl_3,products_image_sm_4 as v_products_image_sm_4,products_image_xl_4 as v_products_image_xl_4,products_image_sm_5 as v_products_image_sm_5,products_image_xl_5 as v_products_image_xl_5,products_image_sm_6 as v_products_image_sm_6,products_image_xl_6 as v_products_image_xl_6,'; } if (EP_PDF_UPLOAD_SUPPORT == true) { $ep_additional_select .= 'p.products_pdfupload as v_products_pdfupload, p.products_fileupload as v_products_fileupload,'; } if (EP_MVS_SUPPORT == true) { $ep_additional_select .= 'vendors_id as v_vendor_id,'; } foreach ($custom_fields[TABLE_PRODUCTS] as $key => $name) { $ep_additional_select .= 'p.' . $key . ' as v_' . $key . ','; } // ///////////////////////////////////////////////////////////////////// // End: Support for other contributions in products table // ///////////////////////////////////////////////////////////////////// // now do a query to get the record's current contents $sql = "SELECT\n p.products_id as v_products_id,\n p.products_model as v_products_model,\n p.products_image as v_products_image,\n {$ep_additional_select}\n p.products_price as v_products_price,\n p.products_weight as v_products_weight,\n p.products_date_available as v_date_avail,\n p.products_date_added as v_date_added,\n p.products_tax_class_id as v_tax_class_id,\n p.products_quantity as v_products_quantity,\n p.manufacturers_id as v_manufacturers_id,\n subc.categories_id as v_categories_id,\n p.products_status as v_status_current\n FROM\n " . TABLE_PRODUCTS . " as p,\n " . TABLE_CATEGORIES . " as subc,\n " . TABLE_PRODUCTS_TO_CATEGORIES . " as ptoc\n WHERE\n p.products_model = '" . $items[$filelayout['v_products_model']] . "' AND\n p.products_id = ptoc.products_id AND\n ptoc.categories_id = subc.categories_id\n LIMIT 1\n "; $result = vam_db_query($sql); $row = vam_db_fetch_array($result); // determine processing status based on dropdown choice on EP menu // Delete product included in normal & update options if (sizeof($row) > 1 && ($_POST['imput_mode'] == "normal" || $_POST['imput_mode'] == "update")) { $process_product = true; // For Delete Only option (product exists) & (v_status = EP_DELETE_IT) & (Delete Only) } elseif (sizeof($row) > 1 && $items[$filelayout['v_status']] == EP_DELETE_IT && $_POST['imput_mode'] == "delete") { $process_product = true; } elseif (sizeof($row) == 1 && ($_POST['imput_mode'] == "normal" || $_POST['imput_mode'] == "addnew")) { $process_product = true; } else { $process_product = false; } if ($process_product == true) { while ($row) { // OK, since we got a row, the item already exists. // Let's get all the data we need and fill in all the fields that need to be defaulted // to the current values for each language, get the description and set the vals foreach ($languages as $key => $lang) { // products_name, products_description, products_url $sql2 = "SELECT * \n FROM " . TABLE_PRODUCTS_DESCRIPTION . "\n WHERE\n products_id = " . $row['v_products_id'] . " AND\n language_id = '" . $lang['id'] . "'\n LIMIT 1\n "; $result2 = vam_db_query($sql2); $row2 = vam_db_fetch_array($result2); // Need to report from ......_name_1 not ..._name_0 $row['v_products_name_' . $lang['id']] = $row2['products_name']; $row['v_products_description_' . $lang['id']] = $row2['products_description']; $row['v_products_url_' . $lang['id']] = $row2['products_url']; foreach ($custom_fields[TABLE_PRODUCTS_DESCRIPTION] as $key => $name) { $row['v_' . $key . '_' . $lang['id']] = $row2[$key]; } // header tags controller support if (isset($filelayout['v_products_meta_title_' . $lang['id']])) { $row['v_products_meta_title_' . $lang['id']] = $row2['products_meta_title']; $row['v_products_meta_description_' . $lang['id']] = $row2['products_meta_description']; $row['v_products_meta_keywords_' . $lang['id']] = $row2['products_meta_keywords']; } // end: header tags controller support } // start with v_categories_id // Get the category description // set the appropriate variable name // if parent_id is not null, then follow it up. $thecategory_id = $row['v_categories_id']; for ($categorylevel = 1; $categorylevel <= EP_MAX_CATEGORIES + 1; $categorylevel++) { if ($thecategory_id) { $sql3 = "SELECT parent_id, \n\t\t\t\t\t\t categories_image\n\t\t\t\t\t\t\t FROM " . TABLE_CATEGORIES . "\n\t\t\t\t\t\t\t WHERE \n\t\t\t\t\t\t\t\t categories_id = " . $thecategory_id . ''; $result3 = vam_db_query($sql3); if ($row3 = vam_db_fetch_array($result3)) { $temprow['v_categories_image_' . $categorylevel] = $row3['categories_image']; } foreach ($languages as $key => $lang) { $sql2 = "SELECT categories_name\n\t\t\t\t\t\t\t\t FROM " . TABLE_CATEGORIES_DESCRIPTION . "\n\t\t\t\t\t\t\t\t WHERE \n\t\t\t\t\t\t\t\t\t categories_id = " . $thecategory_id . " AND\n\t\t\t\t\t\t\t\t\t language_id = " . $lang['id']; $result2 = vam_db_query($sql2); if ($row2 = vam_db_fetch_array($result2)) { $temprow['v_categories_name_' . $categorylevel . '_' . $lang['id']] = $row2['categories_name']; } } // now get the parent ID if there was one $theparent_id = $row3['parent_id']; if ($theparent_id != '') { // there was a parent ID, lets set thecategoryid to get the next level $thecategory_id = $theparent_id; } else { // we have found the top level category for this item, $thecategory_id = false; } } else { $temprow['v_categories_image_' . $categorylevel] = ''; foreach ($languages as $key => $lang) { $temprow['v_categories_name_' . $categorylevel . '_' . $lang['id']] = ''; } } } // temprow has the old style low to high level categories. $newlevel = 1; // let's turn them into high to low level categories for ($categorylevel = EP_MAX_CATEGORIES + 1; $categorylevel > 0; $categorylevel--) { $found = false; if ($temprow['v_categories_image_' . $categorylevel] != '') { $row['v_categories_image_' . $newlevel] = $temprow['v_categories_image_' . $categorylevel]; $found = true; } foreach ($languages as $key => $lang) { if ($temprow['v_categories_name_' . $categorylevel . '_' . $lang['id']] != '') { $row['v_categories_name_' . $newlevel . '_' . $lang['id']] = $temprow['v_categories_name_' . $categorylevel . '_' . $lang['id']]; $found = true; } } if ($found == true) { $newlevel++; } } // default the manufacturer if ($row['v_manufacturers_id'] != '') { $sql2 = "SELECT manufacturers_name\n FROM " . TABLE_MANUFACTURERS . "\n WHERE manufacturers_id = " . $row['v_manufacturers_id']; $result2 = vam_db_query($sql2); $row2 = vam_db_fetch_array($result2); $row['v_manufacturers_name'] = $row2['manufacturers_name']; } if (EP_MVS_SUPPORT == true) { $result2 = vam_db_query("select vendors_name from " . TABLE_VENDORS . " WHERE vendors_id = " . $row['v_vendor_id']); $row2 = vam_db_fetch_array($result2); $row['v_vendor'] = $row2['vendors_name']; } //elari - //We check the value of tax class and title instead of the id //Then we add the tax to price if EP_PRICE_WITH_TAX is set to true $row_tax_multiplier = vam_get_tax_class_rate($row['v_tax_class_id']); $row['v_tax_class_title'] = vam_get_tax_class_title($row['v_tax_class_id']); if (EP_PRICE_WITH_TAX == true) { $row['v_products_price'] = $row['v_products_price'] + round($row['v_products_price'] * $row_tax_multiplier / 100, EP_PRECISION); } // now create the internal variables that will be used // the $$thisvar is on purpose: it creates a variable named what ever was in $thisvar and sets the value foreach ($default_these as $tkey => $thisvar) { ${$thisvar} = $row[$thisvar]; } $row = vam_db_fetch_array($result); } // this is an important loop. What it does is go thru all the fields in the incoming // file and set the internal vars. Internal vars not set here are either set in the // loop above for existing records, or not set at all (null values) the array values // are handled separatly, although they will set variables in this loop, we won't use them. foreach ($filelayout as $key => $value) { if (!($key == 'v_date_added' && empty($items[$value]))) { ${$key} = $items[$value]; } } //elari... we get the tax_clas_id from the tax_title //on screen will still be displayed the tax_class_title instead of the id.... if (isset($v_tax_class_title)) { $v_tax_class_id = vam_get_tax_title_class_id($v_tax_class_title); } //we check the tax rate of this tax_class_id $row_tax_multiplier = vam_get_tax_class_rate($v_tax_class_id); //And we recalculate price without the included tax... //Since it seems display is made before, the displayed price will still include tax //This is same problem for the tax_clas_id that display tax_class_title if (EP_PRICE_WITH_TAX == true) { $v_products_price = round($v_products_price / (1 + $row_tax_multiplier * 0.01), EP_PRECISION); } // if they give us one category, they give us all categories. convert data structure to a multi-dim array unset($v_categories_name); // default to not set. unset($v_categories_image); // default to not set. foreach ($languages as $key => $lang) { $baselang_id = $lang['id']; break; } if (isset($filelayout['v_categories_name_1_' . $baselang_id])) { $v_categories_name = array(); $v_categories_image = array(); $newlevel = 1; for ($categorylevel = EP_MAX_CATEGORIES; $categorylevel > 0; $categorylevel--) { $found = false; if ($items[$filelayout['v_categories_image_' . $categorylevel]] != '') { $v_categories_image[$newlevel] = $items[$filelayout['v_categories_image_' . $categorylevel]]; $found = true; } foreach ($languages as $key => $lang) { if ($items[$filelayout['v_categories_name_' . $categorylevel . '_' . $lang['id']]] != '') { $v_categories_name[$newlevel][$lang['id']] = $items[$filelayout['v_categories_name_' . $categorylevel . '_' . $lang['id']]]; $found = true; } } if ($found == true) { $newlevel++; } } while ($newlevel < EP_MAX_CATEGORIES + 1) { $v_categories_image[$newlevel] = ''; // default the remaining items to nothing foreach ($languages as $key => $lang) { $v_categories_name[$newlevel][$lang['id']] = ''; // default the remaining items to nothing } $newlevel++; } } if (ltrim(rtrim($v_products_quantity)) == '') { $v_products_quantity = 1; } if (empty($v_date_avail)) { $v_date_avail = 'NULL'; } else { $v_date_avail = "'" . date("Y-m-d H:i:s", strtotime($v_date_avail)) . "'"; } if (empty($v_date_added)) { $v_date_added = "'" . date("Y-m-d H:i:s") . "'"; } else { $v_date_added = "'" . date("Y-m-d H:i:s", strtotime($v_date_added)) . "'"; } // default the stock if they spec'd it or if it's blank if (isset($v_status_current)) { $v_db_status = strval($v_status_current); // default to current value } else { $v_db_status = '1'; // default to active } if (trim($v_status) == EP_TEXT_INACTIVE) { // they told us to deactivate this item $v_db_status = '0'; } elseif (trim($v_status) == EP_TEXT_ACTIVE) { $v_db_status = '1'; } if (EP_INACTIVATE_ZERO_QUANTITIES == true && $v_products_quantity == 0) { // if they said that zero qty products should be deactivated, let's deactivate if the qty is zero $v_db_status = '0'; } if ($v_manufacturer_id == '') { $v_manufacturer_id = "NULL"; } if (trim($v_products_image) == '') { $v_products_image = EP_DEFAULT_IMAGE_PRODUCT; } else { if (USE_EP_IMAGE_MANIPULATOR == 'true') { prepare_image($v_products_image); } else { $v_products_image; } } if (strlen($v_products_model) > EP_MODEL_NUMBER_SIZE) { echo EASY_ERROR_2 . EP_MODEL_NUMBER_SIZE . "<br />" . EASY_ERROR_2A; die; } // OK, we need to convert the manufacturer's name into id's for the database if (isset($v_manufacturers_name) && $v_manufacturers_name != '') { $sql = "SELECT man.manufacturers_id\n FROM " . TABLE_MANUFACTURERS . " as man\n WHERE man.manufacturers_name = '" . vam_db_input($v_manufacturers_name) . "'"; $result = vam_db_query($sql); $row = vam_db_fetch_array($result); if ($row != '') { foreach ($row as $item) { $v_manufacturer_id = $item; } } else { // to add, we need to put stuff in categories and categories_description $sql = "SELECT MAX( manufacturers_id) max FROM " . TABLE_MANUFACTURERS; $result = vam_db_query($sql); $row = vam_db_fetch_array($result); $max_mfg_id = $row['max'] + 1; // default the id if there are no manufacturers yet if (!is_numeric($max_mfg_id)) { $max_mfg_id = 1; } // Uncomment this query if you have an older 2.2 codebase /* $sql = "INSERT INTO ".TABLE_MANUFACTURERS."( manufacturers_id, manufacturers_image ) VALUES ( $max_mfg_id, '".EP_DEFAULT_IMAGE_MANUFACTURER."' )"; */ // Comment this query out if you have an older 2.2 codebase $sql = "INSERT INTO " . TABLE_MANUFACTURERS . "(\n manufacturers_id,\n manufacturers_name,\n manufacturers_image,\n date_added,\n last_modified\n ) VALUES (\n {$max_mfg_id},\n '" . vam_db_input($v_manufacturers_name) . "',\n '" . EP_DEFAULT_IMAGE_MANUFACTURER . "',\n '" . date("Y-m-d H:i:s") . "',\n '" . date("Y-m-d H:i:s") . "'\n )"; $result = vam_db_query($sql); $v_manufacturer_id = $max_mfg_id; $sql = "INSERT INTO " . TABLE_MANUFACTURERS_INFO . "(\n manufacturers_id,\n manufacturers_meta_title,\n manufacturers_meta_description,\n manufacturers_meta_keywords,\n manufacturers_url,\n manufacturers_description,\n languages_id\n ) VALUES (\n {$max_mfg_id},\n '',\n '',\n '',\n '',\n '',\n '" . EP_DEFAULT_LANGUAGE_ID . "'\n )"; $result = vam_db_query($sql); } } // if the categories names are set then try to update them foreach ($languages as $key => $lang) { $baselang_id = $lang['id']; break; } if (isset($filelayout['v_categories_name_1_' . $baselang_id])) { // start from the highest possible category and work our way down from the parent $v_categories_id = 0; $theparent_id = 0; for ($categorylevel = EP_MAX_CATEGORIES + 1; $categorylevel > 0; $categorylevel--) { //foreach ($languages as $key => $lang){ $thiscategoryname = $v_categories_name[$categorylevel][$baselang_id]; if ($thiscategoryname != '') { // we found a category name in this field, look for database entry $sql = "SELECT cat.categories_id\n FROM " . TABLE_CATEGORIES . " as cat, \n " . TABLE_CATEGORIES_DESCRIPTION . " as des\n WHERE\n cat.categories_id = des.categories_id AND\n des.language_id = " . $baselang_id . " AND\n cat.parent_id = " . $theparent_id . " AND\n des.categories_name like '" . vam_db_input($thiscategoryname) . "'"; $result = vam_db_query($sql); $row = vam_db_fetch_array($result); if ($row != '') { // we have an existing category, update image and date foreach ($row as $item) { $thiscategoryid = $item; } $cat_image = ''; if (!empty($v_categories_image[$categorylevel])) { $cat_image = "categories_image='" . vam_db_input($v_categories_image[$categorylevel]) . "', "; } elseif (isset($filelayout['v_categories_image_' . $categorylevel])) { $cat_image = "categories_image='', "; } $query = "UPDATE " . TABLE_CATEGORIES . "\n SET \n {$cat_image}\n last_modified = '" . date("Y-m-d H:i:s") . "'\n WHERE \n categories_id = '" . $row['categories_id'] . "'\n LIMIT 1"; vam_db_query($query); } else { // to add, we need to put stuff in categories and categories_description $sql = "SELECT MAX( categories_id) max FROM " . TABLE_CATEGORIES; $result = vam_db_query($sql); $row = vam_db_fetch_array($result); $max_category_id = $row['max'] + 1; if (!is_numeric($max_category_id)) { $max_category_id = 1; } $sql = "INSERT INTO " . TABLE_CATEGORIES . " (\n categories_id,\n parent_id,\n categories_image,\n sort_order,\n date_added,\n last_modified\n ) VALUES (\n {$max_category_id},\n {$theparent_id},\n '" . vam_db_input($v_categories_image[$categorylevel]) . "',\n 0,\n '" . date("Y-m-d H:i:s") . "',\n '" . date("Y-m-d H:i:s") . "'\n )"; $result = vam_db_query($sql); foreach ($languages as $key => $lang) { $sql = "INSERT INTO " . TABLE_CATEGORIES_DESCRIPTION . " (\n categories_id,\n language_id,\n categories_name\n ) VALUES (\n {$max_category_id},\n '" . $lang['id'] . "',\n '" . (!empty($v_categories_name[$categorylevel][$lang['id']]) ? vam_db_input($v_categories_name[$categorylevel][$lang['id']]) : '') . "'\n )"; vam_db_query($sql); } $thiscategoryid = $max_category_id; } // the current catid is the next level's parent $theparent_id = $thiscategoryid; $v_categories_id = $thiscategoryid; // keep setting this, we need the lowest level category ID later } // } } } if ($v_products_model != "") { // products_model exists! foreach ($items as $tkey => $item) { print_el($item); } // find the vendor id from the name imported if (EP_MVS_SUPPORT == true) { $vend_result = vam_db_query("SELECT vendors_id FROM " . TABLE_VENDORS . " WHERE vendors_name = '" . $v_vendor . "'"); $vend_row = vam_db_fetch_array($vend_result); $v_vendor_id = $vend_row['vendors_id']; } // process the PRODUCTS table $result = vam_db_query("SELECT products_id FROM " . TABLE_PRODUCTS . " WHERE (products_model = '" . $v_products_model . "')"); // First we check to see if this is a product in the current db. if (vam_db_num_rows($result) == 0) { // insert into products echo EASY_LABEL_NEW_PRODUCT; // ///////////////////////////////////////////////////////////////////// // // Start: Support for other contributions // // ///////////////////////////////////////////////////////////////////// $ep_additional_fields = ''; $ep_additional_data = ''; if (EP_ADDITIONAL_IMAGES == true) { $ep_additional_fields .= 'products_image_description,'; $ep_additional_data .= "'" . vam_db_input($v_products_image_description) . "',"; } foreach ($custom_fields[TABLE_PRODUCTS] as $key => $name) { $ep_additional_fields .= $key . ','; } foreach ($custom_fields[TABLE_PRODUCTS] as $key => $name) { $tmp_var = 'v_' . $key; $ep_additional_data .= "'" . ${$tmp_var} . "',"; } if (EP_MORE_PICS_6_SUPPORT == true) { $ep_additional_fields .= 'products_subimage1,products_subimage2,products_subimage3,products_subimage4,products_subimage5,products_subimage6,'; $ep_additional_data .= "'{$v_products_subimage1}','{$v_products_subimage2}','{$v_products_subimage3}','{$v_products_subimage4}','{$v_products_subimage5}','{$v_products_subimage6}',"; } if (EP_UNLIMITED_IMAGES == true) { $ep_additional_fields .= 'products_image_array,'; $ep_additional_data .= "'" . serialize(explode("|", $v_products_image_array)) . "',"; } if (EP_ULTRPICS_SUPPORT == true) { $ep_additional_fields .= 'products_image_med,products_image_lrg,products_image_sm_1,products_image_xl_1,products_image_sm_2,products_image_xl_2,products_image_sm_3,products_image_xl_3,products_image_sm_4,products_image_xl_4,products_image_sm_5,products_image_xl_5,products_image_sm_6,products_image_xl_6,'; $ep_additional_data .= "'{$v_products_image_med}','{$v_products_image_lrg}','{$v_products_image_sm_1}','{$v_products_image_xl_1}','{$v_products_image_sm_2}','{$v_products_image_xl_2}','{$v_products_image_sm_3}','{$v_products_image_xl_3}','{$v_products_image_sm_4}','{$v_products_image_xl_4}','{$v_products_image_sm_5}','{$v_products_image_xl_5}','{$v_products_image_sm_6}','{$v_products_image_xl_6}',"; } if (EP_PDF_UPLOAD_SUPPORT == true) { $ep_additional_fields .= 'products_pdfupload,products_fileupload,'; $ep_additional_data .= "'{$v_products_pdfupload}','{$v_products_fileupload}',"; } if (EP_MVS_SUPPORT == true) { $ep_additional_fields .= 'vendors_id,'; $ep_additional_data .= "'{$v_vendor_id}',"; } // ///////////////////////////////////////////////////////////////////// // End: Support for other contributions // ///////////////////////////////////////////////////////////////////// $query = "INSERT INTO " . TABLE_PRODUCTS . " (\n products_image,\n {$ep_additional_fields}\n products_model,\n products_price,\n products_status,\n products_last_modified,\n products_date_added,\n products_date_available,\n products_tax_class_id,\n products_weight,\n products_quantity,\n manufacturers_id )\n VALUES (\n " . (!empty($v_products_image) ? "'" . $v_products_image . "'" : 'NULL') . ",\n {$ep_additional_data}\n '{$v_products_model}',\n '{$v_products_price}',\n '{$v_db_status}',\n '" . date("Y-m-d H:i:s") . "',\n " . $v_date_added . ",\n " . $v_date_avail . ",\n '{$v_tax_class_id}',\n '{$v_products_weight}',\n '{$v_products_quantity}',\n " . (!empty($v_manufacturer_id) ? $v_manufacturer_id : 'NULL') . ")\n "; $result = vam_db_query($query); $v_products_id = vam_db_insert_id(); } else { // existing product(s), get the id from the query // and update the product data while ($row = vam_db_fetch_array($result)) { $v_products_id = $row['products_id']; echo EASY_LABEL_UPDATED; // ///////////////////////////////////////////////////////////////////// // // Start: Support for other contributions // // ///////////////////////////////////////////////////////////////////// $ep_additional_updates = ''; foreach ($custom_fields[TABLE_PRODUCTS] as $key => $name) { $tmp_var = 'v_' . $key; $ep_additional_updates .= $key . "='" . ${$tmp_var} . "',"; } if (EP_ADDITIONAL_IMAGES == true && isset($v_products_image_description)) { $ep_additional_updates .= "products_image_description='" . vam_db_input($v_products_image_description) . "',"; } if (EP_MORE_PICS_6_SUPPORT == true) { $ep_additional_updates .= "products_subimage1='{$v_products_subimage1}',products_subimage2='{$v_products_subimage2}',products_subimage3='{$v_products_subimage3}',products_subimage4='{$v_products_subimage4}',products_subimage5='{$v_products_subimage5}',products_subimage6='{$v_products_subimage6}',"; } if (EP_UNLIMITED_IMAGES == true) { $ep_additional_updates .= "products_image_array='" . serialize(explode("|", $v_products_image_array)) . "',"; } if (EP_ULTRPICS_SUPPORT == true) { $ep_additional_updates .= "products_image_med='{$v_products_image_med}',products_image_lrg='{$v_products_image_lrg}',products_image_sm_1='{$v_products_image_sm_1}',products_image_xl_1='{$v_products_image_xl_1}',products_image_sm_2='{$v_products_image_sm_2}',products_image_xl_2='{$v_products_image_xl_2}',products_image_sm_3='{$v_products_image_sm_3}',products_image_xl_3='{$v_products_image_xl_3}',products_image_sm_4='{$v_products_image_sm_4}',products_image_xl_4='{$v_products_image_xl_4}',products_image_sm_5='{$v_products_image_sm_5}',products_image_xl_5='{$v_products_image_xl_5}',products_image_sm_6='{$v_products_image_sm_6}',products_image_xl_6='{$v_products_image_xl_6}',"; } if (EP_PDF_UPLOAD_SUPPORT == true) { $ep_additional_updates .= "products_pdfupload='{$v_products_pdfupload}',products_fileupload='{$v_products_fileupload}',"; } if (EP_MVS_SUPPORT == true) { $ep_additional_updates .= "vendors_id='{$v_vendor_id}',"; } // ///////////////////////////////////////////////////////////////////// // End: Support for other contributions // ///////////////////////////////////////////////////////////////////// // only include the products image if it has been included in the spreadsheet $tmp_products_image_update = ''; if (isset($v_products_image)) { $tmp_products_image_update = "products_image=" . (!empty($v_products_image) ? "'" . $v_products_image . "'" : 'NULL') . ", \n\t\t\t\t\t\t\t\t\t\t "; if (EP_ADDITIONAL_IMAGES == true && isset($filelayout['v_products_image'])) { $tmp_products_image_update .= "products_image_med=NULL, \n products_image_pop=NULL, "; } } $query = "UPDATE " . TABLE_PRODUCTS . "\n SET\n products_price='{$v_products_price}', \n {$tmp_products_image_update} \n {$ep_additional_updates}\n products_weight='{$v_products_weight}', \n products_tax_class_id='{$v_tax_class_id}', \n products_date_available=" . $v_date_avail . ", \n products_date_added=" . $v_date_added . ", \n products_last_modified='" . date("Y-m-d H:i:s") . "', \n products_quantity = {$v_products_quantity}, \n manufacturers_id = " . (!empty($v_manufacturer_id) ? $v_manufacturer_id : 'NULL') . ", \n products_status = {$v_db_status}\n WHERE\n (products_id = {$v_products_id})\n LIMIT 1"; vam_db_query($query); } } if (isset($v_products_specials_price)) { if (EP_SPPC_SUPPORT == true) { $SPPC_extra_query = ' and customers_group_id = 0'; } else { $SPPC_extra_query = ''; } $result = vam_db_query('select * from ' . TABLE_SPECIALS . ' WHERE products_id = ' . $v_products_id . $SPPC_extra_query); if ($v_products_specials_price == '') { $result = vam_db_query('DELETE FROM ' . TABLE_SPECIALS . ' WHERE products_id = ' . $v_products_id . $SPPC_extra_query); if (EP_SPPC_SUPPORT == true) { $result = vam_db_query('DELETE FROM specials_retail_prices WHERE products_id = ' . $v_products_id); } } else { if ($specials = vam_db_fetch_array($result)) { $sql_data_array = array('products_id' => $v_products_id, 'specials_new_products_price' => $v_products_specials_price, 'specials_last_modified' => 'now()'); vam_db_perform(TABLE_SPECIALS, $sql_data_array, 'update', 'specials_id = ' . $specials['specials_id']); if (EP_SPPC_SUPPORT == true) { $sql_data_array = array('products_id' => $v_products_id, 'specials_new_products_price' => $v_products_specials_price); vam_db_perform('specials_retail_prices', $sql_data_array, 'update', 'products_id = ' . $v_products_id); } } else { $sql_data_array = array('products_id' => $v_products_id, 'specials_new_products_price' => $v_products_specials_price, 'specials_date_added' => 'now()', 'status' => '1'); if (EP_SPPC_SUPPORT == true) { $sql_data_array = array_merge($sql_data_array, array('customers_group_id' => '0')); } vam_db_perform(TABLE_SPECIALS, $sql_data_array, 'insert'); if (EP_SPPC_SUPPORT == true) { $sql_data_array = array('products_id' => $v_products_id, 'specials_new_products_price' => $v_products_specials_price, 'status' => '1', 'customers_group_id' => '0'); vam_db_perform('specials_retail_prices', $sql_data_array, 'insert'); } } } } if (EP_ADDITIONAL_IMAGES == true) { if (isset($filelayout['v_products_image_2'])) { vam_db_query("delete from " . TABLE_ADDITIONAL_IMAGES . " where products_id = '" . (int) $v_products_id . "'"); for ($i = 2; $i <= EP_ADDITIONAL_IMAGES_MAX + 1; $i++) { $ai_description_var = 'v_products_image_description_' . $i; $ai_image_var = 'v_products_image_' . $i; if (!empty(${$ai_image_var}) || !empty(${$ai_description_var})) { vam_db_query("insert into " . TABLE_ADDITIONAL_IMAGES . " (products_id, images_description, thumb_images) values ('" . (int) $v_products_id . "', '" . vam_db_input(${$ai_description_var}) . "', '" . vam_db_input(${$ai_image_var}) . "')"); } } } } // process the PRODUCTS_DESCRIPTION table foreach ($languages as $tkey => $lang) { $doit = false; foreach ($custom_fields[TABLE_PRODUCTS_DESCRIPTION] as $key => $name) { if (isset($filelayout['v_' . $key . '_' . $lang['id']])) { $doit = true; } } if (isset($filelayout['v_products_name_' . $lang['id']]) || isset($filelayout['v_products_description_' . $lang['id']]) || isset($filelayout['v_products_url_' . $lang['id']]) || isset($filelayout['v_products_meta_title_' . $lang['id']]) || $doit == true) { $sql = "SELECT * FROM " . TABLE_PRODUCTS_DESCRIPTION . " WHERE\n products_id = {$v_products_id} AND\n language_id = " . $lang['id']; $result = vam_db_query($sql); $products_var = 'v_products_name_' . $lang['id']; $description_var = 'v_products_description_' . $lang['id']; $url_var = 'v_products_url_' . $lang['id']; // ///////////////////////////////////////////////////////////////////// // // Start: Support for other contributions // // ///////////////////////////////////////////////////////////////////// $ep_additional_updates = ''; $ep_additional_fields = ''; $ep_additional_data = ''; foreach ($custom_fields[TABLE_PRODUCTS_DESCRIPTION] as $key => $name) { $tmp_var = 'v_' . $key . '_' . $lang['id']; $ep_additional_updates .= $key . " = '" . vam_db_input(${$tmp_var}) . "',"; $ep_additional_fields .= $key . ","; $ep_additional_data .= "'" . vam_db_input(${$tmp_var}) . "',"; } // header tags controller support if (isset($filelayout['v_products_meta_title_' . $lang['id']])) { $meta_title_var = 'v_products_meta_title_' . $lang['id']; $meta_description_var = 'v_products_meta_description_' . $lang['id']; $meta_keywords_var = 'v_products_meta_keywords_' . $lang['id']; $ep_additional_updates .= "products_meta_title = '" . vam_db_input(${$meta_title_var}) . "', products_meta_description = '" . vam_db_input(${$meta_description_var}) . "', products_meta_keywords = '" . vam_db_input(${$meta_keywords_var}) . "',"; $ep_additional_fields .= "products_meta_title,products_meta_description,products_meta_keywords,"; $ep_additional_data .= "'" . vam_db_input(${$meta_title_var}) . "','" . vam_db_input(${$meta_description_var}) . "','" . vam_db_input(${$meta_keywords_var}) . "',"; } // end: header tags controller support // ///////////////////////////////////////////////////////////////////// // End: Support for other contributions // ///////////////////////////////////////////////////////////////////// // existing product? if (vam_db_num_rows($result) > 0) { // already in the description, let's just update it $sql = "UPDATE " . TABLE_PRODUCTS_DESCRIPTION . " \n SET\n products_name='" . vam_db_input(${$products_var}) . "',\n products_description='" . vam_db_input(${$description_var}) . "',\n {$ep_additional_updates}\n products_url='" . ${$url_var} . "'\n WHERE\n products_id = '{$v_products_id}' AND\n language_id = '" . $lang['id'] . "'\n LIMIT 1"; $result = vam_db_query($sql); } else { // nope, this is a new product description $result = vam_db_query($sql); $sql = "INSERT INTO " . TABLE_PRODUCTS_DESCRIPTION . "\n ( products_id,\n language_id,\n products_name,\n products_description,\n {$ep_additional_fields}\n products_url\n )\n VALUES (\n '" . $v_products_id . "',\n " . $lang['id'] . ",\n '" . vam_db_input(${$products_var}) . "',\n '" . vam_db_input(${$description_var}) . "',\n {$ep_additional_data}\n '" . ${$url_var} . "'\n )"; $result = vam_db_query($sql); } } } if (isset($v_categories_id)) { //find out if this product is listed in the category given $result_incategory = vam_db_query('SELECT ' . TABLE_PRODUCTS_TO_CATEGORIES . '.products_id, ' . TABLE_PRODUCTS_TO_CATEGORIES . '.categories_id FROM ' . TABLE_PRODUCTS_TO_CATEGORIES . ' WHERE ' . TABLE_PRODUCTS_TO_CATEGORIES . '.products_id=' . $v_products_id . ' AND ' . TABLE_PRODUCTS_TO_CATEGORIES . '.categories_id=' . $v_categories_id); if (vam_db_num_rows($result_incategory) == 0) { // nope, this is a new category for this product $res1 = vam_db_query('INSERT INTO ' . TABLE_PRODUCTS_TO_CATEGORIES . ' (products_id, categories_id) VALUES ("' . $v_products_id . '", "' . $v_categories_id . '")'); } else { // already in this category, nothing to do! } } // this is for the cross sell contribution if (isset($v_cross_sell)) { vam_db_query("delete from " . TABLE_PRODUCTS_XSELL . " where products_id = " . $v_products_id . " or xsell_id = " . $v_products_id . ""); if (!empty($v_cross_sell)) { $xsells_array = explode(',', $v_cross_sell); foreach ($xsells_array as $xs_key => $xs_model) { $cross_sell_sql = "select products_id from " . TABLE_PRODUCTS . " where products_model = '" . trim($xs_model) . "' limit 1"; $cross_sell_result = vam_db_query($cross_sell_sql); $cross_sell_row = vam_db_fetch_array($cross_sell_result); vam_db_query("insert into " . TABLE_PRODUCTS_XSELL . " (products_id, xsell_id, sort_order) \n values ( " . $v_products_id . ", " . $cross_sell_row['products_id'] . ", 1)"); vam_db_query("insert into " . TABLE_PRODUCTS_XSELL . " (products_id, xsell_id, sort_order) \n\t\t\t\t\t\t\t\t values ( " . $cross_sell_row['products_id'] . ", " . $v_products_id . ", 1)"); } } } // for the separate prices per customer (SPPC) module $ll = 1; if (isset($v_customer_price_1)) { if ($v_customer_group_id_1 == '' and $v_customer_price_1 != '') { echo "<font color=red>ERROR - v_customer_group_id and v_customer_price must occur in pairs</font>"; die; } // they spec'd some prices, so clear all existing entries $result = vam_db_query(' DELETE FROM ' . TABLE_PRODUCTS_GROUPS . ' WHERE products_id = ' . $v_products_id); // and insert the new record if ($v_customer_price_1 != '') { $result = vam_db_query(' INSERT INTO ' . TABLE_PRODUCTS_GROUPS . ' VALUES ( ' . $v_customer_group_id_1 . ', ' . $v_customer_price_1 . ', ' . $v_products_id . ' )'); } if ($v_customer_price_2 != '') { $result = vam_db_query(' INSERT INTO ' . TABLE_PRODUCTS_GROUPS . ' VALUES ( ' . $v_customer_group_id_2 . ', ' . $v_customer_price_2 . ', ' . $v_products_id . ' )'); } if ($v_customer_price_3 != '') { $result = vam_db_query(' INSERT INTO ' . TABLE_PRODUCTS_GROUPS . ' VALUES ( ' . $v_customer_group_id_3 . ', ' . $v_customer_price_3 . ', ' . $v_products_id . ' )'); } if ($v_customer_price_4 != '') { $result = vam_db_query(' INSERT INTO ' . TABLE_PRODUCTS_GROUPS . ' VALUES ( ' . $v_customer_group_id_4 . ', ' . $v_customer_price_4 . ', ' . $v_products_id . ' )'); } if (isset($v_customer_specials_price_1)) { $result = vam_db_query('select * from ' . TABLE_SPECIALS . ' WHERE products_id = ' . $v_products_id . ' and customers_group_id = 1'); if ($v_customer_specials_price_1 == '') { $result = vam_db_query('DELETE FROM ' . TABLE_SPECIALS . ' WHERE products_id = ' . $v_products_id . ' and customers_group_id = 1'); } else { if ($specials = vam_db_fetch_array($result)) { $sql_data_array = array('products_id' => $v_products_id, 'specials_new_products_price' => $v_customer_specials_price_1, 'specials_last_modified' => 'now()'); vam_db_perform(TABLE_SPECIALS, $sql_data_array, 'update', 'specials_id = ' . $specials['specials_id']); } else { $sql_data_array = array('products_id' => $v_products_id, 'specials_new_products_price' => $v_customer_specials_price_1, 'specials_date_added' => 'now()', 'status' => '1', 'customers_group_id' => '1'); vam_db_perform(TABLE_SPECIALS, $sql_data_array, 'insert'); } } } } // end: separate prices per customer (SPPC) module // VJ product attribs begin if (isset($v_attribute_options_id_1)) { $attribute_rows = 1; // master row count // product options count $attribute_options_count = 1; $v_attribute_options_id_var = 'v_attribute_options_id_' . $attribute_options_count; while (isset(${$v_attribute_options_id_var}) && !empty(${$v_attribute_options_id_var})) { // remove product attribute options linked to this product before proceeding further // this is useful for removing attributes linked to a product $attributes_clean_query = "delete from " . TABLE_PRODUCTS_ATTRIBUTES . " where products_id = '" . (int) $v_products_id . "' and options_id = '" . (int) ${$v_attribute_options_id_var} . "'"; vam_db_query($attributes_clean_query); $attribute_options_query = "select products_options_name from " . TABLE_PRODUCTS_OPTIONS . " where products_options_id = '" . (int) ${$v_attribute_options_id_var} . "'"; $attribute_options_values = vam_db_query($attribute_options_query); // option table update begin if ($attribute_rows == 1) { // insert into options table if no option exists if (vam_db_num_rows($attribute_options_values) <= 0) { for ($i = 0, $n = sizeof($languages); $i < $n; $i++) { $lid = $languages[$i]['id']; $v_attribute_options_name_var = 'v_attribute_options_name_' . $attribute_options_count . '_' . $lid; if (isset(${$v_attribute_options_name_var})) { $attribute_options_insert_query = "insert into " . TABLE_PRODUCTS_OPTIONS . " (products_options_id, language_id, products_options_name) values ('" . (int) ${$v_attribute_options_id_var} . "', '" . (int) $lid . "', '" . ${$v_attribute_options_name_var} . "')"; $attribute_options_insert = vam_db_query($attribute_options_insert_query); } } } else { // update options table, if options already exists for ($i = 0, $n = sizeof($languages); $i < $n; $i++) { $lid = $languages[$i]['id']; $v_attribute_options_name_var = 'v_attribute_options_name_' . $attribute_options_count . '_' . $lid; if (isset(${$v_attribute_options_name_var})) { $attribute_options_update_lang_query = "select products_options_name from " . TABLE_PRODUCTS_OPTIONS . " where products_options_id = '" . (int) ${$v_attribute_options_id_var} . "' and language_id ='" . (int) $lid . "'"; $attribute_options_update_lang_values = vam_db_query($attribute_options_update_lang_query); // if option name doesn't exist for particular language, insert value if (vam_db_num_rows($attribute_options_update_lang_values) <= 0) { $attribute_options_lang_insert_query = "insert into " . TABLE_PRODUCTS_OPTIONS . " (products_options_id, language_id, products_options_name) values ('" . (int) ${$v_attribute_options_id_var} . "', '" . (int) $lid . "', '" . ${$v_attribute_options_name_var} . "')"; $attribute_options_lang_insert = vam_db_query($attribute_options_lang_insert_query); } else { // if option name exists for particular language, update table $attribute_options_update_query = "update " . TABLE_PRODUCTS_OPTIONS . " set products_options_name = '" . ${$v_attribute_options_name_var} . "' where products_options_id ='" . (int) ${$v_attribute_options_id_var} . "' and language_id = '" . (int) $lid . "'"; $attribute_options_update = vam_db_query($attribute_options_update_query); } } } } } // option table update end // product option values count $attribute_values_count = 1; $v_attribute_values_id_var = 'v_attribute_values_id_' . $attribute_options_count . '_' . $attribute_values_count; while (isset(${$v_attribute_values_id_var}) && !empty(${$v_attribute_values_id_var})) { $attribute_values_query = "select products_options_values_name from " . TABLE_PRODUCTS_OPTIONS_VALUES . " where products_options_values_id = '" . (int) ${$v_attribute_values_id_var} . "'"; $attribute_values_values = vam_db_query($attribute_values_query); // options_values table update begin if ($attribute_rows == 1) { // insert into options_values table if no option exists if (vam_db_num_rows($attribute_values_values) <= 0) { for ($i = 0, $n = sizeof($languages); $i < $n; $i++) { $lid = $languages[$i]['id']; $v_attribute_values_name_var = 'v_attribute_values_name_' . $attribute_options_count . '_' . $attribute_values_count . '_' . $lid; if (isset(${$v_attribute_values_name_var})) { $attribute_values_insert_query = "insert into " . TABLE_PRODUCTS_OPTIONS_VALUES . " (products_options_values_id, language_id, products_options_values_name) values ('" . (int) ${$v_attribute_values_id_var} . "', '" . (int) $lid . "', '" . vam_db_input(${$v_attribute_values_name_var}) . "')"; $attribute_values_insert = vam_db_query($attribute_values_insert_query); } } // insert values to pov2po table $attribute_values_pov2po_query = "insert into " . TABLE_PRODUCTS_OPTIONS_VALUES_TO_PRODUCTS_OPTIONS . " (products_options_id, products_options_values_id) values ('" . (int) ${$v_attribute_options_id_var} . "', '" . (int) ${$v_attribute_values_id_var} . "')"; $attribute_values_pov2po = vam_db_query($attribute_values_pov2po_query); } else { // update options table, if options already exists for ($i = 0, $n = sizeof($languages); $i < $n; $i++) { $lid = $languages[$i]['id']; $v_attribute_values_name_var = 'v_attribute_values_name_' . $attribute_options_count . '_' . $attribute_values_count . '_' . $lid; if (isset(${$v_attribute_values_name_var})) { $attribute_values_update_lang_query = "select products_options_values_name from " . TABLE_PRODUCTS_OPTIONS_VALUES . " where products_options_values_id = '" . (int) ${$v_attribute_values_id_var} . "' and language_id ='" . (int) $lid . "'"; $attribute_values_update_lang_values = vam_db_query($attribute_values_update_lang_query); // if options_values name doesn't exist for particular language, insert value if (vam_db_num_rows($attribute_values_update_lang_values) <= 0) { $attribute_values_lang_insert_query = "insert into " . TABLE_PRODUCTS_OPTIONS_VALUES . " (products_options_values_id, language_id, products_options_values_name) values ('" . (int) ${$v_attribute_values_id_var} . "', '" . (int) $lid . "', '" . vam_db_input(${$v_attribute_values_name_var}) . "')"; $attribute_values_lang_insert = vam_db_query($attribute_values_lang_insert_query); } else { // if options_values name exists for particular language, update table $attribute_values_update_query = "update " . TABLE_PRODUCTS_OPTIONS_VALUES . " set products_options_values_name = '" . vam_db_input(${$v_attribute_values_name_var}) . "' where products_options_values_id ='" . (int) ${$v_attribute_values_id_var} . "' and language_id = '" . (int) $lid . "'"; $attribute_values_update = vam_db_query($attribute_values_update_query); } } } } } // options_values table update end // options_values price update begin $v_attribute_values_price_var = 'v_attribute_values_price_' . $attribute_options_count . '_' . $attribute_values_count; $v_attribute_values_model = 'v_attribute_values_model_' . $attribute_options_count . '_' . $attribute_values_count; $v_attribute_values_stock = 'v_attribute_values_stock_' . $attribute_options_count . '_' . $attribute_values_count; $v_attribute_values_weight = 'v_attribute_values_weight_' . $attribute_options_count . '_' . $attribute_values_count; $v_attribute_values_sort = 'v_attribute_values_sort_' . $attribute_options_count . '_' . $attribute_values_count; if (isset(${$v_attribute_values_price_var}) && ${$v_attribute_values_price_var} != '') { $attribute_prices_query = "select options_values_price, price_prefix, attributes_model, attributes_stock, options_values_weight, weight_prefix, sortorder from " . TABLE_PRODUCTS_ATTRIBUTES . " where products_id = '" . (int) $v_products_id . "' and options_id ='" . (int) ${$v_attribute_options_id_var} . "' and options_values_id = '" . (int) ${$v_attribute_values_id_var} . "'"; $attribute_prices_values = vam_db_query($attribute_prices_query); $attribute_values_price_prefix = ${$v_attribute_values_price_var} < 0 ? '-' : '+'; $attribute_values_weight_prefix = ${$v_attribute_values_weight} < 0 ? '-' : '+'; // if negative, remove the negative sign for storing since the prefix is stored in another field. if (${$v_attribute_values_price_var} < 0) { ${$v_attribute_values_price_var} = strval(-(double) ${$v_attribute_values_price_var}); } // options_values_prices table update begin // insert into options_values_prices table if no price exists if (vam_db_num_rows($attribute_prices_values) <= 0) { $attribute_prices_insert_query = "insert into " . TABLE_PRODUCTS_ATTRIBUTES . " (products_id, options_id, options_values_id, options_values_price, price_prefix, attributes_model, attributes_stock, options_values_weight, weight_prefix, sortorder) values ('" . (int) $v_products_id . "', '" . (int) ${$v_attribute_options_id_var} . "', '" . (int) ${$v_attribute_values_id_var} . "', '" . (double) ${$v_attribute_values_price_var} . "', '" . $attribute_values_price_prefix . "', '" . ${$v_attribute_values_model} . "', '" . ${$v_attribute_values_stock} . "', '" . (double) ${$v_attribute_values_weight} . "', '" . ${$v_attribute_values_weight_prefix} . "', '" . ${$v_attribute_values_sort} . "')"; $attribute_prices_insert = vam_db_query($attribute_prices_insert_query); } else { // update options table, if options already exists $attribute_prices_update_query = "update " . TABLE_PRODUCTS_ATTRIBUTES . " set options_values_price = '" . ${$v_attribute_values_price_var} . "', price_prefix = '" . $attribute_values_price_prefix . "', set attributes_model = '" . ${$v_attribute_values_model} . "', set attributes_stock = '" . ${$v_attribute_values_stock} . "', set options_values_weight = '" . ${$v_attribute_values_weight} . "', set weight_prefix = '" . ${$v_attribute_values_weight_prefix} . "', set sortorder = '" . ${$v_attribute_values_sort} . "' where products_id = '" . (int) $v_products_id . "' and options_id = '" . (int) ${$v_attribute_options_id_var} . "' and options_values_id ='" . (int) ${$v_attribute_values_id_var} . "'"; $attribute_prices_update = vam_db_query($attribute_prices_update_query); } } // options_values price update end $attribute_values_count++; $v_attribute_values_id_var = 'v_attribute_values_id_' . $attribute_options_count . '_' . $attribute_values_count; } $attribute_options_count++; $v_attribute_options_id_var = 'v_attribute_options_id_' . $attribute_options_count; } $attribute_rows++; } // VJ product attribs end // BOF mo_image for ($i = 0; $i < MO_PICS; $i++) { if (isset($filelayout['v_mo_image_' . ($i + 1)])) { // echo '<pre>';var_dump($items[$filelayout['v_mo_image_'.($i+1)]]);echo '</pre>'; if ($items[$filelayout['v_mo_image_' . ($i + 1)]] != "") { $items[$filelayout['v_mo_image_' . ($i + 1)]]; if (USE_EP_IMAGE_MANIPULATOR == 'true') { prepare_image($items[$filelayout['v_mo_image_' . ($i + 1)]]); } else { $items[$filelayout['v_mo_image_' . ($i + 1)]]; } } $check_query = vam_db_query("select image_id, image_name from " . TABLE_PRODUCTS_IMAGES . " where products_id='" . (int) $v_products_id . "' and image_nr='" . ($i + 1) . "'"); if (vam_db_num_rows($check_query) <= 0) { if ($items[$filelayout['v_mo_image_' . ($i + 1)]] != "") { vam_db_query("insert into " . TABLE_PRODUCTS_IMAGES . " (products_id, image_nr, image_name) values ('" . (int) $v_products_id . "', '" . ($i + 1) . "', '" . $items[$filelayout['v_mo_image_' . ($i + 1)]] . "')"); } } else { $check = vam_db_fetch_array($check_query); if ($items[$filelayout['v_mo_image_' . ($i + 1)]] == "") { vam_db_query("delete from " . TABLE_PRODUCTS_IMAGES . " where image_id='" . $check['image_id'] . "'"); } elseif ($items[$filelayout['v_mo_image_' . ($i + 1)]] != $check['image_name']) { vam_db_query("update " . TABLE_PRODUCTS_IMAGES . " set image_name='" . $items[$filelayout['v_mo_image_' . ($i + 1)]] . "' where image_id='" . $check['image_id'] . "'"); } } } } // EOF mo_image } else { // this record was missing the product_model echo "<p class=smallText>" . EASY_LABEL_TEXT_NO_MODEL; foreach ($items as $tkey => $item) { print_el($item); } echo "<br /><br /></p>"; } // end of row insertion code } // EP for product extra fields Contrib by minhmaster DEVSOFTVN ========== } // end (EP for product extra fields Contrib by minhmt DEVSOFTVN) ============ }