setAdditional example

$premium,
                $premium['variantID'],
                'variant'
            );

            $product = new StoreFrontBundle\Struct\ListProduct(
                $premium['articleID'],
                $premium['variantID'],
                $premium['ordernumber']
            );

            $product->setAdditional($premium['additionaltext']);

            $context = $this->contextService->getShopContext();
            $product = $this->additionalTextService->buildAdditionalText($product$context);
            $premium['additionaltext'] = $product->getAdditional();
        }

        if (!empty($premium['configurator_set_id'])) {
            $number = $premium['ordernumber'];
        } else {
            $number = $premium['ordernumber_export'];
        }

        
$product->setShippingFree($listProduct->isShippingFree());
        $product->setMainVariantId($listProduct->getMainVariantId());
        $product->setAllowsNotification($listProduct->allowsNotification());
        $product->setHighlight($listProduct->highlight());
        $product->setUnit($listProduct->getUnit());
        $product->setTax($listProduct->getTax());
        $product->setPrices($listProduct->getPrices());
        $product->setManufacturer($listProduct->getManufacturer());
        $product->setCover($listProduct->getCover());
        $product->setCheapestPrice($listProduct->getCheapestPrice());
        $product->setName($listProduct->getName());
        $product->setAdditional($listProduct->getAdditional());
        $product->setCloseouts($listProduct->isCloseouts());
        $product->setEan($listProduct->getEan());
        $product->setHeight($listProduct->getHeight());
        $product->setKeywords($listProduct->getKeywords());
        $product->setLength($listProduct->getLength());
        $product->setLongDescription($listProduct->getLongDescription());
        $product->setMinStock($listProduct->getMinStock());
        $product->setReleaseDate($listProduct->getReleaseDate());
        $product->setShippingTime($listProduct->getShippingTime());
        $product->setShortDescription($listProduct->getShortDescription());
        $product->setStock($listProduct->getStock());
        
$required,
            $context
        );

        foreach ($required as &$product) {
            if (!\array_key_exists($product->getNumber()$configurations)) {
                continue;
            }

            $config = $configurations[$product->getNumber()];

            $product->setAdditional($this->buildTextDynamic($config));
        }

        return $products;
    }

    /** * @param Group[] $configurations * * @return string */
    private function buildTextDynamic($configurations)
    {
$address = $this->addressRepository->getOneByUser($addressId$userId);

        if (!$this->Request()->isPost()) {
            $this->redirect(['action' => 'index']);

            return;
        }

        $additional = $address->getAdditional();
        $additional['setDefaultShippingAddress'] = 1;
        $address->setAdditional($additional);

        if ($this->isValidShippingAddress($address)) {
            $this->addressService->setDefaultShippingAddress($address);
        }

        $this->redirect(['action' => 'index', 'success' => 'default_shipping']);
    }

    /** * Sets the default shipping address */
    

        $products = [];
        foreach ($result as $item) {
            $number = (string) $item['Detail_number'];

            $product = new ListProduct(
                $item['Article_id'],
                $item['Detail_id'],
                $item['Detail_number']
            );
            if ($item['Detail_additionalText']) {
                $product->setAdditional($item['Detail_additionalText']);
            }
            $products[$number] = $product;
        }

        return $products;
    }

    /** * @param array[] $ast */
    private function displayVariants($ast): bool
    {

        $products = [];
        foreach ($result as $item) {
            $number = $item['number'];

            $product = new ListProduct(
                $item['articleId'],
                $item['articleDetailId'],
                $item['number']
            );
            if ($item['additionalText']) {
                $product->setAdditional($item['additionalText']);
            }
            $products[$number] = $product;
        }

        return $products;
    }

    /** * @param ListProduct[] $products * * @return array */
/** * @param array<array<string, mixed>> $products * * @return ListProduct[] */
    private function buildListProducts(array $products): array
    {
        $listProducts = [];
        foreach ($products as $product) {
            $listProduct = new ListProduct($product['articleId']$product['variantId']$product['number']);
            $listProduct->setAdditional($product['additionalText']);
            $listProducts[$product['number']] = $listProduct;
        }

        return $listProducts;
    }

    /** * @param array<array<string, mixed>> $products * * @return array<array<string, mixed>> */
    

        }

        // If product has variants, we need to append the additional text to the name         if ($product['configurator_set_id'] > 0) {
            $productStruct = new ListProduct(
                (int) $product['id'],
                (int) $product['did'],
                $orderNumber
            );

            $productStruct->setAdditional($product['additionaltext']);

            $context = $this->contextService->getShopContext();
            $productStruct = $this->additionalTextService->buildAdditionalText($productStruct$context);

            if (!$returnAll) {
                return $product['articleName'] . ' ' . $productStruct->getAdditional();
            }

            $product['additionaltext'] = $productStruct->getAdditional();
        }

        
if (empty($this->sSettings['variant_export']) || $this->sSettings['variant_export'] == 1) {
                    $row['group_additionaltext'] = [];

                    if (!empty($row['group_ordernumber'])) {
                        foreach ($row['group_ordernumber'] as $orderNumber) {
                            $product = new ListProduct(
                                (int) $row['articleID'],
                                (int) $row['articledetailsID'],
                                $orderNumber
                            );

                            $product->setAdditional($row['additionaltext']);

                            $product = $this->additionalTextService->buildAdditionalText($product$context);

                            if (\array_key_exists($orderNumber$row['group_additionaltext'])) {
                                $row['group_additionaltext'][$orderNumber] = $product->getAdditional();
                            }
                            if ($orderNumber == $row['ordernumber']) {
                                $row['additionaltext'] = $product->getAdditional();
                            }
                        }
                    }
                }
if ($data['__product_datum']) {
            $product->setCreatedAt(
                new DateTime($data['__product_datum'])
            );
        }
        if ($data['__product_changetime']) {
            $product->setUpdatedAt(
                new DateTime($data['__product_changetime'])
            );
        }

        $product->setAdditional($data['__variant_additionaltext']);
        $product->setEan($data['__variant_ean']);
        $product->setHeight((float) $data['__variant_height']);
        $product->setLength((float) $data['__variant_length']);
        $product->setMinStock((int) $data['__variant_stockmin']);
        $product->setWeight((float) $data['__variant_weight']);
        $product->setWidth((float) $data['__variant_width']);

        $customerGroups = explode('|', $data['__product_blocked_customer_groups'] ?? '');
        $customerGroups = array_filter($customerGroups);
        $product->setBlockedCustomerGroupIds($customerGroups);
        $product->setHasAvailableVariant($data['__product_has_available_variants'] > 0);

        
$productId,
                    'article'
                );
            } else {
                $variantData = $this->productModule->sGetTranslation(
                    $variantData,
                    $variantData['id'],
                    'variant'
                );
            }

            $product->setAdditional($variantData['additionaltext']);
            $products[(string) $variantData['ordernumber']] = $product;
        }

        $products = $this->additionalTextService->buildAdditionalTextLists($products$context);

        return array_map(
            function DListProduct $elem) {
                return [
                    'ordernumber' => $elem->getNumber(),
                    'additionaltext' => $elem->getAdditional(),
                ];
            },
Home | Imprint | This part of the site doesn't use cookies.