rebuildQuery example


    protected function getOptions(ShopContextInterface $context, Criteria $queryCriteria, VariantFacet $facet)
    {
        if (empty($facet->getGroupIds())) {
            return null;
        }

        $query = $this->queryBuilderFactory->createQuery($queryCriteria$context);
        $this->rebuildQuery($queryCriteria$query$facet);

        $valueIds = $query->execute()->fetchAll(PDO::FETCH_COLUMN);

        if (empty($valueIds)) {
            return null;
        }

        return $this->gateway->getOptions($valueIds$context);
    }

    /** * Modifies the query reading products from the database to reflect the selected options */
return $this->createCollectionResult($facet$properties$actives);
    }

    /** * @deprecated - Will be private with Shopware 5.8 * * @return array<int, Set>|null */
    protected function getProperties(ShopContextInterface $context, Criteria $queryCriteria)
    {
        $query = $this->queryBuilderFactory->createQuery($queryCriteria$context);
        $this->rebuildQuery($query);

        $propertyData = $query->execute()->fetchAllAssociative();

        $valueIds = array_column($propertyData, 'id');
        $filterGroupIds = array_keys(array_flip(array_column($propertyData, 'filterGroupId')));
        $filterGroupIds = array_map('\intval', $filterGroupIds);

        if (empty($valueIds)) {
            return null;
        }

        
Home | Imprint | This part of the site doesn't use cookies.