function xtc_get_products_stock($products_id) { $products_id = xtc_get_prid($products_id); $stock_query = xtc_db_query("select products_quantity from " . TABLE_PRODUCTS . " where products_id = '" . xtc_db_input((int) $products_id) . "'"); $stock_values = xtc_db_fetch_array($stock_query); return $stock_values['products_quantity']; }
function xtc_get_tax_description($class_id, $country_id = -1, $zone_id = -1) { if ($country_id == -1 && $zone_id == -1) { if (!isset($_SESSION['customer_id'])) { $country_id = STORE_COUNTRY; $zone_id = STORE_ZONE; } else { $country_id = $_SESSION['customer_country_id']; $zone_id = $_SESSION['customer_zone_id']; } } else { $country_id = $country_id; $zone_id = $zone_id; } $tax_query = xtDBquery("select tax_description from " . TABLE_TAX_RATES . " tr left join " . TABLE_ZONES_TO_GEO_ZONES . " za on (tr.tax_zone_id = za.geo_zone_id) left join " . TABLE_GEO_ZONES . " tz on (tz.geo_zone_id = tr.tax_zone_id) where (za.zone_country_id is null or za.zone_country_id = '0' or za.zone_country_id = '" . xtc_db_input((int) $country_id) . "') and (za.zone_id is null or za.zone_id = '0' or za.zone_id = '" . xtc_db_input((int) $zone_id) . "') and tr.tax_class_id = '" . xtc_db_input((int) $class_id) . "' order by tr.tax_priority"); if (xtc_db_num_rows($tax_query, true)) { $tax_description = ''; while ($tax = xtc_db_fetch_array($tax_query, true)) { $tax_description .= $tax['tax_description'] . ' + '; } $tax_description = substr($tax_description, 0, -3); return $tax_description; } else { return TEXT_UNKNOWN_TAX_RATE; } }
function xtc_address_label($customers_id, $address_id = 1, $html = false, $boln = '', $eoln = "\n") { $address_query = xtc_db_query("select entry_firstname as firstname, entry_lastname as lastname, entry_company as company, entry_street_address as street_address, entry_suburb as suburb, entry_city as city, entry_postcode as postcode, entry_state as state, entry_zone_id as zone_id, entry_country_id as country_id from " . TABLE_ADDRESS_BOOK . " where customers_id = '" . xtc_db_input((int) $customers_id) . "' and address_book_id = '" . xtc_db_input((int) $address_id) . "'"); $address = xtc_db_fetch_array($address_query); $format_id = xtc_get_address_format_id($address['country_id']); return xtc_address_format($format_id, $address, $html, $boln, $eoln); }
function xtc_oe_customer_infos($customers_id) { $customer_query = xtc_db_query("select a.entry_country_id, a.entry_zone_id from " . TABLE_CUSTOMERS . " c, " . TABLE_ADDRESS_BOOK . " a where c.customers_id = '" . xtc_db_input((int) $customers_id) . "' and c.customers_id = a.customers_id and c.customers_default_address_id = a.address_book_id"); $customer = xtc_db_fetch_array($customer_query); $customer_info_array = array('country_id' => $customer['entry_country_id'], 'zone_id' => $customer['entry_zone_id']); return $customer_info_array; }
function xtc_get_vpe_name($vpeID) { $vpe_query = "SELECT products_vpe_name FROM " . TABLE_PRODUCTS_VPE . " WHERE language_id='" . xtc_db_input((int) $_SESSION['languages_id']) . "' and products_vpe_id='" . xtc_db_input((int) $vpeID) . "'"; $vpe_query = xtDBquery($vpe_query); $vpe = xtc_db_fetch_array($vpe_query, true); return $vpe['products_vpe_name']; }
function xtc_display_banner($action, $identifier) { if ($action == 'dynamic') { $banners_query = xtc_db_query("select count(*) as count from " . TABLE_BANNERS . " where status = '1' and banners_group = '" . xtc_db_input($identifier) . "'"); $banners = xtc_db_fetch_array($banners_query); if ($banners['count'] > 0) { $banner = xtc_random_select("select banners_id, banners_title, banners_image, banners_html_text from " . TABLE_BANNERS . " where status = '1' and banners_group = '" . xtc_db_input($identifier) . "'"); } else { return '<strong>XTC ERROR! (xtc_display_banner(' . $action . ', ' . $identifier . ') -> No banners with group \'' . $identifier . '\' found!</strong>'; } } elseif ($action == 'static') { if (is_array($identifier)) { $banner = $identifier; } else { $banner_query = xtc_db_query("select banners_id, banners_title, banners_image, banners_html_text from " . TABLE_BANNERS . " where status = '1' and banners_id = '" . xtc_db_input($identifier) . "'"); if (xtc_db_num_rows($banner_query)) { $banner = xtc_db_fetch_array($banner_query); } else { return '<strong>XTC ERROR! (xtc_display_banner(' . $action . ', ' . $identifier . ') -> Banner with ID \'' . $identifier . '\' not found, or status inactive</strong>'; } } } else { return '<strong>XTC ERROR! (xtc_display_banner(' . $action . ', ' . $identifier . ') -> Unknown $action parameter value - it must be either \'dynamic\' or \'static\'</strong>'; } if (xtc_not_null($banner['banners_html_text'])) { $banner_string = $banner['banners_html_text']; } else { $banner_string = '<a href="' . xtc_href_link(FILENAME_REDIRECT, 'action=banner&goto=' . $banner['banners_id']) . '" onclick="window.open(this.href); return false;">' . xtc_image(DIR_WS_IMAGES . 'banner/' . $banner['banners_image'], $banner['banners_title']) . '</a>'; } xtc_update_banner_display_count($banner['banners_id']); return $banner_string; }
function xtc_get_download($content_id) { $content_query = xtc_db_query("SELECT\n\t\t\t\t\tcontent_file,\n\t\t\t\t\tcontent_read\n\t\t\t\t\tFROM " . TABLE_PRODUCTS_CONTENT . "\n\t\t\t\t\tWHERE content_id='" . xtc_db_input((int) $content_id) . "'"); $content_data = xtc_db_fetch_array($content_query); // update file counter xtc_db_query("UPDATE \n\t\t\t" . TABLE_PRODUCTS_CONTENT . " \n\t\t\tSET content_read='" . ($content_data['content_read'] + 1) . "'\n\t\t\tWHERE content_id='" . xtc_db_input((int) $content_id) . "'"); // original filename $filename = DIR_FS_CATALOG . 'media/products/' . $content_data['content_file']; $backup_filename = DIR_FS_CATALOG . 'media/products/backup/' . $content_data['content_file']; // create md5 hash id from original file $orign_hash_id = md5_file($filename); clearstatcache(); // create new filename with timestamp $timestamp = str_replace('.', '', microtime()); $timestamp = str_replace(' ', '', $timestamp); $new_filename = DIR_FS_CATALOG . 'media/products/' . $timestamp . strstr($content_data['content_file'], '.'); // rename file rename($filename, $new_filename); if (file_exists($new_filename)) { header("Content-type: application/force-download"); header("Content-Disposition: attachment; filename=" . $new_filename); @readfile($new_filename); // rename file to original name rename($new_filename, $filename); $new_hash_id = md5_file($filename); clearstatcache(); // check hash id of file again, if not same, get backup! if ($new_hash_id != $orign_hash_id) { copy($backup_filename, $filename); } } }
function xtc_get_products_image($products_id = '') { $product_query = "select products_image from " . TABLE_PRODUCTS . " where products_id = '" . xtc_db_input((int) $products_id) . "'"; $product_query = xtDBquery($product_query); $products_image = xtc_db_fetch_array($product_query, true); return $products_image['products_image']; }
function xtc_get_shop_conf($configuration_key, $result_type = 'ASSOC') { $configuration_values = false; if ($result_type == 'ASSOC' || $result_type == 'NUMERIC') { if (is_array($configuration_key)) { foreach ($configuration_key as $key) { $configuration_query = xtc_db_query("\n\t\t\t\t\t\t\t\t\t\t\tSELECT\n\t\t\t\t\t\t\t\t\t\t\t\tconfiguration_value\n\t\t\t\t\t\t\t\t\t\t\tFROM\n\t\t\t\t\t\t\t\t\t\t\t\tshop_configuration\n\t\t\t\t\t\t\t\t\t\t\tWHERE\n\t\t\t\t\t\t\t\t\t\t\t\tconfiguration_key = '" . xtc_db_input($key) . "'\n\t\t\t\t\t\t\t\t\t\t\t\tLIMIT 1\n\t\t\t\t\t\t\t\t\t\t\t"); if (xtc_db_num_rows($configuration_query) == 1) { if ($configuration_values == false) { $configuration_values = array(); } $configuration_row = xtc_db_fetch_array($configuration_query); if ($result_type == 'ASSOC') { $configuration_values[$key] = $configuration_row['configuration_value']; } else { $configuration_values[] = $configuration_row['configuration_value']; } } } } else { $configuration_query = xtc_db_query("\n\t\t\t\t\t\t\t\t\t\tSELECT\n\t\t\t\t\t\t\t\t\t\t\tconfiguration_value\n\t\t\t\t\t\t\t\t\t\tFROM\n\t\t\t\t\t\t\t\t\t\t\tshop_configuration\n\t\t\t\t\t\t\t\t\t\tWHERE\n\t\t\t\t\t\t\t\t\t\t\tconfiguration_key = '" . xtc_db_input($configuration_key) . "'\n\t\t\t\t\t\t\t\t\t\t\tLIMIT 1\n\t\t\t\t\t\t\t\t\t\t"); if (xtc_db_num_rows($configuration_query) == 1) { if ($configuration_values == false) { $configuration_values = ''; } $configuration_row = xtc_db_fetch_array($configuration_query); $configuration_values = $configuration_row['configuration_value']; } } } return $configuration_values; }
function deleteTempOrder() { if (MODULE_PAYMENT_MASTERPAYMENT_CONFIG_DELETE_TEMP_ORDER == 'true') { if ($this->getOrderId()) { $order_id = $this->getOrderId(); $check_query = xtc_db_query('select masterpayment_status from ' . TABLE_ORDERS . ' where orders_id = "' . (int) $order_id . '" limit 1'); $num_check = mysqli_num_rows($check_query); if ($num_check > 0) { $check_result = xtc_db_fetch_array($check_query); if ($check_result['masterpayment_status'] != 1) { if (STOCK_LIMITED == 'true') { $order_query = xtc_db_query("select products_id, products_quantity from " . TABLE_ORDERS_PRODUCTS . " where orders_id = '" . xtc_db_input($order_id) . "'"); while ($order = xtc_db_fetch_array($order_query)) { xtc_db_query("update " . TABLE_PRODUCTS . " set products_quantity = products_quantity + " . $order['products_quantity'] . ", products_ordered = products_ordered - " . $order['products_quantity'] . " where products_id = '" . $order['products_id'] . "'"); } } xtc_db_query('delete from ' . TABLE_ORDERS . ' where orders_id = "' . (int) $order_id . '"'); xtc_db_query('delete from ' . TABLE_ORDERS_TOTAL . ' where orders_id = "' . (int) $order_id . '"'); xtc_db_query('delete from ' . TABLE_ORDERS_STATUS_HISTORY . ' where orders_id = "' . (int) $order_id . '"'); xtc_db_query('delete from ' . TABLE_ORDERS_PRODUCTS . ' where orders_id = "' . (int) $order_id . '"'); xtc_db_query('delete from ' . TABLE_ORDERS_PRODUCTS_ATTRIBUTES . ' where orders_id = "' . (int) $order_id . '"'); xtc_db_query('delete from ' . TABLE_ORDERS_PRODUCTS_DOWNLOAD . ' where orders_id = "' . (int) $order_id . '"'); } else { xtc_redirect(xtc_href_link(FILENAME_CHECKOUT_PROCESS, '', 'NONSSL')); exit; } } } } unset($_SESSION['cart_Masterpayment_ID']); unset($_SESSION['tmp_oID']); }
function xtc_address_format($address_format_id, $address, $html, $boln, $eoln) { $address_format_query = xtc_db_query("select address_format as format from " . TABLE_ADDRESS_FORMAT . " where address_format_id = '" . xtc_db_input((int) $address_format_id) . "'"); $address_format = xtc_db_fetch_array($address_format_query); $company = addslashes($address['company']); $firstname = addslashes($address['firstname']); $lastname = addslashes($address['lastname']); $street = addslashes($address['street_address']); $suburb = addslashes($address['suburb']); $city = addslashes($address['city']); $state = addslashes($address['state']); $country_id = $address['country_id']; $zone_id = $address['zone_id']; $postcode = addslashes($address['postcode']); $zip = $postcode; $country = xtc_get_country_name($country_id); $state = xtc_get_zone_code($country_id, $zone_id, $state); if ($html) { // HTML Mode $HR = '<hr />'; $hr = '<hr />'; if ($boln == '' && $eoln == "\n") { // Values not specified, use rational defaults $CR = '<br />'; $cr = '<br />'; $eoln = $cr; } else { // Use values supplied $CR = $eoln . $boln; $cr = $CR; } } else { // Text Mode $CR = $eoln; $cr = $CR; $HR = '----------------------------------------'; $hr = '----------------------------------------'; } $statecomma = ''; $streets = $street; if ($suburb != '') { $streets = $street . $cr . $suburb; } if ($firstname == '') { $firstname = addslashes($address['name']); } if ($country == '') { $country = addslashes($address['country']); } if ($state != '') { $statecomma = $state . ', '; } $fmt = $address_format['format']; eval("\$address = \"{$fmt}\";"); if (ACCOUNT_COMPANY == 'true' && xtc_not_null($company)) { $address = $company . $cr . $address; } $address = stripslashes($address); return $address; }
function xtc_get_path($current_category_id = '') { global $cPath_array; if (xtc_not_null($current_category_id)) { $cp_size = sizeof($cPath_array); if ($cp_size == 0) { $cPath_new = $current_category_id; } else { $cPath_new = ''; $last_category_query = "select parent_id from " . TABLE_CATEGORIES . " where categories_id = '" . xtc_db_input((int) $cPath_array[$cp_size - 1]) . "'"; $last_category_query = xtDBquery($last_category_query); $last_category = xtc_db_fetch_array($last_category_query, true); $current_category_query = "select parent_id from " . TABLE_CATEGORIES . " where categories_id = '" . xtc_db_input((int) $current_category_id) . "'"; $current_category_query = xtDBquery($current_category_query); $current_category = xtc_db_fetch_array($current_category_query, true); if ($last_category['parent_id'] == $current_category['parent_id']) { for ($i = 0; $i < $cp_size - 1; $i++) { $cPath_new .= '_' . $cPath_array[$i]; } } else { for ($i = 0; $i < $cp_size; $i++) { $cPath_new .= '_' . $cPath_array[$i]; } } $cPath_new .= '_' . $current_category_id; if (substr($cPath_new, 0, 1) == '_') { $cPath_new = substr($cPath_new, 1); } } } else { $cPath_new = xtc_not_null($cPath_array) ? implode('_', $cPath_array) : ''; } return 'cPath=' . $cPath_new; }
function xtc_get_tax_rate($class_id, $country_id = -1, $zone_id = -1) { if ($country_id == -1 && $zone_id == -1) { if (!isset($_SESSION['customer_id'])) { $country_id = STORE_COUNTRY; $zone_id = STORE_ZONE; } else { $country_id = $_SESSION['customer_country_id']; $zone_id = $_SESSION['customer_zone_id']; } } else { $country_id = $country_id; $zone_id = $zone_id; } $tax_query = xtDBquery("select sum(tax_rate) as tax_rate from " . TABLE_TAX_RATES . " tr left join " . TABLE_ZONES_TO_GEO_ZONES . " za on (tr.tax_zone_id = za.geo_zone_id) left join " . TABLE_GEO_ZONES . " tz on (tz.geo_zone_id = tr.tax_zone_id) where (za.zone_country_id is null or za.zone_country_id = '0' or za.zone_country_id = '" . xtc_db_input((int) $country_id) . "') and (za.zone_id is null or za.zone_id = '0' or za.zone_id = '" . xtc_db_input((int) $zone_id) . "') and tr.tax_class_id = '" . xtc_db_input((int) $class_id) . "' group by tr.tax_priority"); if (xtc_db_num_rows($tax_query, true)) { $tax_multiplier = 1.0; while ($tax = xtc_db_fetch_array($tax_query, true)) { $tax_multiplier *= 1.0 + $tax['tax_rate'] / 100; } return ($tax_multiplier - 1.0) * 100; } else { return 0; } }
function xtc_set_customer_status_upgrade($customer_id) { if ($_SESSION['customer_status_value']['customers_status_id'] == "' . DEFAULT_CUSTOMERS_STATUS_ID_NEWSLETTER .'" and $_SESSION['customer_status_value']['customers_is_newsletter'] == 0) { xtc_db_query("update " . TABLE_CUSTOMERS . " set customers_status = '" . DEFAULT_CUSTOMERS_STATUS_ID . "' where customers_id = '" . xtc_db_input((int) $_SESSION['customer_id']) . "'"); xtc_db_query("insert into " . TABLE_CUSTOMERS_STATUS_HISTORY . " (customers_id, new_value, old_value, date_added, customer_notified) values ('" . xtc_db_input((int) $_SESSION['customer_id']) . "', '" . DEFAULT_CUSTOMERS_STATUS_ID . "', '" . DEFAULT_CUSTOMERS_STATUS_ID_NEWSLETTER . "', now(), '" . $customer_notified . "')"); } return 1; }
function xtc_get_customers_country($customers_id) { $customers_query = xtc_db_query("select customers_default_address_id from " . TABLE_CUSTOMERS . " where customers_id = '" . xtc_db_input((int) $customers_id) . "'"); $customers = xtc_db_fetch_array($customers_query); $address_book_query = xtc_db_query("select entry_country_id from " . TABLE_ADDRESS_BOOK . " where address_book_id = '" . xtc_db_input((int) $customers['customers_default_address_id']) . "'"); $address_book = xtc_db_fetch_array($address_book_query); return $address_book['entry_country_id']; }
function splitPageResults($query, $page, $max_rows, $count_key = '*') { $this->sql_query = $query; if (empty($page) || !is_numeric($page)) { $page = 1; } $this->current_page_number = $page; $this->number_of_rows_per_page = $max_rows; $pos_to = strlen($this->sql_query); $pos_from = strpos(strtoupper($this->sql_query), ' FROM', 0); $pos_group_by = strpos(strtoupper($this->sql_query), ' GROUP BY', $pos_from); if ($pos_group_by < $pos_to && $pos_group_by != false) { $pos_to = $pos_group_by; } $pos_having = strpos(strtoupper($this->sql_query), ' HAVING', $pos_from); if ($pos_having < $pos_to && $pos_having != false) { $pos_to = $pos_having; } $pos_order_by = strpos(strtoupper($this->sql_query), ' ORDER BY', $pos_from); if ($pos_order_by < $pos_to && $pos_order_by != false) { $pos_to = $pos_order_by; } if (strpos(strtoupper($this->sql_query), 'DISTINCT') || strpos(strtoupper($this->sql_query), 'GROUP BY')) { $count_string = 'DISTINCT ' . xtc_db_input($count_key); //$count_string = xtc_db_input($count_key); } else { $count_string = xtc_db_input($count_key); } //BOF - DokuMan - 2010-08-26 - performance improvement //$count_query = xtDBquery($query); //$count = xtc_db_num_rows($count_query,true); $reviews_count_query = xtc_db_query("select count(" . $count_string . ") as total " . substr($query, $pos_from, $pos_to - $pos_from)); $reviews_count = xtc_db_fetch_array($reviews_count_query); $count = $reviews_count['total']; //EOF - DokuMan - 2010-08-26 - performance improvement $this->number_of_rows = $count; //BOF -web28- 2010-08-07 - FIX Division by Zero //$this->number_of_pages = ceil($this->number_of_rows / $this->number_of_rows_per_page); if ($this->number_of_rows_per_page > 0) { $this->number_of_pages = ceil($this->number_of_rows / $this->number_of_rows_per_page); } else { $this->number_of_pages = 0; } //EOF -web28- 2010-08-07 - FIX Division by Zero if ($this->current_page_number > $this->number_of_pages) { $this->current_page_number = $this->number_of_pages; } $offset = $this->number_of_rows_per_page * ($this->current_page_number - 1); //BOF -web28- 2010-08-07 - FIX possible $offset = -0 if ($offset < 1) { $offset = 0; } //EOF -web28- 2010-08-07 - FIX possible $offset = -0 //BOF - DokuMan - 2010-08-26 - limit by highest offset //$this->sql_query .= " LIMIT " . $offset . ", " . $this->number_of_rows_per_page; $this->sql_query .= " LIMIT " . max((int) $offset, 0) . ", " . $this->number_of_rows_per_page; //EOF - DokuMan - 2010-08-26 - limit by highest offset }
function xtc_get_cross_sell_name($cross_sell_group, $language_id = '') { if (!$language_id) { $language_id = $_SESSION['languages_id']; } $cross_sell_query = xtc_db_query("select groupname from " . TABLE_PRODUCTS_XSELL_GROUPS . " where products_xsell_grp_name_id = '" . xtc_db_input((int) $cross_sell_group) . "' and language_id = '" . xtc_db_input((int) $language_id) . "'"); $cross_sell = xtc_db_fetch_array($cross_sell_query); return $cross_sell['groupname']; }
function xtc_oe_get_options_name($products_options_id, $language = '') { if (empty($language)) { $language = $_SESSION['languages_id']; } $product_query = xtc_db_query("select products_options_name from " . TABLE_PRODUCTS_OPTIONS . " where products_options_id = '" . xtc_db_input((int) $products_options_id) . "' and language_id = '" . xtc_db_input((int) $language) . "'"); $product = xtc_db_fetch_array($product_query); return $product['products_options_name']; }
function xtc_set_banner_status($banners_id, $status) { if ($status == '1') { return xtc_db_query("update " . TABLE_BANNERS . " set status = '1', date_status_change = now(), date_scheduled = NULL where banners_id = '" . xtc_db_input((int) $banners_id) . "'"); } elseif ($status == '0') { return xtc_db_query("update " . TABLE_BANNERS . " set status = '0', date_status_change = now() where banners_id = '" . xtc_db_input((int) $banners_id) . "'"); } else { return -1; } }
function xtc_get_order_description($product_id, $language = '') { if (empty($language)) { $language = $_SESSION['languages_id']; } $product_query = "select products_order_description from " . TABLE_PRODUCTS_DESCRIPTION . " where products_id = '" . xtc_db_input((int) $product_id) . "' and language_id = '" . xtc_db_input((int) $language) . "'"; $product_query = xtDBquery($product_query); $product = xtc_db_fetch_array($product_query, true); return $product['products_order_description']; }
function xtc_get_address_format_id($country_id) { $address_format_query = xtc_db_query("select address_format_id as format_id from " . TABLE_COUNTRIES . " where countries_id = '" . xtc_db_input((int) $country_id) . "'"); if (xtc_db_num_rows($address_format_query)) { $address_format = xtc_db_fetch_array($address_format_query); return $address_format['format_id']; } else { return '1'; } }
function xtc_get_zone_name($country_id, $zone_id, $default_zone) { $zone_query = xtc_db_query("select zone_name from " . TABLE_ZONES . " where zone_country_id = '" . xtc_db_input((int) $country_id) . "' and zone_id = '" . xtc_db_input((int) $zone_id) . "'"); if (xtc_db_num_rows($zone_query)) { $zone = xtc_db_fetch_array($zone_query); return $zone['zone_name']; } else { return $default_zone; } }
function xtc_update_banner_display_count($banner_id) { $banner_check_query = xtc_db_query("select count(*) as count from " . TABLE_BANNERS_HISTORY . " where banners_id = '" . xtc_db_input((int) $banner_id) . "' and date_format(banners_history_date, '%Y%m%d') = date_format(now(), '%Y%m%d')"); $banner_check = xtc_db_fetch_array($banner_check_query); if ($banner_check['count'] > 0) { xtc_db_query("update " . TABLE_BANNERS_HISTORY . " set banners_shown = banners_shown + 1 where banners_id = '" . xtc_db_input((int) $banner_id) . "' and date_format(banners_history_date, '%Y%m%d') = date_format(now(), '%Y%m%d')"); } else { xtc_db_query("insert into " . TABLE_BANNERS_HISTORY . " (banners_id, banners_shown, banners_history_date) values ('" . xtc_db_input((int) $banner_id) . "', 1, now())"); } }
function xtc_has_category_subcategories($category_id) { $child_category_query = "select count(*) as count from " . TABLE_CATEGORIES . " where parent_id = '" . xtc_db_input((int) $category_id) . "'"; $child_category_query = xtDBquery($child_category_query); $child_category = xtc_db_fetch_array($child_category_query, true); if ($child_category['count'] > 0) { return true; } else { return false; } }
function xtc_banner_exists($action, $identifier) { if ($action == 'dynamic') { return xtc_random_select("select banners_id, banners_title, banners_image, banners_html_text from " . TABLE_BANNERS . " where status = '1' and banners_group = '" . xtc_db_input($identifier) . "'"); } elseif ($action == 'static') { $banner_query = xtc_db_query("select banners_id, banners_title, banners_image, banners_html_text from " . TABLE_BANNERS . " where status = '1' and banners_id = '" . xtc_db_input($identifier) . "'"); return xtc_db_fetch_array($banner_query); } else { return false; } }
function xtc_get_attributes_model($product_id, $attribute_name, $options_name, $language = '') { if ($language == '') { $language = (int) $_SESSION['languages_id']; } //BOF - Hetfield - 2009-08-11 - BUGFIX: #0000211 wrong modelnumbers on atrributes $options_value_id_query = xtc_db_query("SELECT\n\t\tpa.attributes_model\n\t\tFROM\n\t\t" . TABLE_PRODUCTS_ATTRIBUTES . " pa\n\t\tINNER JOIN " . TABLE_PRODUCTS_OPTIONS . " po ON po.products_options_id = pa.options_id\n\t\tINNER JOIN " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov ON pa.options_values_id = pov.products_options_values_id\n\t\tWHERE\n\t\tpo.language_id = '" . xtc_db_input((int) $language) . "' AND\n\t\tpa.products_id = '" . xtc_db_input((int) $product_id) . "' AND\t\t\n\t\tpo.products_options_name = '" . xtc_db_input($options_name) . "' AND\n\t\tpov.language_id = '" . xtc_db_input((int) $language) . "' AND\n\t\tpov.products_options_values_name = '" . xtc_db_input($attribute_name) . "' AND \n\t\tpa.products_id = '" . xtc_db_input((int) $product_id) . "'"); //EOF - Hetfield - 2009-08-11 - BUGFIX: #0000211 wrong modelnumbers on atrributes $options_attr_data = xtc_db_fetch_array($options_value_id_query); return $options_attr_data['attributes_model']; }
function xtc_get_subcategories(&$subcategories_array, $parent_id = 0) { $subcategories_query = "select categories_id from " . TABLE_CATEGORIES . " where parent_id = '" . xtc_db_input((int) $parent_id) . "'"; $subcategories_query = xtDBquery($subcategories_query); while ($subcategories = xtc_db_fetch_array($subcategories_query, true)) { $subcategories_array[sizeof($subcategories_array)] = $subcategories['categories_id']; if ($subcategories['categories_id'] != $parent_id) { xtc_get_subcategories($subcategories_array, $subcategories['categories_id']); } } }
function xtc_validate_vatid_status($customer_id) { $customer_status_query = xtc_db_query("SELECT customers_vat_id_status \n FROM " . TABLE_CUSTOMERS . "\n WHERE customers_id='" . xtc_db_input((int) $customer_id) . "'"); $customer_status_value = xtc_db_fetch_array($customer_status_query); // BOF - Dokuman - 2011-09-13 - display correct error code of VAT ID check switch ($customer_status_value['customers_vat_id_status']) { // 0 = 'VAT invalid' // 1 = 'VAT valid' // 2 = 'SOAP ERROR: Connection to host not possible, europe.eu down?' // 8 = 'unknown country' //94 = 'INVALID_INPUT' => 'The provided CountryCode is invalid or the VAT number is empty', //95 = 'SERVICE_UNAVAILABLE' => 'The SOAP service is unavailable, try again later', //96 = 'MS_UNAVAILABLE' => 'The Member State service is unavailable, try again later or with another Member State', //97 = 'TIMEOUT' => 'The Member State service could not be reached in time, try again later or with another Member State', //98 = 'SERVER_BUSY' => 'The service cannot process your request. Try again later.' //99 = 'no PHP5 SOAP support' case '0': $entry_vat_error_text = TEXT_VAT_FALSE; break; case '1': $entry_vat_error_text = TEXT_VAT_TRUE; break; case '2': $entry_vat_error_text = TEXT_VAT_CONNECTION_NOT_POSSIBLE; break; case '8': $entry_vat_error_text = TEXT_VAT_UNKNOWN_COUNTRY; break; case '94': $entry_vat_error_text = TEXT_VAT_INVALID_INPUT; break; case '95': $entry_vat_error_text = TEXT_VAT_SERVICE_UNAVAILABLE; break; case '96': $entry_vat_error_text = TEXT_VAT_MS_UNAVAILABLE; break; case '97': $entry_vat_error_text = TEXT_VAT_TIMEOUT; break; case '98': $entry_vat_error_text = TEXT_VAT_SERVER_BUSY; break; case '99': $entry_vat_error_text = TEXT_VAT_NO_PHP5_SOAP_SUPPORT; break; default: $entry_vat_error_text = ''; break; } // EOF - Dokuman - 2011-09-13 - display correct error code of VAT ID check return $entry_vat_error_text; }
function xtc_get_order_data($order_id) { $order_query = xtc_db_query("SELECT\n customers_name,\n customers_company,\n customers_street_address,\n customers_suburb,\n customers_city,\n customers_postcode,\n customers_state,\n customers_country,\n customers_telephone,\n customers_email_address,\n customers_address_format_id,\n delivery_name,\n delivery_company,\n delivery_street_address,\n delivery_suburb,\n delivery_city,\n delivery_postcode,\n delivery_state,\n delivery_country,\n delivery_address_format_id,\n billing_name,\n billing_company,\n billing_street_address,\n billing_suburb,\n billing_city,\n billing_postcode,\n billing_state,\n billing_country,\n billing_address_format_id,\n payment_method,\n comments,\n date_purchased,\n orders_status,\n currency,\n currency_value\n \t\t\t\t\tFROM " . TABLE_ORDERS . "\n \t\t\t\t\tWHERE orders_id='" . xtc_db_input((int) $_GET['oID']) . "'"); $order_data = xtc_db_fetch_array($order_query); // get order status name $order_status_query = xtc_db_query("SELECT\n \t\t\t\torders_status_name\n \t\t\t\tFROM " . TABLE_ORDERS_STATUS . "\n \t\t\t\tWHERE orders_status_id='" . xtc_db_input((int) $order_data['orders_status']) . "'\n \t\t\t\tAND language_id='" . xtc_db_input((int) $_SESSION['languages_id']) . "'"); $order_status_data = xtc_db_fetch_array($order_status_query); $order_data['orders_status'] = $order_status_data['orders_status_name']; // get language name for payment method include DIR_WS_LANGUAGES . $_SESSION['language'] . '/modules/payment/' . $order_data['payment_method'] . '.php'; $order_data['payment_method'] = constant(strtoupper('MODULE_PAYMENT_' . $order_data['payment_method'] . '_TEXT_TITLE')); return $order_data; }
function xtc_get_categoriesstatus_for_product($product_id) { $categorie_query = "SELECT\n\t categories_id\n\t FROM " . TABLE_PRODUCTS_TO_CATEGORIES . "\n\t WHERE products_id='" . xtc_db_input((int) $product_id) . "'"; $categorie_query = xtDBquery($categorie_query); while ($categorie_data = xtc_db_fetch_array($categorie_query, true)) { if (xtc_check_categories_status($categorie_data['categories_id']) >= 1) { return 1; } else { return 0; } echo $categorie_data['categories_id']; } }