예제 #1
0
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 . '&nbsp;&nbsp;&nbsp;', $exclude, $category_tree_array, false, $cPath);
    }
    return $category_tree_array;
}
예제 #2
0
chdir('../../');
require_once 'includes/application_top.php';
// include easymarketing api header
require_once DIR_FS_CATALOG . 'api/easymarketing/includes/header.php';
// include easymarketing functions
require_once 'includes/functions.php';
$parent_id = isset($_GET['parent_id']) ? (int) $_GET['parent_id'] : NULL;
$oLanguage = new language($_GET['lang']);
// process request
if (isset($parent_id)) {
    // init array
    $categories_array = array();
    // sql query for categories
    $categories_query_raw = "SELECT c.categories_id,\n                                  cd.categories_name\n                             FROM " . TABLE_CATEGORIES . " c\n                             JOIN " . TABLE_CATEGORIES_DESCRIPTION . " cd\n                                  ON (c.categories_id = cd.categories_id\n                                     AND cd.language_id = '" . $oLanguage->language['id'] . "')\n                            WHERE c.categories_status = '1'\n                              AND c.categories_id = '" . xtc_db_prepare_input($parent_id) . "'";
    // make sql query
    $categories_query_result = xtc_db_query($categories_query_raw);
    // check for result
    if (xtc_db_num_rows($categories_query_result) > 0) {
        while ($categories = xtc_db_fetch_array($categories_query_result)) {
            // build categories array
            $categories_array = array('id' => $categories['categories_id'], 'name' => mod_convert_string($categories['categories_name']), 'url' => xtc_href_link(FILENAME_DEFAULT, xtc_category_link($categories['categories_id'], $categories['categories_name']), 'NONSSL', false), 'children' => mod_get_sub_categories($categories['categories_id']));
        }
    } elseif ($parent_id == '0') {
        // build categories array
        $categories_array = array('id' => $parent_id, 'name' => mod_convert_string(STORE_NAME), 'url' => xtc_href_link(FILENAME_DEFAULT, '', 'NONSSL', false), 'children' => mod_get_sub_categories($parent_id));
    }
    // output categories
    mod_stream_response($categories_array);
} else {
    mod_stream_invalid_request();
}
         $target = ' target="_blank"';
     } elseif ($imagesliders_data['imagesliders_url_target'] == '2') {
         $target = ' target="_top"';
     } elseif ($imagesliders_data['imagesliders_url_target'] == '3') {
         $target = ' target="_self"';
     } elseif ($imagesliders_data['imagesliders_url_target'] == '4') {
         $target = ' target="_parent"';
     }
     if ($imagesliders_data['imagesliders_url_typ'] == '0') {
         $url = $imagesliders_data['imagesliders_url'];
     } elseif ($imagesliders_data['imagesliders_url_typ'] == '1') {
         $url = xtc_href_link($imagesliders_data['imagesliders_url']);
     } elseif ($imagesliders_data['imagesliders_url_typ'] == '2') {
         $url = xtc_href_link(FILENAME_PRODUCT_INFO, xtc_product_link((int) $imagesliders_data['imagesliders_url'], xtc_get_products_name((int) $imagesliders_data['imagesliders_url'])));
     } elseif ($imagesliders_data['imagesliders_url_typ'] == '3') {
         $url = xtc_href_link(FILENAME_DEFAULT, xtc_category_link((int) $imagesliders_data['imagesliders_url'], xtc_get_categories_name((int) $imagesliders_data['imagesliders_url'])));
     } elseif ($imagesliders_data['imagesliders_url_typ'] == '4') {
         $content_querys = "SELECT content_title FROM " . TABLE_CONTENT_MANAGER . " WHERE languages_id='" . (int) $_SESSION['languages_id'] . "' and content_group = '" . (int) $imagesliders_data['imagesliders_url'] . "' and content_status=1 order by sort_order";
         $content_querys = xtDBquery($content_querys);
         $content_title = xtc_db_fetch_array($content_querys, true);
         $SEF = '';
         if (SEARCH_ENGINE_FRIENDLY_URLS == 'true') {
             $SEF = '&content=' . xtc_cleanName($content_title['content_title']);
         }
         $url = xtc_href_link(FILENAME_CONTENT, 'coID=' . (int) $imagesliders_data['imagesliders_url'] . $SEF);
     }
 }
 $imagesliders_data['imagesliders_image_url'] = DIR_WS_IMAGES . $imagesliders_data['imagesliders_image'];
 $imagesliders_data['imagesliders_image_url_link'] = $url;
 $imagesliders_data['imagesliders_image_url_target'] = $target;
 $imagesliders_array[] = $imagesliders_data;
    while ($cat_data = xtc_db_fetch_array($cat_result)) {
        $cat_array[$cat_data['categories_id']][$cat_data['code']] = $cat_data;
    }
}
reset($cat_array);
foreach ($cat_array as $lang_array) {
    foreach ($lang_array as $cat_id => $cat_data) {
        $lang_param = $cat_data['code'] != DEFAULT_LANGUAGE ? '&language=' . $cat_data['code'] : '';
        $date = $cat_data['last_modified'] != NULL ? $cat_data['last_modified'] : $cat_data['date_added'];
        /** 
         * @author Timo Paul (mail[at]timopaul.biz) 
         * @since Saturday, 16-th May 2009 
         *  
         * generate seo-frendly uri's 
         */
        $cPath_new = xtc_category_link($cat_data['categories_id'], $cat_data['categories_name']);
        $string = sprintf(SITEMAP_ENTRY, xtc_href_link(FILENAME_DEFAULT, $cPath_new), PRIORITY_CATEGORIES, iso8601_date($date), CHANGEFREQ_CATEGORIES);
        $c_cat_total++;
        output_entry();
    }
}
$stmt = " \n    SELECT \n      p.*, \n      pd.*, \n      UNIX_TIMESTAMP(p.products_date_added) as products_date_added, \n      UNIX_TIMESTAMP(p.products_last_modified) as products_last_modified, \n      l.* \n    FROM \n      " . TABLE_PRODUCTS . " p,  \n      " . TABLE_PRODUCTS_DESCRIPTION . " pd, \n      " . TABLE_LANGUAGES . " l \n    WHERE \n      p.products_status='1' AND \n      p.products_id = pd.products_id AND \n      pd.language_id = l.languages_id \n    ORDER BY \n      p.products_id \n  ";
$product_result = xtc_db_query($stmt);
if (xtc_db_num_rows($product_result) > 0) {
    while ($product_data = xtc_db_fetch_array($product_result)) {
        /** 
         * @author Timo Paul (mail[at]timopaul.biz) 
         * @since Saturday, 16-th May 2009 
         *  
         * generate article-array with valid seo-uri's 
         */
    $link_index = HEADER_TITLE_TOP;
} else {
    $breadcrumb->add(HEADER_TITLE_TOP, xtc_href_link('../'));
    $breadcrumb->add(HEADER_TITLE_CATALOG, xtc_href_link(FILENAME_DEFAULT));
    $link_index = HEADER_TITLE_CATALOG;
}
// add category names or the manufacturer name to the breadcrumb trail
if (isset($cPath_array)) {
    for ($i = 0, $n = sizeof($cPath_array); $i < $n; $i++) {
        $group_check = '';
        if (GROUP_CHECK == 'true') {
            $group_check = "AND c.group_permission_" . $_SESSION['customers_status']['customers_status_id'] . "=1 ";
        }
        $categories_query = xtDBquery("-- /includes/application_top.php\n                                   SELECT cd.categories_name\n                                     FROM " . TABLE_CATEGORIES_DESCRIPTION . " cd,\n                                          " . TABLE_CATEGORIES . " c\n                                    WHERE cd.categories_id = '" . $cPath_array[$i] . "'\n                                      AND c.categories_id=cd.categories_id\n                                          " . $group_check . "\n                                      AND cd.language_id='" . (int) $_SESSION['languages_id'] . "'");
        if (xtc_db_num_rows($categories_query, true) > 0) {
            $categories = xtc_db_fetch_array($categories_query, true);
            $breadcrumb->add($categories['categories_name'], xtc_href_link(FILENAME_DEFAULT, xtc_category_link($cPath_array[$i], $categories['categories_name'])));
        } else {
            break;
        }
    }
} elseif (isset($_GET['manufacturers_id']) && xtc_not_null($_GET['manufacturers_id'])) {
    $_GET['manufacturers_id'] = (int) $_GET['manufacturers_id'];
    $manufacturers_query = xtDBquery("-- /includes/application_top.php\n                                    SELECT manufacturers_name \n                                      FROM " . TABLE_MANUFACTURERS . " \n                                     WHERE manufacturers_id = '" . (int) $_GET['manufacturers_id'] . "'");
    $manufacturers = xtc_db_fetch_array($manufacturers_query, true);
    $breadcrumb->add($manufacturers['manufacturers_name'], xtc_href_link(FILENAME_DEFAULT, xtc_manufacturer_link((int) $_GET['manufacturers_id'], $manufacturers['manufacturers_name'])));
}
// add the products model/name to the breadcrumb trail
if ($product->isProduct()) {
    $breadcrumb->add($product->data['products_name'], xtc_href_link(FILENAME_PRODUCT_INFO, xtc_product_link($product->data['products_id'], $product->data['products_name'])));
}
function xtc_show_category($counter, $oldlevel = 1)
{
    global $foo, $categories_string, $id, $cPath;
    $level = $foo[$counter]['level'] + 1;
    //BOF +++ UL LI Verschachtelung  mit Quelltext Tab Einzügen +++
    $ul = $tab = '';
    for ($i = 1; $i <= $level; $i++) {
        $tab .= "\t";
    }
    if ($level > $oldlevel) {
        //neue Unterebene
        $ul = "\n" . $tab . '<ul class="nav nav-pills nav-stacked">' . "\n";
        $categories_string = rtrim($categories_string, "\n");
        //Zeilenumbruch entfernen
        $categories_string = substr($categories_string, 0, strlen($categories_string) - 5);
        //letztes  </li>  entfernen
    } elseif ($level < $oldlevel) {
        //zurück zur höheren Ebene
        $ul = close_ul_tags($level, $oldlevel);
    }
    //EOF +++ UL LI Verschachtelung  mit Quelltext Tab Einzügen +++
    //BOF +++ Kategorien markieren +++
    $category_path = explode('_', $cPath);
    //Kategoriepfad in Array einlesen
    //Elternkategorie markieren
    $cat_active_parent = '';
    $in_path = in_array($counter, $category_path);
    //Testen, ob aktuelle Kategorie ID im Kategoriepfad enthalten ist
    if ($in_path) {
        $cat_active_parent = " activeparent" . $level;
    }
    //Aktive Kategorie markieren
    $cat_active = '';
    $this_category = array_pop($category_path);
    //Letzter Eintrag im Array ist die aktuelle Kategorie
    if ($this_category == $counter) {
        $cat_active = " active" . $level;
    }
    //EOF +++ Kategorien markieren +++
    //BOF +++ Kategorie Linkerstellung +++
    $cPath_new = xtc_category_link($counter, $foo[$counter]['name']);
    if (trim($categories_string == '')) {
        $categories_string = "\n";
    }
    //Zeilenschaltung Codedarstellung
    $categories_string .= $ul;
    //UL LI Versschachtelung
    $categories_string .= $tab;
    //Tabulator Codedarstellung
    $categories_string .= '<li class="level' . $level . $cat_active . $cat_active_parent . '">';
    $categories_string .= '<a href="' . xtc_href_link(FILENAME_DEFAULT, $cPath_new) . '" title="' . $foo[$counter]['name'] . '">';
    $categories_string .= '<h3 class="h6">' . $foo[$counter]['name'] . '</h3>';
    //Anzeige Anzahl der Produkte in Kategorie, für bessere Performance im Admin deaktivieren
    if (SHOW_COUNTS == 'true') {
        $products_in_category = xtc_count_products_in_category($counter);
        if ($products_in_category > 0) {
            $categories_string .= '&nbsp;(' . $products_in_category . ')';
        }
    }
    $categories_string .= '</a></li>';
    $categories_string .= "\n";
    //Zeilenschaltung Codedarstellung
    //EOF  +++ Kategorie Linkerstellung +++
    //Nächste Kategorie
    if ($foo[$counter]['next_id']) {
        xtc_show_category($foo[$counter]['next_id'], $level);
    } else {
        if ($level > 1) {
            $categories_string .= close_ul_tags(1, $level);
        }
        return;
    }
}
    // get category name
    $categories_query = xtDBquery("select
    			                                        cd.categories_name
    			                                        from ".TABLE_CATEGORIES_DESCRIPTION." cd,
    			                                        ".TABLE_CATEGORIES." c,
    			                                         " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c
    			                                        WHERE c.categories_id=cd.categories_id
    			                                        and p2c.products_id = '".(int) $_SESSION['tracking']['products_history'][$random_last_viewed]."'
    			                                        and cd.language_id='".(int) $_SESSION['languages_id']."'");
    $categories_data = xtc_db_fetch_array($categories_query,true);
    */
    //EOF - Dokuman - 2010-01-29 - category name selection included in one select statement
    $random_products_price = $xtPrice->xtcGetPrice($random_product['products_id'], $format = true, 1, $random_product['products_tax_class_id'], $random_product['products_price']);
    $category_path = xtc_get_path($random_product['categories_id']);
    if ($random_product['products_name'] != '') {
        $box_smarty->assign('box_content', $product->buildDataArray($random_product));
        $box_smarty->assign('MY_PAGE', 'TEXT_MY_PAGE');
        $box_smarty->assign('WATCH_CATGORY', 'TEXT_WATCH_CATEGORY');
        $box_smarty->assign('MY_PERSONAL_PAGE', xtc_href_link(FILENAME_ACCOUNT));
        //BOF - Dokuman - 2010-01-29 - category name selection included in one select statement
        //$box_smarty->assign('CATEGORY_LINK', xtc_href_link(FILENAME_DEFAULT, xtc_category_link($categories_data['categories_id'], $categories_data['categories_name'])));
        //$box_smarty->assign('CATEGORY_NAME', $categories_data['categories_name']);
        $box_smarty->assign('CATEGORY_LINK', xtc_href_link(FILENAME_DEFAULT, xtc_category_link($random_product['categories_id'], $random_product['categories_name'])));
        $box_smarty->assign('CATEGORY_NAME', $random_product['categories_name']);
        //BOF - Dokuman - 2010-01-29 - category name selection included in one select statement
        $box_smarty->assign('language', $_SESSION['language']);
        $box_smarty->caching = 0;
        $box_last_viewed = $box_smarty->fetch(CURRENT_TEMPLATE . '/boxes/box_last_viewed.html');
        $smarty->assign('box_LAST_VIEWED', $box_last_viewed);
    }
}
    $prev_link = xtc_href_link(FILENAME_PRODUCT_INFO, xtc_product_link($p_data[$prev_id]['pID'], $p_data[$prev_id]['pName']));
    // check if prev id = first
    if ($prev_id != 0) {
        $first_link = xtc_href_link(FILENAME_PRODUCT_INFO, xtc_product_link($p_data[0]['pID'], $p_data[0]['pName']));
    }
}
// check if key = last
if ($actual_key == sizeof($p_data) - 1) {
    // actual key is last
} else {
    $next_id = $actual_key + 1;
    $next_link = xtc_href_link(FILENAME_PRODUCT_INFO, xtc_product_link($p_data[$next_id]['pID'], $p_data[$next_id]['pName']));
    // check if next id = last
    if ($next_id != sizeof($p_data) - 1) {
        $last_link = xtc_href_link(FILENAME_PRODUCT_INFO, xtc_product_link($p_data[sizeof($p_data) - 1]['pID'], $p_data[sizeof($p_data) - 1]['pName']));
    }
}
$overview_link = xtc_href_link(FILENAME_DEFAULT, xtc_category_link($current_category_id));
$module_smarty->assign('FIRST', $first_link);
$module_smarty->assign('PREVIOUS', $prev_link);
$module_smarty->assign('OVERVIEW', $overview_link);
$module_smarty->assign('NEXT', $next_link);
$module_smarty->assign('LAST', $last_link);
// BOF - Tomcraft - 2010-05-02 - Show actual product count in product_navigator
$module_smarty->assign('ACTUAL_PRODUCT', $actual_key + 1);
// EOF - Tomcraft - 2010-05-02 - Show actual product count in product_navigator
$module_smarty->assign('PRODUCTS_COUNT', count($p_data));
$module_smarty->assign('language', $_SESSION['language']);
$module_smarty->caching = 0;
$product_navigator = $module_smarty->fetch(CURRENT_TEMPLATE . '/module/product_navigator.html');
$info_smarty->assign('PRODUCT_NAVIGATOR', $product_navigator);