function olc_get_categories($categories_array = '', $parent_id = '0', $indent = '')
{
    $parent_id = olc_db_prepare_input($parent_id);
    if (!is_array($categories_array)) {
        $categories_array = array();
    }
    $sql = SELECT . "\n\tc.categories_id,\n\tcd.categories_name,\n\tcd.categories_heading_title,\n\tcd.categories_description\n\tfrom " . TABLE_CATEGORIES . " c,\t" . TABLE_CATEGORIES_DESCRIPTION . " cd\n\twhere\n\tparent_id = '" . olc_db_input($parent_id) . "'\n\tand c.categories_id = cd.categories_id\n\tand c.categories_status != 0\n\tand cd.language_id = '" . SESSION_LANGUAGE_ID . "'\n\torder by sort_order, cd.categories_name";
    $categories_query = olc_db_query($sql);
    $indent_two_nbsp = $indent . HTML_NBSP . HTML_NBSP;
    while ($categories = olc_db_fetch_array($categories_query)) {
        $name = $categories['categories_name'];
        $title = $categories['categories_heading_title'];
        if ($title == EMPTY_STRING) {
            $title = $name;
        }
        $categories_id = $categories['categories_id'];
        $categories_array[] = array('id' => $categories_id, 'text' => $indent . $name, 'title' => $title);
        if ($categories_id != $parent_id) {
            $categories_array = olc_get_categories($categories_array, $categories_id, $indent_two_nbsp);
        }
    }
    return $categories_array;
}
coolMenu for osCommerce
author:	Andreas Kothe
url:		http://www.oddbyte.de

modified 2006 for OL-Commerce v2/AJAX by Dipl.-Ing.(TH) Winfried Kaiser - www.seifenparadies.de

Released under the GNU General Public License
------------------------------------------------
*/
define('SUB_CATEGORIES', 4);
//Max. # of subcategories
ob_start();
if (NOT_IS_ADMIN_FUNCTION) {
    require_once DIR_FS_INC . 'olc_get_categories.inc.php';
    require_once DIR_FS_INC . 'olc_count_products_in_category.inc.php';
    $menu_entries = olc_get_categories(EMPTY_STRING);
}
require_once DIR_FS_INC . 'olc_image.inc.php';
$html_blank = array(HTML_NBSP, strtoupper(HTML_NBSP));
$html_break = array(HTML_BR, strtoupper(HTML_BR), "<p>", "<P>");
$html_two_blanks = HTML_NBSP . HTML_NBSP;
/*
W. Kaiser - Note:

As this is originally an osCommerce-contribution, it is doing code-output "on the fly" (the dumb way!).

As we can not use this in the context of OL-Commerce/AJAX, we have to prevent that.

So we start PHPs' output-buffering, and let the module do the output.

At the end, we assign the output-buffer to a variable (which will be assigned to Smarty), and clear the output-buffering.
Пример #3
0
Released under the GNU General Public License
---------------------------------------------------------------------------------------*/
global $seo_categories, $seo_search, $seo_replace, $seo_categories_text;
$s = $_SESSION['seo_categories_text'];
//if (IS_LOCAL_HOST && sizeof($s)>0)
if (sizeof($s) > 0) {
    $seo_categories = $s;
    $seo_search = $_SESSION[$seo_search_text];
    $seo_replace = $_SESSION[$seo_replace_text];
} else {
    if (USE_SEO) {
        //Get all categories info
        $seo_search = array(SLASH . SEO_SEPARATOR . SLASH . 'i', "'\\s&\\s'", "'[\r\n\\s]+'", "'&(quote|#34);'i", "'&(amp|#38);'i", "'&(lt|#60);'i", "'&(gt|#62);'i", "'&(nbsp|#160);'i", "'&(iexcl|#161);'i", "'&(cent|#162);'i", "'&(pound|#163);'i", "'&(copy|#169);'i", "'&'", "/[\\[\\({]/", "/[\\)\\]\\}]/", "/‗/", "/ה/", "/�/", "/צ/", "/�/", "/�/", "/�/", "/[באג]/", "/[יטך]/", "/[םלמ]/", "/[ףעפ]/", "/[תש�]/", "/'|\"|´|`/", "/[:,\\.!?]/");
        $seo_replace = array(UNDERSCORE, UNDERSCORE, UNDERSCORE, "\"", UNDERSCORE, "<", ">", EMPTY_STRING, EMPTY_STRING, EMPTY_STRING, EMPTY_STRING, EMPTY_STRING, UNDERSCORE, EMPTY_STRING, EMPTY_STRING, "ss", "ae", "ue", "oe", "Ae", "Ue", "Oe", "a", "e", "i", "o", "u", EMPTY_STRING, EMPTY_STRING);
        $_SESSION[$seo_search_text] = $seo_search;
        $_SESSION[$seo_replace_text] = $seo_replace;
    }
    include_once DIR_FS_INC . 'olc_get_categories.inc.php';
    $categories = olc_get_categories($categories, 0, EMPTY_STRING);
    $text_text = 'text';
    $id_text = 'id';
    $seo_categories = array();
    for ($i = 0, $n = sizeof($categories); $i < $n; $i++) {
        $categories_text = strip_tags(str_replace(HTML_NBSP, EMPTY_STRING, $categories[$i][$text_text]));
        if (USE_SEO) {
            $categories_text = strtolower(preg_replace($seo_search, $seo_replace, $categories_text));
        }
        $seo_categories[(string) $categories[$i][$id_text]] = $categories_text;
    }
}
Пример #4
0
(c) 2003	    nextcommerce (search.php,v 1.9 2003/08/17); www.nextcommerce.org
(c) 2004      XT - Commerce; www.xt-commerce.com

Released under the GNU General Public License
---------------------------------------------------------------------------------------*/
olc_smarty_init($box_smarty, $cacheid);
require_once DIR_FS_INC . 'olc_draw_pull_down_menu.inc.php';
require_once DIR_FS_INC . 'olc_draw_checkbox_field.inc.php';
require_once DIR_FS_INC . 'olc_draw_selection_field.inc.php';
require_once DIR_FS_INC . 'olc_image_submit.inc.php';
require_once DIR_FS_INC . 'olc_get_categories.inc.php';
require_once DIR_FS_INC . 'olc_get_manufacturers.inc.php';
require_once DIR_FS_INC . 'olc_hide_session_id.inc.php';
$selections = '
<table border="0" cellspacing="0" cellpadding="2">
  <tr>
    <td class="infoBoxContents">' . ENTRY_CATEGORIES . HTML_BR . olc_draw_pull_down_menu('categories_id', olc_get_categories(array(array('id' => EMPTY_STRING, 'text' => TEXT_ALL_CATEGORIES)))) . olc_draw_hidden_field('inc_subcat', ONE_STRING) . '
		</td>
  </tr>';
$manufacturers_pulldown = olc_get_manufacturers();
if ($manufacturers_pulldown) {
    $selections .= '<tr><td class="infoBoxContents">' . ENTRY_MANUFACTURERS . HTML_BR . olc_draw_pull_down_menu('manufacturers_id', $manufacturers_pulldown) . '</td></tr>';
}
$selections .= '</table>';
$box_smarty->assign('FORM_ACTION', olc_draw_form('quick_find', olc_href_link(FILENAME_ADVANCED_SEARCH_RESULT, EMPTY_STRING, NONSSL, false), 'get') . olc_hide_session_id());
$box_smarty->assign('INPUT_SEARCH', olc_draw_input_field('keywords', EMPTY_STRING, 'size="16" maxlength="100"'));
$box_smarty->assign('SELECTIONS', $selections);
$box_smarty->assign('BUTTON_SUBMIT', olc_image_submit('button_quick_find.gif', BOX_HEADING_SEARCH, 'align="middle"'));
$box_smarty->assign('LINK_ADVANCED', olc_href_link(FILENAME_ADVANCED_SEARCH));
$box_search = $box_smarty->fetch(CURRENT_TEMPLATE_BOXES . 'box_search' . HTML_EXT, $cacheid);
$smarty->assign('box_SEARCH', $box_search);
require_once DIR_FS_INC . 'olc_checkdate.inc.php';
require_once DIR_FS_INC . 'olc_draw_pull_down_menu.inc.php';
require_once DIR_FS_INC . 'olc_hide_session_id.inc.php';
$breadcrumb->add(NAVBAR_TITLE_ADVANCED_SEARCH, olc_href_link(FILENAME_ADVANCED_SEARCH));
require DIR_WS_INCLUDES . 'header.php';
$smarty->assign('FORM_ACTION', olc_draw_form('advanced_search', olc_href_link(FILENAME_ADVANCED_SEARCH_RESULT, EMPTY_STRING, NONSSL, false), 'get', 'onsubmit="return check_form_advanced_search(this);"') . olc_hide_session_id());
$smarty->assign('INPUT_KEYWORDS', olc_draw_input_field('keywords', EMPTY_STRING, 'style="width: 100%"'));
$smarty->assign('CHECKBOX_DESCRIPTION', olc_draw_checkbox_field('search_in_description', '1'));
$smarty->assign('HELP_LINK', 'javascript:popupWindow(\'' . olc_href_link(FILENAME_POPUP_SEARCH_HELP) . '\'' . RPAREN);
$smarty->assign('BUTTON_SUBMIT', olc_image_submit('button_search.gif', IMAGE_BUTTON_SEARCH));
$options_box = '
<table border="0" cellspacing="0" cellpadding="2">
  <tr>
    <td class="fieldKey">' . ENTRY_CATEGORIES . '</td>
    <td class="fieldValue">
    	' . olc_draw_pull_down_menu('categories_id', olc_get_categories(array(array('id' => EMPTY_STRING, 'text' => TEXT_ALL_CATEGORIES)))) . HTML_BR . '
		</td>
  </tr>
  <tr>
    <td class="fieldKey">&nbsp;</td>
    <td class="smallText">
    	' . olc_draw_checkbox_field('inc_subcat', '1', true) . BLANK . ENTRY_INCLUDE_SUBCATEGORIES . '
   	</td>
  </tr>
';
$manufacturers_pulldown = olc_get_manufacturers();
if ($manufacturers_pulldown) {
    $options_box .= '
	<tr>
    <td class="fieldKey">' . ENTRY_MANUFACTURERS . '</td>
    <td class="fieldValue">' . olc_draw_pull_down_menu('manufacturers_id', $manufacturers_pulldown) . '</td>
Пример #6
0
    echo $categories['text'];
    if (SHOW_COUNT == TRUE_STRING_S) {
        $products_in_category = olc_count_products_in_category($categories['id']);
        if ($products_in_category > 0) {
            echo "&nbsp;(" . $products_in_category . RPAREN;
        }
    }
    $cPathNew = "cPath=";
    for ($i = 0; $i < $size - 1; $i++) {
        $cPathNew .= $depth_size[$i] != 0 ? $depth_parentid[$i] . '_' : '';
    }
    $cPathNew .= $categories['id'];
    echo "','" . olc_href_link(FILENAME_DEFAULT, $cPathNew) . "')\n";
}
// ---
$categories = olc_get_categories('');
$height .= 2.65 * count($categories);
$depth = 0;
$blank_length;
$depth_size;
$depth_parentid;
for ($i = 0; $i < count($categories); $i++) {
    // don't insert 1st entry ("please choose ...")
    $blank_length = blank_length($categories[$i]['text']);
    if ($blank_length == $depth) {
        $categories[$i]['depth'] = $depth;
        $depth_size[$depth]++;
    } else {
        if ($blank_length > $depth) {
            $depth++;
            $categories[$i]['depth'] = $depth;