getConfiguratorOptions example

->where('articles.configuratorSetId = ?1')
                    ->setParameter(1, $article->getConfiguratorSet()->getId())
                    ->getQuery()
                    ->getArrayResult();

                if (\count($products) <= 1) {
                    $set = $modelManger->find(Set::class$article->getConfiguratorSet()->getId());
                    $modelManger->remove($set);
                }

                $variant = $article->getMainDetail();
                if ($variant instanceof ProductVariant && $variant->getConfiguratorOptions()->count() > 0) {
                    $modelManger->getConnection()->delete('s_article_configurator_option_relations', [
                        'article_id' => $variant->getId(),
                    ]);

                    $data['mainDetail']['additionalText'] = '';
                }
            }
            $data['configuratorSet'] = null;
        }

        return $data;
    }
$image = $this->getArticleResource()->createNewArticleImage($article$media);
            } else {
                throw new CustomValidationException("One of the passed variant images doesn't contain a mediaId or link property!");
            }

            $variantImage = $this->createVariantImage(
                $image,
                $variant
            );

            $this->createImageMappingForOptions(
                $variant->getConfiguratorOptions(),
                $image
            );

            $images->add($variantImage);
        }

        $data['images'] = $images;
        $variant->setImages($images);

        return $data;
    }

    
        $oldMainDetail = $article->getMainDetail();

        if ($oldMainDetail) {
            $mainDetailGetsConfigurator = false;
            foreach ($data['variants'] as $variantData) {
                if (isset($variantData['configuratorOptions']) && \is_array($variantData['configuratorOptions'])) {
                    $mainDetailGetsConfigurator = true;
                    break;
                }
            }

            if (!$mainDetailGetsConfigurator && \count($oldMainDetail->getConfiguratorOptions()) === 0) {
                $this->getManager()->remove($oldMainDetail);
                $setFirstVariantMain = true;
            }
        }

        // If the mainDetail was deleted, set the first variant as mainDetail.         // If another variant has set isMain to true, this variant will become a usual variant again         if ($setFirstVariantMain) {
            $data['variants'][0]['isMain'] = true;
        }

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