Esempio n. 1
0
    } elseif ($mode == 'on_sale') {
        $title = __("on_sale");
        $params['on_sale'] = true;
    } elseif ($mode == 'bestsellers') {
        $title = __("bestsellers");
        $params['bestsellers'] = true;
        $params['sales_amount_from'] = Registry::get('addons.bestsellers.sales_amount_from');
    } elseif ($mode == 'newest') {
        $title = __("newest");
        $params['sort_by'] = empty($params['sort_by']) ? 'timestamp' : $params['sort_by'];
        $params['plain'] = true;
        $params['visible'] = true;
        $period = Registry::get('addons.bestsellers.period');
        $params['period'] = 'A';
        if ($period == 'today') {
            $params['period'] = 'D';
        } elseif ($period == 'last_days') {
            $params['period'] = 'HC';
            $params['last_days'] = Registry::get('addons.bestsellers.last_days');
        }
    } else {
        $title = __('products');
    }
    fn_add_breadcrumb($title);
    list($products, $search) = fn_get_products($params, Registry::get('settings.Appearance.products_per_page'));
    fn_gather_additional_products_data($products, array('get_icon' => true, 'get_detailed' => true, 'get_additional' => true, 'get_options' => true));
    $selected_layout = fn_get_products_layout($params);
    Registry::get('view')->assign('products', $products);
    Registry::get('view')->assign('search', $search);
    Registry::get('view')->assign('selected_layout', $selected_layout);
}
Esempio n. 2
0
 $params['subcats'] = '';
 if (Registry::get('settings.General.show_products_from_subcategories') == 'Y') {
     $params['subcats'] = 'Y';
 }
 list($products, $search) = fn_get_products($params, Registry::get('settings.Appearance.products_per_page'), CART_LANGUAGE);
 if (isset($search['page']) && $search['page'] > 1 && empty($products)) {
     return array(CONTROLLER_STATUS_NO_PAGE);
 }
 fn_gather_additional_products_data($products, array('get_icon' => true, 'get_detailed' => true, 'get_additional' => true, 'get_options' => true, 'get_discounts' => true, 'get_features' => false));
 $show_no_products_block = !empty($params['features_hash']) && !$products;
 if ($show_no_products_block && defined('AJAX_REQUEST')) {
     fn_filters_not_found_notification();
     exit;
 }
 Tygh::$app['view']->assign('show_no_products_block', $show_no_products_block);
 $selected_layout = fn_get_products_layout($_REQUEST);
 Tygh::$app['view']->assign('show_qty', true);
 Tygh::$app['view']->assign('products', $products);
 Tygh::$app['view']->assign('search', $search);
 Tygh::$app['view']->assign('selected_layout', $selected_layout);
 Tygh::$app['view']->assign('category_data', $category_data);
 // If page title for this category is exist than assign it to template
 if (!empty($category_data['page_title'])) {
     Tygh::$app['view']->assign('page_title', $category_data['page_title']);
 }
 // [Breadcrumbs]
 if (!empty($category_parent_ids)) {
     Registry::set('runtime.active_category_ids', $category_parent_ids);
     $cats = fn_get_category_name($category_parent_ids);
     foreach ($category_parent_ids as $c_id) {
         fn_add_breadcrumb($cats[$c_id], "categories.view?category_id={$c_id}");