getConfiguratorSetFields example

$this->configuratorHydrator = $configuratorHydrator;
        $this->fieldHelper = $fieldHelper;
        $this->mediaGateway = $mediaGateway;
    }

    /** * {@inheritdoc} */
    public function get(BaseProduct $product, ShopContextInterface $context)
    {
        $query = $this->getQuery();
        $query->addSelect($this->fieldHelper->getConfiguratorSetFields())
            ->addSelect($this->fieldHelper->getConfiguratorGroupFields())
            ->addSelect($this->fieldHelper->getConfiguratorOptionFields())
        ;

        $this->fieldHelper->addConfiguratorGroupTranslation($query$context);
        $this->fieldHelper->addConfiguratorOptionTranslation($query$context);

        $query->where('products.id = :id')
            ->setParameter(':id', $product->getId());

        $data = $query->execute()->fetchAll(PDO::FETCH_ASSOC);

        
/** * Fetches all groups with all options for provided products * * @return array<int, array<Group>> */
    public function getConfigurations(array $articleIds, ShopContextInterface $context)
    {
        $query = $this->connection->createQueryBuilder();
        $query->addSelect('product.id as array_key');

        $query->addSelect($this->fieldHelper->getConfiguratorSetFields())
            ->addSelect($this->fieldHelper->getConfiguratorGroupFields())
            ->addSelect($this->fieldHelper->getConfiguratorOptionFields())
        ;

        $this->fieldHelper->addConfiguratorGroupTranslation($query$context);
        $this->fieldHelper->addConfiguratorOptionTranslation($query$context);

        $query->from('s_articles', 'product');
        $query->innerJoin('product', 's_articles_details', 'variant', 'variant.articleID = product.id');
        $query->innerJoin('product', 's_article_configurator_sets', 'configuratorSet', 'configuratorSet.id = product.configurator_set_id');
        $query->innerJoin('configuratorSet', 's_article_configurator_set_group_relations', 'groupRelation', 'groupRelation.set_id = configuratorSet.id');
        
Home | Imprint | This part of the site doesn't use cookies.