function vam_get_categories($categories_array = '', $parent_id = '0', $indent = '')
{
    $parent_id = vam_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 = '" . vam_db_input($parent_id) . "'\n                                       and c.categories_id = cd.categories_id\n                                       and c.categories_status != 0\n                                       and cd.language_id = '" . $_SESSION['languages_id'] . "'\n                                       order by sort_order, cd.categories_name";
    $categories_query = vamDBquery($categories_query);
    while ($categories = vam_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 = vam_get_categories($categories_array, $categories['categories_id'], $indent . '  ');
        }
    }
    return $categories_array;
}
Exemplo n.º 2
0
include 'includes/application_top.php';
// create template elements
$vamTemplate = new vamTemplate();
// include boxes
require DIR_FS_CATALOG . 'templates/' . CURRENT_TEMPLATE . '/source/boxes.php';
// include needed functions
require_once DIR_FS_INC . 'vam_get_categories.inc.php';
require_once DIR_FS_INC . 'vam_get_manufacturers.inc.php';
require_once DIR_FS_INC . 'vam_checkdate.inc.php';
$breadcrumb->add(NAVBAR_TITLE_ADVANCED_SEARCH, vam_href_link(FILENAME_ADVANCED_SEARCH));
require DIR_WS_INCLUDES . 'header.php';
$vamTemplate->assign('FORM_ACTION', vam_draw_form('advanced_search', vam_href_link(FILENAME_ADVANCED_SEARCH_RESULT, '', 'NONSSL', false), 'get', 'onsubmit="return check_form(this);"') . vam_hide_session_id());
$vamTemplate->assign('INPUT_KEYWORDS', vam_draw_input_field('keywords', '', ''));
$vamTemplate->assign('HELP_LINK', 'javascript:popupWindow(\'' . vam_href_link(FILENAME_POPUP_SEARCH_HELP) . '\')');
$vamTemplate->assign('BUTTON_SUBMIT', vam_image_submit('search.png', IMAGE_BUTTON_SEARCH));
$vamTemplate->assign('SELECT_CATEGORIES', vam_draw_pull_down_menu('categories_id', vam_get_categories(array(array('id' => '', 'text' => TEXT_ALL_CATEGORIES)))));
$vamTemplate->assign('ENTRY_SUBCAT', vam_draw_checkbox_field('inc_subcat', '1', true));
$vamTemplate->assign('SELECT_MANUFACTURERS', vam_draw_pull_down_menu('manufacturers_id', vam_get_manufacturers(array(array('id' => '', 'text' => TEXT_ALL_MANUFACTURERS)))));
$vamTemplate->assign('SELECT_PFROM', vam_draw_input_field('pfrom'));
$vamTemplate->assign('SELECT_PTO', vam_draw_input_field('pto'));
$error = '';
if (isset($_GET['errorno'])) {
    if (($_GET['errorno'] & 1) == 1) {
        $error .= str_replace('\\n', '<br />', JS_AT_LEAST_ONE_INPUT);
    }
    if (($_GET['errorno'] & 10) == 10) {
        $error .= str_replace('\\n', '<br />', JS_INVALID_FROM_DATE);
    }
    if (($_GET['errorno'] & 100) == 100) {
        $error .= str_replace('\\n', '<br />', JS_INVALID_TO_DATE);
    }