function xtc_get_categoriesstatus_for_product($product_id)
{
    $categorie_query = "SELECT\n\t                                   categories_id\n\t                                   FROM " . TABLE_PRODUCTS_TO_CATEGORIES . "\n\t                                   WHERE products_id='" . xtc_db_input((int) $product_id) . "'";
    $categorie_query = xtDBquery($categorie_query);
    while ($categorie_data = xtc_db_fetch_array($categorie_query, true)) {
        if (xtc_check_categories_status($categorie_data['categories_id']) >= 1) {
            return 1;
        } else {
            return 0;
        }
        echo $categorie_data['categories_id'];
    }
}
  Released under the GNU General Public License
  ---------------------------------------------------------------------------------------*/
$default_smarty = new smarty();
$default_smarty->assign('tpl_path', 'templates/' . CURRENT_TEMPLATE . '/');
$default_smarty->assign('session', session_id());
// define defaults
$main_content = '';
$group_check = '';
$fsk_lock = '';
// include needed functions
require_once DIR_FS_INC . 'xtc_customer_greeting.inc.php';
require_once DIR_FS_INC . 'xtc_get_path.inc.php';
require_once DIR_FS_INC . 'xtc_check_categories_status.inc.php';
// check categorie exist
if (xtc_check_categories_status($current_category_id) >= 1) {
    $error = CATEGORIE_NOT_FOUND;
    include DIR_WS_MODULES . FILENAME_ERROR_HANDLER;
    return;
}
// the following cPath references come from application_top.php
$category_depth = 'top';
if (isset($cPath) && xtc_not_null($cPath)) {
    $categories_products_query = "select p2c.products_id\n                                  from " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c\n                                  left join " . TABLE_PRODUCTS . " p\n                                   on p2c.products_id = p.products_id\n                                  where p2c.categories_id = " . (int) $current_category_id . "\n                                  and p.products_status = 1";
    $categories_products_result = xtDBquery($categories_products_query);
    if (xtc_db_num_rows($categories_products_result, true) > 0) {
        $category_depth = 'products';
        // display products
    } else {
        $category_parent_query = "select parent_id from " . TABLE_CATEGORIES . " where parent_id = " . (int) $current_category_id . " AND categories_status = 1";
        $category_parent_result = xtDBquery($category_parent_query);