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 get_category_tree($parent_id = '0', $spacing = '', $exclude = '', $category_tree_array = '', $include_itself = false, $cPath = '') { if ($parent_id == 0) { $cPath = ''; } else { $cPath .= $parent_id . '_'; } if (!is_array($category_tree_array)) { $category_tree_array = array(); } if (sizeof($category_tree_array) < 1 && $exclude != '0') { $category_tree_array[] = array('id' => '0', 'text' => TEXT_TOP); } if ($include_itself) { // $category_query = "select cd.categories_name from " . TABLE_CATEGORIES_DESCRIPTION . " cd where cd.language_id = '" . $_SESSION['languages_id'] . "' and c.categories_status = '1' and cd.categories_id = '" . $parent_id . "'"; $category_query = xtDBquery($category_query); $category_query = "select cd.categories_name from " . TABLE_CATEGORIES_DESCRIPTION . " cd where cd.language_id = '" . $_SESSION['languages_id'] . "' and c.categories_status = '1' and cd.categories_id = '" . $parent_id . "' order by cd.categories_name "; $category = xtc_db_fetch_array($category_query, true); $category_tree_array[] = array('id' => $parent_id, 'text' => $category['categories_name']); } $categories_query = "select c.categories_id, cd.categories_name, c.parent_id from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.categories_id = cd.categories_id and cd.language_id = '" . $_SESSION['languages_id'] . "' and c.parent_id = '" . $parent_id . "' and c.categories_status = '1' order by cd.categories_name"; $categories_query = xtDBquery($categories_query); while ($categories = xtc_db_fetch_array($categories_query, true)) { $SEF_link = xtc_href_link(FILENAME_DEFAULT, xtc_category_link($categories['categories_id'], $categories['categories_name'])); if ($exclude != $categories['categories_id']) { $category_tree_array[] = array('id' => $categories['categories_id'], 'text' => $spacing . $categories['categories_name'], 'link' => $SEF_link); } $category_tree_array = get_category_tree($categories['categories_id'], $spacing . ' ', $exclude, $category_tree_array, false, $cPath); } return $category_tree_array; }
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_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_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_product_link($pID, $name = '') { #Check for current category link $c_path = $_SERVER['QUERY_STRING']; if (strpos($c_path, 'cPath') !== false) { $category_path = substr($c_path, strpos($c_path, '=') + 1); $categorie_previous = end(explode('_', $category_path)); $cat_children = array(); $cat_children = xtc_get_categories_children($categorie_previous); foreach ($cat_children as $linked_cat) { $category_query_check = "select p2c.categories_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_id = '" . (int) $pID . "' and p.products_status = '1' and p.products_id = p2c.products_id and p2c.categories_id != 0 and p2c.categories_id = '" . $linked_cat . "'"; $category_query_check = xtDBquery($category_query_check); if (xtc_db_num_rows($category_query_check, true)) { $cID = xtc_db_fetch_array($category_query_check)['categories_id']; break; } } } #Take default categorie id if (!isset($cID)) { $category_query = "select p2c.categories_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_id = '" . (int) $pID . "' and p.products_status = '1' and p.products_id = p2c.products_id and p2c.categories_id != 0"; $category_query = xtDBquery($category_query); if (xtc_db_num_rows($category_query, true)) { $cID = xtc_db_fetch_array($category_query)['categories_id']; } } #Create category path from category ID $categories = array(); xtc_get_parent_categories($categories, $cID); $categories = array_reverse($categories); $categories[] = $cID; $cPath = implode('_', $categories); return 'products_id=' . $pID . '&cPath=' . $cPath; }
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 main() { $this->SHIPPING = array(); // prefetch shipping status $status_query = xtDBquery("SELECT\n shipping_status_name,\n shipping_status_image,shipping_status_id\n FROM " . TABLE_SHIPPING_STATUS . "\n where language_id = '" . (int) $_SESSION['languages_id'] . "'"); while ($status_data = olc_db_fetch_array($status_query, true)) { $this->SHIPPING[$status_data['shipping_status_id']] = array('name' => $status_data['shipping_status_name'], 'image' => $status_data['shipping_status_image']); } }
function xtc_get_product_path($products_id) { $cPath = ''; $category_query = "select p2c.categories_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_id = '" . (int) $products_id . "' and p.products_status = '1' and p.products_id = p2c.products_id and p2c.categories_id != 0"; $category_query = xtDBquery($category_query); if (xtc_db_num_rows($category_query, true)) { #Default category( first picked from table) $category = xtc_db_fetch_array($category_query); $p_path_full = $_SERVER['REQUEST_URI']; $p_path = $_SERVER['QUERY_STRING']; #If we display product check linked categories if (strpos($p_path, 'products_id') !== false) { while ($categoryies = xtc_db_fetch_array($category_query)) { $cat_name = xtc_get_categories_name($categoryies['categories_id']); $cat_name_slug = shopstat_hrefSmallmask($cat_name); $p_path_full_array = explode('/', $p_path_full); if ($p_path_full_array[count($p_path_full_array) - 2] === $cat_name_slug) { $category = $categoryies; break; } } } # Check if current categorie or its children have linked product $c_path = $_SERVER['QUERY_STRING']; if (strpos($c_path, 'cPath') !== false) { $category_path = substr($c_path, strpos($c_path, '=') + 1); $categorie_previous = end(explode('_', $category_path)); $cat_children = array(); $cat_children = xtc_get_categories_children($categorie_previous); foreach ($cat_children as $linked_cat) { $category_query_check = "select p2c.categories_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_id = '" . (int) $products_id . "' and p.products_status = '1' and p.products_id = p2c.products_id and p2c.categories_id != 0 and p2c.categories_id = '" . $linked_cat . "'"; $category_query_check = xtDBquery($category_query_check); if (xtc_db_num_rows($category_query_check, true)) { $category = xtc_db_fetch_array($category_query_check); break; } } } $categories = array(); xtc_get_parent_categories($categories, $category['categories_id']); $categories = array_reverse($categories); $cPath = implode('_', $categories); if (xtc_not_null($cPath)) { $cPath .= '_'; } $cPath .= $category['categories_id']; } //BOF - Dokuman - 2009-10-02 - removed feature, due to wrong links in category on "last viewed" /* if($_SESSION['lastpath']!=''){ $cPath = $_SESSION['lastpath']; } */ //EOF - Dokuman - 2009-10-02 - removed feature, due to wrong links in category on "last viewed" return $cPath; }
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_categories_name($categories_id) { if (GROUP_CHECK == 'true') { $group_check = "and c.group_permission_" . $_SESSION['customers_status']['customers_status_id'] . "=1 "; } $categories_name_query = "SELECT cd.categories_name FROM " . TABLE_CATEGORIES_DESCRIPTION . " cd, " . TABLE_CATEGORIES . " c WHERE cd.categories_id = '" . $categories_id . "' AND c.categories_id=cd.categories_id " . $group_check . " AND cd.language_id='" . (int) $_SESSION['languages_id'] . "'"; $categories_name_query = xtDBquery($categories_name_query); $categories_name = xtc_db_fetch_array($categories_name_query, true); return $categories_name['categories_name']; }
function xtc_has_product_attributes($products_id) { $attributes_query = "select count(*) as count from " . TABLE_PRODUCTS_ATTRIBUTES . " where products_id = '" . (int) $products_id . "'"; $attributes_query = xtDBquery($attributes_query); $attributes = xtc_db_fetch_array($attributes_query, true); if ($attributes['count'] > 0) { return true; } else { return false; } }
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_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_get_categories_children_calc($cat_id, &$cat_children) { $categories_query = "select categories_id, parent_id from " . TABLE_CATEGORIES . " where parent_id = '" . $cat_id . "'"; $categories_query = xtDBquery($categories_query); if (xtc_db_num_rows($categories_query, true)) { while ($categoryies = xtc_db_fetch_array($categories_query)) { $cat_children[] = $categoryies['categories_id']; xtc_get_categories_children($categoryies['categories_id'], $cat_children); } } }
function getReviewRating($pID) { //Auslesen und Bewertung von Bewertungsanzahl $reviews_query = xtDBquery("SELECT round(sum(r.products_id) / (r.products_id)) as rating\r\n FROM " . TABLE_REVIEWS . " r\r\n WHERE r.products_id = '" . $pID . "'"); $reviews = xtc_db_fetch_array($reviews_query); if ($reviews['rating'] == "") { $bewertung_anzahl = '0'; } else { $bewertung_anzahl = $reviews['rating']; } return $bewertung_anzahl; }
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']; } }
function xtc_get_parent_categories(&$categories, $categories_id) { $parent_categories_query = "select parent_id from " . TABLE_CATEGORIES . " where categories_id = '" . xtc_db_input((int) $categories_id) . "'"; $parent_categories_query = xtDBquery($parent_categories_query); while ($parent_categories = xtc_db_fetch_array($parent_categories_query, true)) { if ($parent_categories['parent_id'] == 0) { return true; } $categories[sizeof($categories)] = $parent_categories['parent_id']; if ($parent_categories['parent_id'] != $categories_id) { xtc_get_parent_categories($categories, $parent_categories['parent_id']); } } }
function xtc_get_products_mo_images($products_id = '') { $mo_query = "select * from " . TABLE_PRODUCTS_IMAGES . " where products_id = '" . xtc_db_input((int) $products_id) . "' ORDER BY image_nr"; $products_mo_images_query = xtDBquery($mo_query); $results = array(); while ($row = xtc_db_fetch_array($products_mo_images_query, true)) { $results[$row['image_nr'] - 1] = $row; } if (sizeof($results) > 0) { return $results; } else { return false; } }
function xtc_get_categories($categories_array = '', $parent_id = '0', $indent = '') { $parent_id = xtc_db_prepare_input($parent_id); if (!is_array($categories_array)) { $categories_array = array(); } $categories_query = "select\n c.categories_id,\n cd.categories_name\n from " . TABLE_CATEGORIES . " c,\n " . TABLE_CATEGORIES_DESCRIPTION . " cd\n where parent_id = '" . xtc_db_input((int) $parent_id) . "'\n and c.categories_id = cd.categories_id\n and c.categories_status != 0\n and cd.language_id = '" . xtc_db_input((int) $_SESSION['languages_id']) . "'\n order by sort_order, cd.categories_name"; $categories_query = xtDBquery($categories_query); while ($categories = xtc_db_fetch_array($categories_query, true)) { $categories_array[] = array('id' => $categories['categories_id'], 'text' => $indent . $categories['categories_name']); if ($categories['categories_id'] != $parent_id) { $categories_array = xtc_get_categories($categories_array, $categories['categories_id'], $indent . ' '); } } return $categories_array; }
/** * Produktdaten einlesen * * @param array $selected_products uebergebene Auswahl */ function LoadData($oID) { global $xtPrice; // --- bof -- changes -- h.koch@hen-vm68.com -- 05.2016 -- //$c_query ="SELECT // customers_status // FROM " . TABLE_ORDERS . " // WHERE // orders_id = '".$oID."'"; $c_query = "SELECT\r\n customers_status,\r\n currency\r\n FROM " . TABLE_ORDERS . "\r\n WHERE\r\n orders_id = '" . $oID . "'"; // --- eof -- changes -- h.koch@hen-vm68.com -- 05.2016 -- $c_query = xtDBquery($c_query); $c_query = xtc_db_fetch_array($c_query); $customers_status = $c_query['customers_status']; $currency = $c_query['currency']; // EUR, CHF // --- changes -- h.koch@hen-vm68.com -- 05.2016 -- //$xtPrice = new xtcPrice( 'EUR', $customers_status ); $xtPrice = new xtcPrice($currency, $customers_status); // --- changes -- h.koch@hen-vm68.com -- 05.2016 -- $order = new order_pdf($oID); $this->data['address_label_customer'] = xtc_address_format($order->customer['format_id'], $order->customer, 0, '', "\n"); $this->data['address_label_shipping'] = xtc_address_format($order->delivery['format_id'], $order->delivery, 0, '', "\n"); $this->data['address_label_payment'] = xtc_address_format($order->billing['format_id'], $order->billing, 0, '', "\n"); $this->data['csID'] = $order->customer['csID']; // get products data $order_total = $order->getTotalData($oID); $this->data['order_data'] = $order->getOrderData($oID); $this->data['order_total'] = $order_total['data']; // assign language to template for caching $this->data['language'] = $_SESSION['language']; $this->data['oID'] = $oID; if ($order->info['payment_method'] != '' && $order->info['payment_method'] != 'no_payment') { include DIR_FS_LANGUAGES . $_SESSION['language'] . '/modules/payment/' . $order->info['payment_method'] . '.php'; $payment_method = constant(strtoupper('MODULE_PAYMENT_' . $order->info['payment_method'] . '_TEXT_TITLE')); } $this->data['PAYMENT_METHOD'] = $payment_method; $this->data['COMMENT'] = $order->info['comments']; $this->data['order'] = $order; $this->data['DATE'] = xtc_date_short($order->info['date_purchased']); $this->data['DATE_INVOICE'] = xtc_date_short($order->info['ibn_billdate']); $this->data['ibn_billdate'] = $order->info['ibn_billdate']; $this->data['ibn_billnr'] = $order->info['ibn_billnr']; //echo "data:<pre>"; print_r($this->data); echo "</pre>"; return; }
function xtc_get_product_original_path($products_id) { $cPath = ''; $category_query = "select p2c.categories_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_id = '" . (int) $products_id . "' and p.products_status = '1' and p.products_id = p2c.products_id and p2c.categories_id != 0 limit 1"; $category_query = xtDBquery($category_query); if (xtc_db_num_rows($category_query, true)) { $category = xtc_db_fetch_array($category_query); $categories = array(); xtc_get_parent_categories($categories, $category['categories_id']); $categories = array_reverse($categories); $cPath = implode('_', $categories); if (xtc_not_null($cPath)) { $cPath .= '_'; } $cPath .= $category['categories_id']; } return $cPath; }
function xtc_customer_greeting() { if (isset($_SESSION['customer_last_name']) && isset($_SESSION['customer_id'])) { if (!isset($_SESSION['customer_gender'])) { $check_customer_query = "select customers_gender FROM " . TABLE_CUSTOMERS . " where customers_id = '" . xtc_db_input((int) $_SESSION['customer_id']) . "'"; $check_customer_query = xtDBquery($check_customer_query); $check_customer_data = xtc_db_fetch_array($check_customer_query, true); $_SESSION['customer_gender'] = $check_customer_data['customers_gender']; } if ($_SESSION['customer_gender'] == 'f') { $greeting_string = sprintf(TEXT_GREETING_PERSONAL, FEMALE . ' ' . $_SESSION['customer_first_name'] . ' ' . $_SESSION['customer_last_name'], xtc_href_link(FILENAME_PRODUCTS_NEW)); } else { $greeting_string = sprintf(TEXT_GREETING_PERSONAL, MALE . ' ' . $_SESSION['customer_first_name'] . ' ' . $_SESSION['customer_last_name'], xtc_href_link(FILENAME_PRODUCTS_NEW)); } } else { $greeting_string = sprintf(TEXT_GREETING_GUEST, xtc_href_link(FILENAME_LOGIN, '', 'SSL'), xtc_href_link(FILENAME_CREATE_ACCOUNT, '', 'SSL')); } return $greeting_string; }
function ProductRedirectionLink($ProdID = false) { if ($ProdID) { $fsk_lock = ''; //DokuMan - 2010-03-12 - set undefined variable if ($_SESSION['customers_status']['customers_fsk18_display'] == '0') { $fsk_lock = "AND p.products_fsk18!=1 "; } $group_check = ''; //DokuMan - 2010-03-12 - set undefined variable if (GROUP_CHECK == 'true') { $group_check = "AND p.group_permission_" . $_SESSION['customers_status']['customers_status_id'] . "=1 "; } $dbQuery = xtDBquery("\n\t\t\t\tSELECT \tp.products_id, \n\t\t\t\t\t\tpd.products_name\n\t\t\t\tFROM \t" . TABLE_PRODUCTS_DESCRIPTION . " pd,\n\t\t\t\t\t\t" . TABLE_PRODUCTS . " p\n\t\t\t\tWHERE \tpd.products_id = '" . intval($ProdID) . "'\n\t\t\t\tAND \tpd.products_id = p.products_id\n\t\t\t\t" . $fsk_lock . "\n\t\t\t\t" . $group_check . "\n\t\t\t\tAND\t\tp.products_status = '1'\n\t\t\t\tAND \tpd.language_id = '" . (int) $_SESSION['languages_id'] . "' \n\t\t\t"); $dbQuery = xtc_db_fetch_array($dbQuery, true); if (!empty($dbQuery['products_id'])) { return xtc_href_link(FILENAME_PRODUCT_INFO, xtc_product_link(intval($ProdID), $dbQuery['products_name'])); } } return false; }
function xtc_count_products_in_category($category_id, $include_inactive = false) { $group_check = ''; //DokuMan - 2010-03-12 - set undefined variable //BOF - Dokuman - 2009-09-02: do not count products when GROUP_CHECK disabled if (GROUP_CHECK == 'true') { $group_check = " AND p.group_permission_" . xtc_db_input((int) $_SESSION['customers_status']['customers_status_id']) . "=1 "; } //EOF - Dokuman - 2009-09-02: do not count products when GROUP_CHECK disabled $products_count = 0; if ($include_inactive == true) { //BOF - Dokuman - 2009-09-02: do not count products when GROUP_CHECK disabled //$products_query = "select count(*) as total from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_id = p2c.products_id and p2c.categories_id = '" . $category_id . "'"; $products_query = "select count(*) as total from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_id = p2c.products_id and p2c.categories_id = '" . xtc_db_input((int) $category_id) . "'" . $group_check; //EOF - Dokuman - 2009-09-02: do not count products when GROUP_CHECK disabled } else { //BOF - Dokuman - 2009-09-02: do not count products when GROUP_CHECK disabled //$products_query = "select count(*) as total from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_id = p2c.products_id and p.products_status = '1' and p2c.categories_id = '" . $category_id . "'"; $products_query = "select count(*) as total from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_id = p2c.products_id and p.products_status = '1' and p2c.categories_id = '" . xtc_db_input((int) $category_id) . "'" . $group_check; //EOF - Dokuman - 2009-09-02: do not count products when GROUP_CHECK disabled } $products_query = xtDBquery($products_query); $products = xtc_db_fetch_array($products_query, true); $products_count += $products['total']; //BOF - Dokuman - 2009-09-02: do not count products when GROUP_CHECK disabled if (GROUP_CHECK == 'true') { $group_check = " AND group_permission_" . xtc_db_input((int) $_SESSION['customers_status']['customers_status_id']) . "=1 "; } //$child_categories_query = "select categories_id from " . TABLE_CATEGORIES . " where parent_id = '" . $category_id . "'"; $child_categories_query = "select categories_id from " . TABLE_CATEGORIES . " where parent_id = '" . xtc_db_input((int) $category_id) . "'" . $group_check; //EOF - Dokuman - 2009-09-02: do not count products when GROUP_CHECK disabled $child_categories_query = xtDBquery($child_categories_query); if (xtc_db_num_rows($child_categories_query, true)) { while ($child_categories = xtc_db_fetch_array($child_categories_query, true)) { $products_count += xtc_count_products_in_category($child_categories['categories_id'], $include_inactive); } } return $products_count; }
require_once DIR_FS_INC . 'xtc_in_array.inc.php'; $check_query = xtDBquery("SELECT DISTINCT\n\t\t\t\tproducts_id\n\t\t\t\tFROM " . TABLE_PRODUCTS_CONTENT . "\n\t\t\t\tWHERE languages_id='" . (int) $_SESSION['languages_id'] . "'"); $check_data = array(); $i = '0'; while ($content_data = xtc_db_fetch_array($check_query, true)) { $check_data[$i] = $content_data['products_id']; $i++; } if (xtc_in_array($product->data['products_id'], $check_data)) { // get content data require_once DIR_FS_INC . 'xtc_filesize.inc.php'; if (GROUP_CHECK == 'true') { $group_check = "group_ids LIKE '%c_" . $_SESSION['customers_status']['customers_status_id'] . "_group%' AND"; } //get download $content_query = xtDBquery("SELECT\n\t\t\t\t\tcontent_id,\n\t\t\t\t\tcontent_name,\n\t\t\t\t\tcontent_link,\n\t\t\t\t\tcontent_file,\n\t\t\t\t\tcontent_read,\n\t\t\t\t\tfile_comment\n\t\t\t\t\tFROM " . TABLE_PRODUCTS_CONTENT . "\n\t\t\t\t\tWHERE\n\t\t\t\t\tproducts_id='" . $product->data['products_id'] . "' AND\n\t " . $group_check . "\n\t\t\t\t\tlanguages_id='" . (int) $_SESSION['languages_id'] . "'"); while ($content_data = xtc_db_fetch_array($content_query, true)) { $filename = ''; if ($content_data['content_link'] != '') { $icon = xtc_image(DIR_WS_CATALOG . 'admin/images/icons/icon_link.gif'); } else { $icon = xtc_image(DIR_WS_CATALOG . 'admin/images/icons/icon_' . str_replace('.', '', strstr($content_data['content_file'], '.')) . '.gif'); } if ($content_data['content_link'] != '') { $filename = '<a href="' . $content_data['content_link'] . '" target="new">'; } $filename .= $content_data['content_name']; if ($content_data['content_link'] != '') { $filename .= '</a>'; } $button = '';
function showSpecialsBox() { global $pInfo; //web28 - 2010-07-27 - show products_price // include localized categories specials strings require_once DIR_FS_LANGUAGES . $_SESSION['language'] . '/admin/categories_specials.php'; //BOF web28 - 2010-07-27 - show products_price if (PRICE_IS_BRUTTO == 'true') { $products_price_sp = xtc_round($pInfo->products_price * ((100 + xtc_get_tax_rate($pInfo->products_tax_class_id)) / 100), PRICE_PRECISION); $products_price_netto_sp = TEXT_NETTO . '<strong>' . $pInfo->products_price * (xtc_get_tax_rate($sInfo->products_tax_class_id) + 100) / 100 . '</strong> '; } else { $products_price_sp = xtc_round($pInfo->products_price, PRICE_PRECISION); $products_price_netto_sp = ''; } //EOF web28 - 2010-07-27 - show products_price // if editing an existing product if (isset($_GET['pID'])) { $specials_query = "SELECT p.products_tax_class_id,\n p.products_id,\n p.products_price,\n pd.products_name,\n s.specials_id,\n s.specials_quantity,\n s.specials_new_products_price,\n s.specials_date_added,\n s.specials_last_modified,\n s.expires_date,\n s.status\n FROM " . TABLE_PRODUCTS . " p,\n " . TABLE_PRODUCTS_DESCRIPTION . " pd,\n " . TABLE_SPECIALS . " s\n WHERE p.products_id = pd.products_id\n AND pd.language_id = '" . (int) $_SESSION['languages_id'] . "'\n AND p.products_id = s.products_id\n AND s.products_id = '" . (int) $_GET['pID'] . "'"; //DokuMan - 2011-11-8 - added missing s.status from SP1b $specials_query = xtDBquery($specials_query); // if there exists already a special for this product if (xtc_db_num_rows($specials_query, true) > 0) { $special = xtc_db_fetch_array($specials_query, true); $sInfo = new objectInfo($special); } } $price = $sInfo->products_price; $new_price = $sInfo->specials_new_products_price; $new_price_netto = ''; //web28 - 2010-07-27 - show special_price netto if (PRICE_IS_BRUTTO == 'true') { $price_netto = xtc_round($price, PRICE_PRECISION); if ($price > 0) { $new_price_netto = TEXT_NETTO . '<strong>' . xtc_round($new_price, PRICE_PRECISION) . '</strong>'; //web28 - 2010-07-27 - show special_price netto } $price = $price * (xtc_get_tax_rate($sInfo->products_tax_class_id) + 100) / 100; $new_price = $new_price * (xtc_get_tax_rate($sInfo->products_tax_class_id) + 100) / 100; } $price = xtc_round($price, PRICE_PRECISION); $new_price = xtc_round($new_price, PRICE_PRECISION); // build the expires date in the format YYYY-MM-DD if (isset($_GET['pID']) and xtc_db_num_rows($specials_query, true) > 0 and $sInfo->expires_date != 0) { $expires_date = substr($sInfo->expires_date, 0, 4) . "-" . substr($sInfo->expires_date, 5, 2) . "-" . substr($sInfo->expires_date, 8, 2); } else { $expires_date = ""; } if ($sInfo->status == 1) { $status = 'checked="checked"'; } else { $status = ''; } // tell the storing script if to update existing special, // or to insert a new one echo xtc_draw_hidden_field('specials_action', isset($_GET['pID']) && xtc_db_num_rows($specials_query, true) > 0 ? "update" : "insert"); echo xtc_draw_hidden_field('tax_rate', xtc_get_tax_rate($pInfo->products_tax_class_id)); //web28 - 2010-07-27 - add hidden field echo xtc_draw_hidden_field('products_price_hidden', $pInfo->products_price); //web28 - 2010-07-27 - FIX wrong specials price if (isset($_GET['pID']) and xtc_db_num_rows($specials_query, true) > 0) { echo xtc_draw_hidden_field('specials_id', $sInfo->specials_id); } ?> <script type="text/javascript"> var specialExpires = new ctlSpiffyCalendarBox("specialExpires", "new_product", "specials_expires","btnDate2","<?php echo $expires_date; ?> ",2); </script> <script language="JavaScript" type="text/JavaScript"> function showSpecial() { //alert(document.getElementById("special").style.display); if (document.getElementById("special").style.display =="none" || document.getElementById("special").style.display =="") { document.getElementById("special").style.display="block"; document.getElementById('butSpecial').innerHTML= '<a href="JavaScript:showSpecial()" class="btn btn-default">« Sonderangebot</a>'; } else { document.getElementById("special").style.display="none"; document.getElementById('butSpecial').innerHTML= '<a href="JavaScript:showSpecial()" class="btn btn-default">Sonderangebot »</a>'; } } </script> <style type='text/css'>#special{display: none;}</style> <noscript> <style type="text/css">#special{display: block;}</style> </noscript> <div id="special"> <div style="padding: 8px 0px 3px 5px;"> <div class="main"> <strong><?php echo SPECIALS_TITLE; ?> </strong> </div> </div> <div class='col-xs-12' style="width: 100%; border: 1px solid; border-color: #aaaaaa; padding:5px; background-color: #f3f3f3;"> <?php if (!isset($_GET['pID'])) { ?> <div class="col-xs-12 col-sm-9 col-md-5 col-lg-5"> <div class="main col-xs-12 col-sm-4"><?php echo TEXT_SPECIALS_NO_PID; ?> </div> </div> <div class='clearfix' ></div> <?php } else { ?> <div class="col-xs-12 col-xs-12 col-sm-9 col-md-5 col-lg-5 "> <div class="main col-xs-12 col-sm-4"><?php echo TEXT_PRODUCTS_PRICE; ?> </div> <div class="main col-xs-12 col-sm-4"><?php echo $products_price_sp; echo $products_price_netto_sp; ?> </div> </div> <div class='clearfix' ></div> <div class="col-xs-12 col-xs-12 col-sm-9 col-md-5 col-lg-5"> <div class="main col-xs-12 col-sm-4" > <?php echo TEXT_SPECIALS_SPECIAL_PRICE; ?> </div> <div class="main col-xs-12 col-sm-4" > <?php echo xtc_draw_input_field('specials_price', $new_price, 'style="width: 135px"') . ' ' . $new_price_netto; ?> </div> <div class="main col-xs-12 col-sm-4" > <?php if (isset($_GET['pID']) and xtc_db_num_rows($specials_query, true) > 0) { ?> <input type="checkbox" name="specials_delete" value="true" id="input_specials_delete" onclick="if(this.checked==true)return confirm('<?php echo TEXT_INFO_DELETE_INTRO; ?> ');"style="vertical-align:middle;"/><label for="input_specials_delete"> <?php echo TEXT_INFO_HEADING_DELETE_SPECIALS; ?> </label> <?php } ?> </div> </div> <div class='clearfix' ></div> <div class="col-xs-12 col-xs-12 col-sm-9 col-md-5 col-lg-5"> <div class="main col-xs-12 col-sm-4"> <?php echo TEXT_SPECIALS_SPECIAL_QUANTITY; ?> </div> <div class="main col-xs-12 col-sm-4"> <?php echo xtc_draw_input_field('specials_quantity', $sInfo->specials_quantity, 'style="width: 135px"'); ?> </div> </div> <div class='clearfix' ></div> <?php if (isset($_GET['pID']) and xtc_db_num_rows($specials_query, true) > 0) { ?> <div class="col-xs-12 col-xs-12 col-sm-9 col-md-5 col-lg-5"> <div class="main col-xs-12 col-sm-4"><?php echo TEXT_INFO_DATE_ADDED; ?> </div> <div class="main col-xs-12 col-sm-4"><?php echo xtc_date_short($sInfo->specials_date_added); ?> </div> <div class="main col-xs-12 col-sm-4"> </div> </div> <div class='clearfix' ></div> <div class="col-xs-12 col-xs-12 col-sm-9 col-md-5 col-lg-5"> <div class="main col-xs-12 col-sm-4"><?php echo TEXT_INFO_LAST_MODIFIED; ?> </div> <div class="main col-xs-12 col-sm-4"><?php echo xtc_date_short($sInfo->specials_last_modified); ?> </div> <div class="main col-xs-12 col-sm-4"> </div> </div> <div class='clearfix' ></div> <?php } ?> <div class="col-xs-12 col-xs-12 col-sm-9 col-md-5 col-lg-5"> <div class="main col-xs-12 col-sm-4"> <?php echo TEXT_SPECIALS_EXPIRES_DATE; ?> </div> <div class="main col-xs-12 col-sm-4"> <script type="text/javascript">specialExpires.writeControl(); specialExpires.dateFormat="yyyy-MM-dd";</script> <noscript> <?php echo xtc_draw_input_field('specials_expires', $expires_date, 'style="width: 135px"'); ?> </noscript> </div> <div class="main col-xs-12 col-sm-4"> <?php if (isset($_GET['pID']) and xtc_db_num_rows($specials_query, true) > 0) { ?> <input type="checkbox" name="specials_status" value="1" id="input_specials_status" style="vertical-align:middle;" <?php echo $status; ?> /><label for="input_specials_status"> <?php echo TEXT_EDIT_STATUS; ?> </label> <?php } ?> </div> </div> <div class='clearfix' ></div> <div class="col-xs-12"> <div class="main" style="padding:3px; background: #D8D8D8;"> <?php echo TEXT_SPECIALS_PRICE_TIP; ?> </div> </div> <?php } ?> </div> </div> <?php }
/** * xtcFormatSpecialGraduated * * @param integer $pID * @param double $sPrice * @param double $pPrice * @param boolean $format * @param integer $vpeStatus * @param integer $pID * @return unknown */ function xtcFormatSpecialGraduated($pID, $sPrice, $pPrice, $format, $vpeStatus = 0, $tax_class) { if ($pPrice == 0) { return $this->xtcFormat($sPrice, $format, 0, false, $vpeStatus); } if ($discount = $this->xtcCheckDiscount($pID)) { $sPrice -= $sPrice / 100 * $discount; } if ($format) { $sQuery = xtDBquery("SELECT max(quantity) AS qty\n FROM " . TABLE_PERSONAL_OFFERS_BY . $this->actualGroup . "\n WHERE products_id='" . $pID . "'"); $sQuery = xtc_db_fetch_array($sQuery, true); if ($this->cStatus['customers_status_graduated_prices'] == '1' && $sQuery['qty'] > 1) { $bestPrice = $this->xtcGetGraduatedPrice($pID, $sQuery['qty']); if ($discount) { $bestPrice -= $bestPrice / 100 * $discount; } $price = FROM . $this->xtcFormat($bestPrice, $format, $tax_class) . ' <br /><small>' . UNIT_PRICE . $this->xtcFormat($sPrice, $format) . '</small>'; } else { if ($sPrice != $pPrice) { $price = '<span class="productOldPrice">' . MSRP . ' ' . $this->xtcFormat($pPrice, $format) . '</span><br />' . YOUR_PRICE . $this->checkAttributes($pID) . $this->xtcFormat($sPrice, $format); } else { $price = $this->xtcFormat($sPrice, $format); } } if ($vpeStatus == 0) { return $price; } else { return array('formated' => $price, 'plain' => $sPrice); } } else { return round($sPrice, $this->currencies[$this->actualCurr]['decimal_places']); } }
function profile_delete_all() { $sql = "delete from " . TABLE_PDFBILL_PROFILE; xtDBquery($sql); }
} if (!isset($new_products_category_id) || $new_products_category_id == '0') { $new_products_query = "SELECT * \n FROM " . TABLE_PRODUCTS . " p,\n " . TABLE_PRODUCTS_DESCRIPTION . " pd\n WHERE p.products_id = pd.products_id\n AND p.products_startpage = '1'\n " . $group_check . "\n " . $fsk_lock . "\n AND p.products_status = '1'\n AND pd.language_id = '" . (int) $_SESSION['languages_id'] . "'\n ORDER BY p.products_startpage_sort ASC\n LIMIT " . MAX_DISPLAY_NEW_PRODUCTS; } else { $days = ''; if (MAX_DISPLAY_NEW_PRODUCTS_DAYS != '0') { $date_new_products = date("Y.m.d", mktime(1, 1, 1, date("m"), date("d") - MAX_DISPLAY_NEW_PRODUCTS_DAYS, date("Y"))); $days = " AND p.products_date_added > '" . $date_new_products . "' "; } $new_products_query = "SELECT * \n FROM " . TABLE_PRODUCTS . " p,\n " . TABLE_PRODUCTS_DESCRIPTION . " pd,\n " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c,\n " . TABLE_CATEGORIES . " c\n WHERE c.categories_status='1'\n AND p.products_id = p2c.products_id\n AND p.products_id = pd.products_id\n AND p2c.categories_id = c.categories_id\n " . $group_check . "\n " . $fsk_lock . "\n " . $days . "\n AND c.parent_id = '" . $new_products_category_id . "'\n AND p.products_status = '1'\n AND pd.language_id = '" . (int) $_SESSION['languages_id'] . "'\n ORDER BY p.products_date_added DESC\n LIMIT " . MAX_DISPLAY_NEW_PRODUCTS; } $row = 0; $module_content = array(); //Produkte mit gleicher ID nicht doppelt anzeigen $pid_array = array(); $new_products_query = xtDBquery($new_products_query); while ($new_products = xtc_db_fetch_array($new_products_query, true)) { if (!in_array($new_products['products_id'], $pid_array)) { $module_content[] = $product->buildDataArray($new_products); } $pid_array[] = $new_products['products_id']; } unset($pid_array); if (sizeof($module_content) >= 1) { $module_smarty->assign('language', $_SESSION['language']); $module_smarty->assign('module_content', $module_content); // set cache ID if (!CacheCheck()) { $module_smarty->caching = 0; if (!isset($new_products_category_id) || $new_products_category_id == '0') { $module = $module_smarty->fetch(CURRENT_TEMPLATE . '/module/new_products_default.html');