VariantCondition example

if (empty($filters)) {
            return;
        }

        $facet = $this->variantHelper->getVariantFacet();
        $groups = [];
        if ($facet) {
            $groups = $facet->getExpandGroupIds();
        }

        foreach ($filters as $groupId => $filter) {
            $condition = new VariantCondition($filter, \in_array($groupId$groups)$groupId);
            $criteria->addCondition($condition);
        }
    }

    /** * Helper function which groups the passed filter option ids * by the filter group. * Each filter group is joined as own PropertyCondition to the criteria * object * * @param array $filters * * @return array */


        if ($isSelectionSpecified === true || !$product->hasConfigurator()) {
            $data = $this->legacyEventManager->fireArticleByIdEvents($data$this);

            return $data;
        }

        $criteria = new Criteria();
        foreach ($selection as $groupId => $optionId) {
            $criteria->addBaseCondition(
                new VariantCondition([(int) $optionId], true, (int) $groupId)
            );
        }

        $service = Shopware()->Container()->get(VariantListingPriceServiceInterface::class);

        $result = new ProductSearchResult(
            [$product->getNumber() => $product],
            1,
            [],
            $criteria,
            $this->contextService->getShopContext()
        );
Home | Imprint | This part of the site doesn't use cookies.