Smile\ElasticsuiteCatalog\Plugin\LayerPlugin::setSortParams PHP Метод

setSortParams() приватный Метод

Apply sort params to the collection.
private setSortParams ( Magento\Catalog\Model\Layer $layer, Magento\Catalog\Model\ResourceModel\Collection\AbstractCollection $collection )
$layer Magento\Catalog\Model\Layer Catalog / search layer.
$collection Magento\Catalog\Model\ResourceModel\Collection\AbstractCollection Product collection.
    private function setSortParams(\Magento\Catalog\Model\Layer $layer, \Magento\Catalog\Model\ResourceModel\Collection\AbstractCollection $collection)
    {
        $searchQuery = $this->queryFactory->get();
        if (!$searchQuery->getQueryText() && $layer->getCurrentCategory()) {
            $categoryId = $layer->getCurrentCategory()->getId();
            $collection->addSortFilterParameters('position', 'category.position', 'category', ['category.category_id' => $categoryId]);
        }
        return $this;
    }