/** * @param \Magento\Framework\App\Action\Action $subject * @param callable $proceed * @param \Magento\Framework\App\RequestInterface $request * @return mixed * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ public function aroundDispatch(\Magento\Framework\App\Action\Action $subject, \Closure $proceed, \Magento\Framework\App\RequestInterface $request) { $this->httpContext->setValue(Data::CONTEXT_CATALOG_SORT_DIRECTION, $this->toolbarModel->getDirection(), \Magento\Catalog\Helper\Product\ProductList::DEFAULT_SORT_DIRECTION); $this->httpContext->setValue(Data::CONTEXT_CATALOG_SORT_ORDER, $this->toolbarModel->getOrder(), $this->productListHelper->getDefaultSortField()); $this->httpContext->setValue(Data::CONTEXT_CATALOG_DISPLAY_MODE, $this->toolbarModel->getMode(), $this->productListHelper->getDefaultViewMode()); $this->httpContext->setValue(Data::CONTEXT_CATALOG_LIMIT, $this->toolbarModel->getLimit(), $this->productListHelper->getDefaultLimitPerPageValue($this->productListHelper->getDefaultViewMode())); return $proceed($request); }
/** * Get order field * * @return null|string */ protected function getOrderField() { if ($this->_orderField === null) { $this->_orderField = $this->_productListHelper->getDefaultSortField(); } return $this->_orderField; }
/** * Init Toolbar * * @return null */ protected function _construct() { parent::_construct(); $this->_orderField = $this->_productListHelper->getDefaultSortField(); $this->_availableOrder = $this->_catalogConfig->getAttributeUsedForSortByArray(); $this->_availableMode = $this->_productListHelper->getAvailableViewMode(); }