private function getCurrentCategoryId(ContainerConfigurationInterface $containerConfiguration, SearchCriteriaInterface $searchCriteria)
    {
        $store      = $this->storeManager->getStore($containerConfiguration->getStoreId());
        $categoryId = $this->storeManager->getGroup($store->getStoreGroupId())->getRootCategoryId();

        foreach ($searchCriteria->getFilterGroups() as $filterGroup) {
            foreach ($filterGroup->getFilters() as $filter) {
                if ($filter->getField() == "category_ids") {
                    $categoryId = $filter->getValue();
                }
            }
        }

        return $categoryId;
    }
private function getCurrentCategoryId(ContainerConfigurationInterface $containerConfiguration, SearchCriteriaInterface $searchCriteria)
    {
        $store      = $this->storeManager->getStore($containerConfiguration->getStoreId());
        $categoryId = $this->storeManager->getGroup($store->getStoreGroupId())->getRootCategoryId();

        foreach ($searchCriteria->getFilterGroups() as $filterGroup) {
            foreach ($filterGroup->getFilters() as $filter) {
                if ($filter->getField() == "category_ids") {
                    $categoryId = $filter->getValue();
                }
            }
        }

        return $categoryId;
    }
private function getCurrentCategoryId ( ContainerConfigurationInterface $ containerConfiguration , SearchCriteriaInterface $ searchCriteria ) { $ store = $ this -> storeManager -> getStore ( $ containerConfiguration -> getStoreId ( ) ) ; $ categoryId = $ this -> storeManager -> getGroup ( $ store -> getStoreGroupId ( ) ) -> getRootCategoryId ( ) ; foreach ( $ searchCriteria -> getFilterGroups ( ) as $ filterGroup ) { foreach ( $ filterGroup -> getFilters ( ) as $ filter ) { if ( $ filter -> getField ( ) == "category_ids" ) { $ categoryId = $ filter -> getValue ( ) ; } } } return $ categoryId ; }
Return current category id for the search request.

@param ContainerConfigurationInterface $containerConfiguration Container configuration.
@param SearchCriteriaInterface         $searchCriteria         Search criteria.

@return integer
Return current category id for the search request .