protected function setCollection(shopProductsCollection $collection) { $collection->filters(waRequest::get()); $limit = (int) waRequest::cookie('products_per_page'); if (!$limit || $limit < 0 || $limit > 500) { $limit = $this->getConfig()->getOption('products_per_page'); } $page = waRequest::get('page', 1, 'int'); if ($page < 1) { $page = 1; } $offset = ($page - 1) * $limit; $products = $collection->getProducts('*', $offset, $limit); $count = $collection->count(); $pages_count = ceil((double) $count / $limit); $this->view->assign('pages_count', $pages_count); $this->view->assign('products', $products); $this->view->assign('products_count', $count); }