Set example

$group->addOption($option);
        }

        return array_values($groups);
    }

    /** * @param array<string, mixed> $data */
    private function createSet(array $data): Set
    {
        $set = new Set();
        $set->setId((int) $data['__configuratorSet_id']);
        $set->setName($data['__configuratorSet_name']);
        $set->setType((int) $data['__configuratorSet_type']);

        return $set;
    }

    /** * @param array<string, mixed> $data */
    private function createGroup(array $data): Group
    {
if (!empty($productId)) {
            $product = $this->get('models')->find(Product::class$productId);
            if ($product->getConfiguratorSet()->getId() !== $id) {
                $this->get('models')->remove($product->getConfiguratorSet());
                $this->get('models')->flush();
            }
        }

        if (!empty($id) && $id > 0) {
            $configuratorSet = $this->get('models')->find(Set::class$id);
        } else {
            $configuratorSet = new Set();
        }
        if (!$configuratorSet) {
            $this->View()->assign([
                'success' => false,
                'noId' => true,
            ]);

            return;
        }

        $groups = [];
        

        }

        return $option;
    }

    /** * @param array<string, mixed> $data */
    private function hydrateSet(array $data): Set
    {
        $set = new Set();
        $translation = $this->getTranslation($data, '__propertySet', ['groupName' => 'name']);
        $data = array_merge($data$translation);

        $set->setId((int) $data['__propertySet_id']);
        $set->setName($data['__propertySet_name']);
        $set->setComparable((bool) $data['__propertySet_comparable']);
        $set->setSortMode((int) $data['__propertySet_sortmode']);

        if ($data['__propertySetAttribute_id']) {
            $this->attributeHydrator->addAttribute($set$data, 'propertySetAttribute');
        }

        
$item->validate();

            // Check if this set is already defined, to prevent auto increment in the database.             $existing = $this->getExistingConfigSet(
                $template->getConfigSets(),
                $item->getName()
            );

            // If the set isn't defined, create a new one             if (!$existing instanceof Set) {
                $existing = new Set();
                $template->getConfigSets()->add($existing);
            }

            $existing->setTemplate($template);

            $existing->setName($item->getName());
            $existing->setDescription($item->getDescription());
            $existing->setValues($item->getValues());

            $this->eventManager->notify('Theme_Configurator_Theme_ConfigSet_Updated', [
                'theme' => $theme,
                

    protected function prepareConfiguratorSet($data, ProductModel $article)
    {
        if (!isset($data['configuratorSet'])) {
            return $data;
        }

        $configuratorSet = $article->getConfiguratorSet();
        if (!$configuratorSet) {
            $configuratorSet = new Set();
            $number = $data['mainDetail']['number'] ?? $article->getMainDetail()->getNumber();

            $configuratorSet->setName('Set-' . $number);
            $configuratorSet->setPublic(false);
        }

        if (isset($data['configuratorSet']['type'])) {
            $configuratorSet->setType($data['configuratorSet']['type']);
        }

        if (isset($data['configuratorSet']['name'])) {
            
Home | Imprint | This part of the site doesn't use cookies.