$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(array('var' => 'index', 'cat' => $cat, 'include_question' => 1, 'delimiter' => '&')));
     $url = cw_product_get_filter_replaced_url($product_filter, $ns);
     $smarty->assign('replaced_url', $url);
 }
 $current_category = cw_func_call('cw_category_get', array('cat' => $cat));
 if (!$current_category) {
     cw_header_location('index.php');
 }
 $smarty->assign('current_category', $current_category);
 $location = array_merge($location, cw_category_get_location($cat, '', 0, 1));
 if (!empty($products) && count($products)) {
     $smarty->assign('category_category_url', str_replace($app_web_dir, "", cw_category_category_url($cat)));
 }
 $smarty->assign('sort_fields', cw_call('cw_product_get_sort_fields'));
 $smarty->assign('search_prefilled', $data);
 # kornev, recent categories
 $recent_categories =& cw_session_register('recent_categories', array());
 array_unshift($recent_categories, $cat);
 if (count($recent_categories)) {
     $recent_categories = array_unique($recent_categories);
     $recent_categories = array_slice($recent_categories, 0, $config['General']['recent_categories_amount']);
     $tmp = cw_query("select category_id from {$tables['categories']} where category_id in ('" . implode("', '", $recent_categories) . "')");
     $to_sort = array_flip($recent_categories);
     foreach ($tmp as $val) {
         $ret = cw_func_call('cw_category_get', array('cat' => $val['category_id']));
         if ($ret) {
             $result[$to_sort[$val['category_id']]] = $ret;
    if (!$is_avail) {
        cw_header_location("index.php?target=error_message&error=access_denied&id=44");
    }
}
if ($addons['wholesale_trading'] && empty($product_info['variant_id'])) {
    cw_include('addons/wholesale_trading/product.php');
}
if ($addons['recommended_products']) {
    cw_include('addons/recommended_products/recommends.php');
}
$location = array_merge($location, cw_category_get_location($cat, '', 0, 1));
if ($product_info) {
    $location[] = array($product_info['product'], '');
}
if ($config['Appearance']['categories_in_products']) {
    $product_info['category_category_url'] = cw_category_category_url($product_info['category_id']);
}
$product_info['tags'] = cw_tags_get_product_tags($product_id);
// Supplier delivery time
if ($product_info['system']['supplier_customer_id']) {
    $supplier_fields = cw_user_get_custom_fields($product_info['system']['supplier_customer_id'], 0, '', 'field');
    if ($supplier_fields['min_delivery_time'] == $supplier_fields['max_delivery_time']) {
        $product_info['supplier']['delivery_time'] = $supplier_fields['min_delivery_time'];
    } else {
        $product_info['supplier']['delivery_time'] = $supplier_fields['min_delivery_time'] . '-' . $supplier_fields['max_delivery_time'];
    }
    unset($supplier_fields);
}
$smarty->assign('product', $product_info);
// TODO: move to addon
if ($addons['faq']) {