if (isset($field_product)) {
        $page_get_params['field_product'] = $field_product;
        $page_get_params['field_product_id'] = $field_product_id;
        $page_get_params['field_amount'] = $field_amount;
    }
    $navigation['script_raw'] = cw_call('cw_core_get_html_page_url', array(array_merge($page_get_params, array('att' => $search_data['products'][$use_search_conditions]['attributes']))));
    //    $navigation['script'] = cw_call('cw_product_get_filter_replaced_url', array('product_filter'=>$product_filter, 'ns'=>$navigation['script_raw']));
    $navigation['script'] = cw_call('cw_clean_url_get_seo_url', array($navigation['script_raw']));
    if ($current_area == 'A') {
        $navigation['script'] = str_replace('index.php', 'admin/index.php', $navigation['script']);
    }
    // alexv - #30133 2nd+ product list page in pop up bug
    $smarty->assign('navigation', $navigation);
    $smarty->assign('products', $products);
    $smarty->assign('product_filter', $product_filter);
    if ($config['product_filter']['is_ajax'] == 'Y' && $ajax_filter) {
        $ns = cw_call('cw_core_get_html_page_url', array($page_get_params));
        $url = cw_product_get_filter_replaced_url($product_filter, $ns);
        $smarty->assign('replaced_url', $url);
        $smarty->assign('ajax_filter', $ajax_filter);
    }
    // turn off infinite scroll if products more than max_count_view_products
    if (!empty($app_config_file['interface']['max_count_view_products']) && $navigation['total_items'] >= $app_config_file['interface']['max_count_view_products']) {
        $smarty->assign("infinite_scroll_manual_off", "Y");
    }
}
$search_data['products'][$use_search_conditions]["substring"] = htmlentities(stripslashes($search_data['products'][$use_search_conditions]["substring"]));
$smarty->assign('js_tab', $search_data['products'][$use_search_conditions]['js_tab']);
$smarty->assign('search_prefilled', cw_stripslashes($search_data['products'][$use_search_conditions]));
$smarty->assign('warehouses', cw_get_warehouses());
$smarty->assign('mode', $mode);
    $smarty->assign('display_antibot', $display_antibot);
}
$smarty->assign('user', $user);
$smarty->assign('profile_fields', $profile_fields);
$smarty->assign('profile_sections', $profile_sections);
$smarty->assign('additional_fields', $additional_fields);
# assign information for the main address
$smarty->assign('countries', cw_map_get_countries());
$smarty->assign('states', cw_map_get_states());
if ($config['General']['use_counties'] == 'Y') {
    $smarty->assign('titles', cw_map_get_counties());
}
$smarty->assign('memberships', cw_get_memberships($userinfo ? $userinfo['usertype'] : $usertype));
$smarty->assign('salesmen', cw_user_get_salesmans_for_register());
cw_load('warehouse');
$possible_warehouses = cw_get_warehouses();
$smarty->assign('possible_warehouses', $possible_warehouses);
if ($m_usertype == 'B' && $current_area == 'A') {
    $parent_profiles = cw_query("select customer_id, firstname, lastname from {$tables['customers']} where {$tables['customers']}.usertype='B' and customer_id!='{$user}'");
    $smarty->assign('parent_profiles', $parent_profiles);
}
$smarty->assign('fill_error', $fill_error);
if ($fill_error) {
    $userinfo = cw_check_user_field_build_profile($userinfo, $filled_profile, $profile_fields);
}
$fill_error = array();
$smarty->assign('userinfo', $userinfo);
$smarty->assign('userphoto', $userphoto);
if ($mode == 'delete') {
    // TODO: move delete function to another controller
    $smarty->assign('main', 'profile_delete');
    } else {
        cw_header_location("index.php?target={$target}&mode=add");
    }
}
if ($ge_id && cw_group_edit_count($ge_id) == 0) {
    $ge_id = false;
}
global $product_info;
if ($product_id) {
    $product_info = cw_func_call('cw_product_get', array('id' => $product_id, 'user_account' => $user_account, 'info_type' => 65535, 'lang' => $edited_language, 'for_product_modify' => true));
    if (!$product_info) {
        $top_message = array('content' => cw_get_langvar_by_name('lbl_products_deleted'), 'type' => 'E');
        cw_header_location('index.php?target=' . $target);
    }
}
$warehouses = cw_get_warehouses();
$smarty->assign('warehouses', $warehouses);
if (AREA_TYPE == 'A' && $action == "delete_thumbnail" && !empty($product_id)) {
    cw_image_delete($product_id, 'products_images_thumb');
    if ($ge_id && $fields['thumbnail']) {
        while ($pid = cw_group_edit_each($ge_id, 100, $product_id)) {
            cw_image_delete($pid, 'products_images_thumb');
        }
    }
    cw_refresh($product_id);
}
if (AREA_TYPE == 'A' && $action == 'delete_product_image' && !empty($product_id)) {
    cw_image_delete($product_id, 'products_images_det');
    if ($ge_id && $fields['product_image']) {
        while ($pid = cw_group_edit_each($ge_id, 100, $product_id)) {
            cw_image_delete($pid, 'products_images_det');