prepareGeneratorData example

// The merge type defines if all variants has to been regenerated or if only new variants will be added.         // 1 => Regenerate all variants         // 2 => Merge variants         $mergeType = (int) $this->Request()->getParam('mergeType', 1);

        $product = $this->getRepository()->find($productId);
        if (!$product instanceof Product) {
            throw new ModelNotFoundException(Product::class$productId);
        }

        $generatorData = $this->prepareGeneratorData($groups$offset$limit);

        $detailData = $this->getDetailDataForVariantGeneration($product);

        if ($offset === 0 && $mergeType === 1) {
            $this->removeAllConfiguratorVariants($productId);
        } elseif ($offset === 0 && $mergeType === 2) {
            $this->deleteVariantsForAllDeactivatedOptions($product$generatorData['allOptions']);
        }

        $this->get('models')->clear();
        $product = $this->getRepository()->find($productId);
        
Home | Imprint | This part of the site doesn't use cookies.