/** * {@inheritdoc} */ public function indexAction(LayoutBoxSettingsCollection $boxSettings) { $provider = $this->manager->getProductProvider(); $collectionBuilder = $provider->getCollectionBuilder(); $requestHelper = $this->manager->getRequestHelper(); $limit = $requestHelper->getCurrentLimit($boxSettings->getParam('per_page', 12)); $offset = $requestHelper->getCurrentOffset($limit); $dataset = $collectionBuilder->getDataSet(['limit' => $limit, 'offset' => $offset, 'order_by' => $requestHelper->getQueryAttribute('order_by', 'name'), 'order_dir' => $requestHelper->getQueryAttribute('order_dir', 'asc'), 'conditions' => $this->manager->getCurrentCategoryConditions(), 'cache_enabled' => true]); return $this->displayTemplate('index', ['dataset' => $dataset]); }
/** * {@inheritdoc} */ public function indexAction(LayoutBoxSettingsCollection $boxSettings) { $dataset = $this->get('product.dataset.front'); $requestHelper = $this->manager->getRequestHelper(); $limit = $requestHelper->getAttributesBagParam('limit', $boxSettings->getParam('per_page', 12)); $conditions = $this->manager->getCurrentCategoryConditions(); $conditions = $this->get('layered_navigation.helper')->addLayeredNavigationConditions($conditions); $products = $dataset->getResult('array', ['limit' => $limit, 'page' => $requestHelper->getAttributesBagParam('page', 1), 'order_by' => $requestHelper->getAttributesBagParam('orderBy', 'name'), 'order_dir' => $requestHelper->getAttributesBagParam('orderDir', 'asc'), 'conditions' => $conditions]); return $this->displayTemplate('index', ['dataset' => $products]); }