addVariantCondition example

private VariantHelperInterface $variantHelper;

    public function __construct(Connection $connection, VariantHelperInterface $variantHelper)
    {
        $this->connection = $connection;
        $this->variantHelper = $variantHelper;
    }

    public function handleRequest(Request $request, Criteria $criteria, ShopContextInterface $context)
    {
        $this->addVariantCondition($request$criteria);
    }

    private function addVariantCondition(Request $request, Criteria $criteria)
    {
        $filters = $request->getParam('variants', []);
        if (empty($filters)) {
            return;
        }

        $filters = explode('|', $filters);
        $filters = $this->getGroupedFilters($filters);

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