function product_path_by_name($product, $lang) { require_once DIR_FS_INC . 'xtc_get_product_path.inc.php'; $product_path_by_id = xtc_get_product_path($product); $product_categories_id = explode("_", $product_path_by_id); $new_product_path_by_name = ''; for ($i = 0, $n = sizeof($product_categories_id); $i < $n; $i++) { $product_path_by_name_query = xtc_db_query("select categories_name from " . TABLE_CATEGORIES_DESCRIPTION . " where categories_id = '" . $product_categories_id[$i] . "' and language_id = '" . (int) $lang . "'"); $product_path_by_name = xtc_db_fetch_array($product_path_by_name_query); $new_product_path_by_name .= $product_path_by_name['categories_name']; if ($i + 1 < $n) { $new_product_path_by_name .= '/'; } } return $new_product_path_by_name; }
$site = explode('_', $_GET['cat']); $cID = $site[0]; $cID = str_replace('c', '', $cID); $_GET['cPath'] = xtc_get_category_path($cID); } // manufacturer URLS if (isset($_GET['manu'])) { $site = explode('_', $_GET['manu']); $mID = $site[0]; $mID = (int) str_replace('m', '', $mID); $_GET['manufacturers_id'] = $mID; } // calculate category path if (isset($_GET['cPath'])) { $cPath = $_GET['cPath'] = xtc_input_validation($_GET['cPath'], 'cPath', ''); } elseif (is_object($product) && !isset($_GET['manufacturers_id'])) { if ($product->isProduct()) { $cPath = xtc_get_product_path($actual_products_id); } else { $cPath = ''; } } else { $cPath = ''; } if (xtc_not_null($cPath)) { $cPath_array = xtc_parse_category_path($cPath); $cPath = implode('_', $cPath_array); $current_category_id = $cPath_array[sizeof($cPath_array) - 1]; } else { $current_category_id = 0; }
function calculate_credit($amount) { global $order, $xtPrice, $tax_info_excl; $od_amount = 0; if (isset($_SESSION['cc_id'])) { //web28 -2011-11-06 - FIX: only active coupon $coupon_query = xtc_db_query("select coupon_code\n from " . TABLE_COUPONS . "\n where coupon_id = '" . $_SESSION['cc_id'] . "'\n and coupon_active = 'Y'\n "); if (xtc_db_num_rows($coupon_query) != 0) { $coupon_result = xtc_db_fetch_array($coupon_query); // KUPON CODE $this->coupon_code = $coupon_result['coupon_code']; // INFOS �BER DEN KUPON AUSLESEN //web28 -2011-11-06 - FIX: only active coupon $coupon_get = xtc_db_query("select coupon_amount, coupon_minimum_order,\n restrict_to_products, restrict_to_categories,\n coupon_type\n from " . TABLE_COUPONS . "\n where coupon_code = '" . $coupon_result['coupon_code'] . "'\n and coupon_active = 'Y'\n "); $get_result = xtc_db_fetch_array($coupon_get); $c_deduct = $xtPrice->xtcCalculateCurr($get_result['coupon_amount']); //FIX - web28 - 2012-04-24 - calculate currencies // KUPON VERSANDKOSTENFREI if ($get_result['coupon_type'] == 'S') { //$c_deduct = $order->info['shipping_cost']; $c_deduct = $this->get_shipping_cost(); } if ($get_result['coupon_type'] == 'S' && $get_result['coupon_amount'] > 0) { $c_deduct = $c_deduct + $xtPrice->xtcCalculateCurr($get_result['coupon_amount']); //FIX - web28 - 2012-04-24 - calculate currencies $flag_s = true; } //echo 'VK'. $c_deduct; if ($xtPrice->xtcCalculateCurr($get_result['coupon_minimum_order']) <= $this->get_order_total()) { if ($get_result['restrict_to_products'] || $get_result['restrict_to_categories']) { //BOF -web28- 2010-06-19 - FIX - new calculate coupon amount $pr_c = 0; //web28- 2010-05-21 - FIX - restrict max coupon amount //allowed products if ($get_result['restrict_to_products']) { $pr_ids = explode(",", $get_result['restrict_to_products']); for ($i = 0, $n = sizeof($order->products); $i < $n; ++$i) { for ($ii = 0, $nn = count($pr_ids); $ii < $nn; $ii++) { if ($pr_ids[$ii] == xtc_get_prid($order->products[$i]['id'])) { if ($get_result['coupon_type'] == 'P') { $pr_c = $this->product_price($order->products[$i]['id']); //web28- 2010-07-29 - $order->products[$i]['id'] //Fred 2003-10-28, fix for the row above, otherwise the discount is calc based on price excl VAT! $pod_amount = round($pr_c * 10) / 10 * $c_deduct / 100; $od_amount = $od_amount + $pod_amount; } else { $od_amount = $c_deduct; $pr_c += $this->product_price($order->products[$i]['id']); //web28- 2010-07-29 - FIX $order->products[$i]['id'] //web28- 2010-05-21 - FIX - restrict max coupon amount } } } } } //allowed categories if ($get_result['restrict_to_categories']) { $cat_ids = explode(",", $get_result['restrict_to_categories']); for ($i = 0, $n = sizeof($order->products); $i < $n; ++$i) { //BOF - web28 - 2010-06-19 - test for product_id to prevent double counting if ($get_result['restrict_to_products'] && in_array(xtc_get_prid($order->products[$i]['id']), $pr_ids)) { $p_flag = true; } else { $p_flag = false; } //EOF - web28 - 2010-06-19 - test for product_id to prevent double counting //BOF - web28 - 2012-01-10 - new restrict_to_categories check $cat_path = xtc_get_product_path(xtc_get_prid($order->products[$i]['id'])); $prod_cat_ids_array = explode("_", $cat_path); for ($ii = 0, $nn = count($cat_ids); $ii < $nn; $ii++) { if (in_array($cat_ids[$ii], $prod_cat_ids_array) && !$p_flag) { if ($get_result['coupon_type'] == 'P') { $pr_c = $this->product_price($order->products[$i]['id']); //web28- 2010-07-29 - FIX no xtc_get_prid $pod_amount = round($pr_c * 10) / 10 * $c_deduct / 100; $od_amount = $od_amount + $pod_amount; } else { $od_amount = $c_deduct; $pr_c += $this->product_price($order->products[$i]['id']); //web28- 2010-07-29 - FIX no xtc_get_prid //web28- 2010-05-21 - FIX - restrict max coupon amount } } } //EOF - web28 - 2012-01-10 - new restrict_to_categories check } } if ($get_result['coupon_type'] == 'F' && $od_amount > $pr_c) { $od_amount = $pr_c; } //web28- 2010-05-21 - FIX - restrict max coupon amount //EOF -web28- 2010-06-19 - FIX - new calculate coupon amount } else { if ($get_result['coupon_type'] != 'P') { $od_amount = $c_deduct; } else { $od_amount = $amount * $xtPrice->xtcCalculateCurr($get_result['coupon_amount']) / 100; //FIX - web28 - 2012-04-24 - calculate currencies } } //echo 'OD'.$od_amount; //BOF - web28- 2010-06-19 - ADD no discount for special offers if (MODULE_ORDER_TOTAL_COUPON_SPECIAL_PRICES != 'true') { $pr_c = 0; for ($i = 0; $i < sizeof($order->products); $i++) { $product_query = "select specials_new_products_price from " . TABLE_SPECIALS . " where products_id = '" . xtc_get_prid($order->products[$i]['id']) . "' and status=1"; $product_query = xtDBquery($product_query); $product = xtc_db_fetch_array($product_query, true); if ($product['specials_new_products_price']) { if ($get_result['coupon_type'] == 'P') { $pr_c = $this->product_price($order->products[$i]['id']); //web28- 2010-07-29 - FIX no xtc_get_prid $pod_amount = round($pr_c * 10) / 10 * $c_deduct / 100; $od_amount -= $pod_amount; } else { $pr_c += $this->product_price($order->products[$i]['id']); //web28- 2010-07-29 - FIX no xtc_get_prid } } } if ($od_amount < 0) { $od_amount = 0; } if ($amount <= $pr_c) { $od_amount = 0; } } //EOF - web28- 2010-06-19 - ADD no discount for special offers } } if ($flag_s) { $amount += $this->get_shipping_cost(); //Wenn Versandkostenfrei: Versandkosten und Gutscheinwert addieren } // RABATT �BERSTEIGT DEN BESTELLWERT, DANN RABATT GLEICH BESTELLWERT if ($od_amount > $amount) { $od_amount = $amount; } //echo 'OD'.$od_amount; } //KORREKTUR wenn Kunde Nettopreise und Steuer in Rechnung: Couponwert mit Steuersatz prozentual korrigiert $this->tax_info = ''; if ($_SESSION['customers_status']['customers_status_show_price_tax'] == 0 && $_SESSION['customers_status']['customers_status_add_tax_ot'] == 1 && $amount > 0 && $get_result['coupon_type'] != 'P') { $od_amount = $od_amount / (1 + $order->info['tax'] / $amount); $this->tax_info = ' (' . trim(str_replace(array(' %s', ','), array('', ''), TAX_INFO_EXCL)) . ')'; } return $xtPrice->xtcFormat($od_amount, false); }
$breadcrumb->add(NAVBAR_TITLE_ACCOUNT, xtc_href_link(FILENAME_ACCOUNT, '', 'SSL')); require DIR_WS_INCLUDES . 'header.php'; if ($messageStack->size('account') > 0) { $smarty->assign('error_message', $messageStack->output('account')); } $i = 0; //BOF - DokuMan - 2010-02-28 - set undefined Undefined variables //$max = count($_SESSION['tracking']['products_history']); $max = isset($_SESSION['tracking']['products_history']) ? count($_SESSION['tracking']['products_history']) : 0; $products_history = array(); $also_purchased_history = array(); //EOF - DokuMan - 2010-02-28 - set undefined Undefined variables while ($i < $max) { $product_history_query = xtDBquery("select * from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_id=pd.products_id and pd.language_id='" . (int) $_SESSION['languages_id'] . "' and p.products_status = '1' and p.products_id = '" . $_SESSION['tracking']['products_history'][$i] . "'"); $history_product = xtc_db_fetch_array($product_history_query, true); $cpath = xtc_get_product_path($_SESSION['tracking']['products_history'][$i]); if ($history_product['products_status'] != 0) { $history_product = array_merge($history_product, array('cat_url' => xtc_href_link(FILENAME_DEFAULT, 'cPath=' . $cpath))); $products_history[] = $product->buildDataArray($history_product); } $i++; } $order_content = ''; if (xtc_count_customer_orders() > 0) { $orders_query = xtc_db_query("select\n\t o.orders_id,\n\t o.date_purchased,\n\t o.delivery_name,\n\t o.delivery_country,\n\t o.billing_name,\n\t o.billing_country,\n\t ot.text as order_total,\n\t s.orders_status_name\n\t from " . TABLE_ORDERS . " o, " . TABLE_ORDERS_TOTAL . "\n\t ot, " . TABLE_ORDERS_STATUS . " s\n\t where o.customers_id = '" . (int) $_SESSION['customer_id'] . "'\n\t and o.orders_id = ot.orders_id\n\t and ot.class = 'ot_total'\n\t and o.orders_status = s.orders_status_id\n\t and s.language_id = '" . (int) $_SESSION['languages_id'] . "'\n\t order by orders_id desc limit 3"); while ($orders = xtc_db_fetch_array($orders_query)) { if (xtc_not_null($orders['delivery_name'])) { $order_name = $orders['delivery_name']; $order_country = $orders['delivery_country']; } else { $order_name = $orders['billing_name'];
function shopstat_getSEO($page = '', $parameters = '', $connection = 'NONSSL', $add_session_id = true, $search_engine_safe = true, $mode = 'user') { global $languages_id; $link = ""; $maname = ""; if ($mode == 'admin') { require_once DIR_FS_INC . 'xtc_parse_category_path.inc.php'; require_once DIR_FS_INC . 'xtc_get_product_path.inc.php'; require_once DIR_FS_INC . 'xtc_get_parent_categories.inc.php'; require_once DIR_FS_INC . 'xtc_check_agent.inc.php'; } else { require_once DIR_FS_INC . 'xtc_get_products_name.inc.php'; require_once DIR_FS_INC . 'xtc_get_manufacturers.inc.php'; } //-- XTC !isset($languages_id) ? $languages_id = (int) $_SESSION['languages_id'] : false; //BOF - web28 - 2010-08-18 -- Die Parameter aufspalten $pararray = array(); foreach (explode("&", $parameters) as $pair) { $values = explode("=", $pair); if (!empty($values[0])) { $pararray[$values[0]] = $values[1]; } } $cPath = isset($pararray['cPath']) ? $pararray['cPath'] : false; $prodid = isset($pararray['products_id']) ? $pararray['products_id'] : false; $content = isset($pararray['content']) ? $pararray['content'] : false; $coid = isset($pararray['coID']) ? $pararray['coID'] : false; $maid = isset($pararray['manufacturers_id']) ? $pararray['manufacturers_id'] : false; $pager = isset($pararray['page']) ? $pararray['page'] : false; $lang = isset($pararray['language']) ? $pararray['language'] : ''; $sort = isset($pararray['sort']) ? $pararray['sort'] : ''; $filter_id = isset($pararray['filter_id']) ? $pararray['filter_id'] : ''; $viewmode = isset($pararray['viewmode']) ? $pararray['viewmode'] : ''; $view_mode = isset($pararray['viewmode']) ? $pararray['view_mode'] : ''; $prllset = isset($pararray['prllset']) ? $pararray['prllset'] : ''; $action = isset($pararray['action']) ? $pararray['action'] : ''; //EOF - web28 - 2010-08-18 -- Die Parameter aufspalten $go = true; //-- Nur bei der index.php und product_info.php if ($page != "index.php" && $page != "product_info.php" && $page != "shop_content.php") { $go = false; } elseif (strlen($sort) > 0) { //-- Unter diesen Bedingungen werden die URLs nicht umgewandelt //-- Sortieren $go = false; } elseif (strlen($filter_id) > 0) { //-- Sortieren der Herstellerprodukte $go = false; } elseif (strlen($view_mode) > 0) { $go = false; } elseif (strlen($viewmode) > 0) { $go = false; } elseif (strlen($prllset) > 0) { $go = false; } elseif (strlen($action) > 0) { //-- Andere Aktion $go = false; } //BOF web28 - 2010-08-18 -- Falls eine Sprache übergeben wurde, wird diese als 'Linksprache' definiert if (strlen($lang) > 0) { $seolng = new language(); $lang_id = $seolng->catalog_languages[$lang]['id']; } else { $lang_id = $languages_id; } //EOF- web28 - 2010-08-18 -- Falls eine Sprache übergeben wurde, wird diese als 'Linksprache' definiert if ($go && (xtc_not_null($maid) || xtc_not_null($cPath) || xtc_not_null($prodid) || xtc_not_null($coid))) { if ($connection == 'SSL') { if (ENABLE_SSL == true) { $link = HTTPS_SERVER . DIR_WS_CATALOG; } else { $link = HTTP_SERVER . DIR_WS_CATALOG; } } else { $link = HTTP_SERVER . DIR_WS_CATALOG; } if (xtc_not_null($cPath) || xtc_not_null($prodid)) { $cPath_array = xtc_parse_category_path($cPath); $cPath = implode('_', $cPath_array); $current_category_id = $cPath_array[sizeof($cPath_array) - 1]; if (!$current_category_id && $prodid) { $current_category_id = xtc_get_product_path($prodid); } // ------------------------------------------------- if (!$prodid) { $category['categories_name'] = shopstat_getRealPath($cPath, '/', $lang_id); $link .= shopstat_hrefCatlink($category['categories_name'], $cPath, $pager); } else { $category['categories_name'] = ''; if (ADD_CAT_NAMES_TO_PRODUCT_LINK) { $category['categories_name'] = shopstat_getRealPath(xtc_get_product_path($prodid), '/', $lang_id); } $link .= shopstat_hrefLink($category['categories_name'], xtc_get_products_name($prodid, $lang_id), $prodid); } } elseif (xtc_not_null($coid)) { $content = shopstat_getContentName($coid, $lang_id); $link .= shopstat_hrefContlink($content, $coid); } elseif (xtc_not_null($maid)) { $manufacturers = xtc_get_manufacturers(); foreach ($manufacturers as $manufacturer) { if ($manufacturer['id'] == $maid) { $maname = $manufacturer['text']; break; } } $link .= shopstat_hrefManulink($maname, $maid, $pager); } $separator = '?'; //-- Concat the lang-var //-- Check parameters and given language, just concat //-- if the language is different //web28 - 2010-08-18 -- Parameter für die Sprachumschaltung if (strlen($lang) > 0 && $lang_id != $languages_id) { $link .= $separator . 'language=' . $lang; } } return $link; }