Example #1
0
$this->listCategory = $listCategory;
$model = new Models_Catalog();
if (empty($_REQUEST['cat_id']) || $_REQUEST['cat_id'] == "null") {
    $_REQUEST['cat_id'] = 0;
}
$model->categoryId = MG::get('category')->getCategoryList($_REQUEST['cat_id']);
// В конец списка, добавляем корневую текущую категорию.
$model->categoryId[] = $_REQUEST['cat_id'];
if (!$model->getCurrentCategory()) {
    $model->categoryId = array(0);
}
$_REQUEST['category_ids'] = $model->categoryId;
if (empty($_REQUEST['category_ids'])) {
    $_REQUEST['category_ids'] = array(0);
}
$arrfilter = $model->filterPublic(false, false, false);
$this->filter = $arrfilter['filterBarHtml'];
if (isset($_REQUEST['applyFilter'])) {
    $userFilter = $arrfilter['userFilter'];
}
$sorterData = explode('|', $_POST['sorter']);
if ($sorterData[1] > 0) {
    $sorterData[3] = 'desc';
} else {
    $sorterData[3] = 'asc';
}
$countPrintRowsProduct = MG::getSetting('countPrintRowsProduct');
if (!empty($userFilter)) {
    $catalog = $model->getListByUserFilter($countPrintRowsProduct, $userFilter, true);
} else {
    $catalog = $model->getList($countPrintRowsProduct, true);