/** * Set order options * * @return void */ public function setListOrders() { /* @var $category \Magento\Catalog\Model\Category */ $category = $this->_catalogLayer->getCurrentCategory(); $availableOrders = $category->getAvailableSortByOptions(); unset($availableOrders['position']); $this->getChildBlock('search_result_list')->setAvailableOrders($availableOrders); }
/** * {@inheritdoc} */ public function prepareProductCollection($collection) { $pluginInfo = $this->pluginList->getNext($this->subjectType, 'prepareProductCollection'); if (!$pluginInfo) { return parent::prepareProductCollection($collection); } else { return $this->___callPlugins('prepareProductCollection', func_get_args(), $pluginInfo); } }
/** * Set search available list orders * * @return $this */ public function setListOrders() { $category = $this->catalogLayer->getCurrentCategory(); /* @var $category \Magento\Catalog\Model\Category */ $availableOrders = $category->getAvailableSortByOptions(); unset($availableOrders['position']); $availableOrders = array_merge(array('relevance' => __('Relevance')), $availableOrders); $this->getListBlock()->setAvailableOrders($availableOrders)->setDefaultDirection('desc')->setSortBy('relevance'); return $this; }
/** * {@inheritdoc} */ public function offsetGet($offset) { $pluginInfo = $this->pluginList->getNext($this->subjectType, 'offsetGet'); if (!$pluginInfo) { return parent::offsetGet($offset); } else { return $this->___callPlugins('offsetGet', func_get_args(), $pluginInfo); } }
/** * @param ContextInterface $context * @param StateFactory $layerStateFactory * @param ResourceModel\Product\Attribute\CollectionFactory $attributeCollectionFactory * @param ResourceModel\Product $catalogProduct * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Framework\Registry $registry * @param CategoryRepositoryInterface $categoryRepository * @param array $data */ public function __construct(ContextInterface $context, StateFactory $layerStateFactory, \Magento\Catalog\Model\ResourceModel\Product\Attribute\CollectionFactory $attributeCollectionFactory, \Magento\Catalog\Model\ResourceModel\Product $catalogProduct, \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Framework\Registry $registry, CategoryRepositoryInterface $categoryRepository, array $data = []) { parent::__construct($context, $layerStateFactory, $attributeCollectionFactory, $catalogProduct, $storeManager, $registry, $categoryRepository, $data); }