convertMediaStruct example

continue;
            }

            $mediaId = $blogArticle['media'][0]['mediaId'];

            if (!isset($medias[$mediaId])) {
                continue;
            }

            /** @var Media $media */
            $media = $medias[$mediaId];
            $media = $this->get(LegacyStructConverter::class)->convertMediaStruct($media);

            $blogArticles[$key]['media'] = $media;
        }

        // RSS and ATOM Feed part         if ($this->Request()->getParam('sRss') || $this->Request()->getParam('sAtom')) {
            $this->Response()->headers->set('content-type', 'text/xml');
            $type = $this->Request()->getParam('sRss') ? 'rss' : 'atom';
            $this->View()->loadTemplate('frontend/blog/' . $type . '.tpl');
        }

        
foreach ($shopPositions as $shopId => $positions) {
            $context = $this->get(ContextServiceInterface::class)->createShopContext($shopId);

            $shopPositionImages[$shopId] = $this->get(MediaServiceInterface::class)->getCovers(
                $positions,
                $context
            );

            $shopPositionImages[$shopId] = array_map(
                function D$mediaStruct) {
                    return $this->get(LegacyStructConverter::class)->convertMediaStruct($mediaStruct);
                },
                $shopPositionImages[$shopId]
            );
        }

        return $shopPositionImages;
    }

    /** * @param string $sendTime * * @return array */
switch ($element->getComponent()->getType()) {
            case BannerSliderComponentHandler::COMPONENT_NAME:
                $bannerConfig = $element->getConfig()->get('banner_slider');

                $config = [];
                foreach ($bannerConfig as $bannerConfigData) {
                    $config[$bannerConfigData['mediaId']] = $bannerConfigData;
                }

                foreach ($element->getData()->get('mediaList') as $index => $mediaObject) {
                    $media = $this->converter->convertMediaStruct($mediaObject);

                    $media['title'] = $config[$media['id']]['title'];
                    $media['altText'] = $config[$media['id']]['altText'];
                    $media['link'] = $config[$media['id']]['link'];

                    $media['mediaId'] = $media['id'];
                    $media['path'] = $media['source'];
                    $media['fileInfo'] = [
                        'width' => $media['width'],
                        'height' => $media['height'],
                    ];

                    
foreach ($getBanners as &$getAffectedBanners) {
            // converting to old format             $getAffectedBanners['valid_from'] = $getAffectedBanners['validFrom'];
            $getAffectedBanners['valid_to'] = $getAffectedBanners['validTo'];
            $getAffectedBanners['link_target'] = $getAffectedBanners['linkTarget'];
            $getAffectedBanners['categoryID'] = $getAffectedBanners['categoryId'];

            $getAffectedBanners['img'] = $getAffectedBanners['image'];

            $media = $this->getMediaByPath($medias$getAffectedBanners['image']);
            if ($media !== null) {
                $media = $this->legacyStructConverter->convertMediaStruct($media);
                $getAffectedBanners['media'] = $media;
            }

            $bannerStatistics = $this->modelManager->getRepository(TrackingBanner::class)->getOrCreateBannerStatsModel($getAffectedBanners['id']);
            $bannerStatistics->increaseViews();
            $this->modelManager->persist($bannerStatistics);
            $this->modelManager->flush($bannerStatistics);

            if (!empty($getAffectedBanners['link'])) {
                $query = [
                    'module' => 'frontend',
                    
'configurator_group' => $group,
        ]);
    }

    /** * @return array */
    public function convertCategoryStruct(Category $category)
    {
        $media = null;
        if ($category->getMedia()) {
            $media = $this->convertMediaStruct($category->getMedia());
        }

        $attribute = [];
        if ($category->hasAttribute('core')) {
            $attribute = $category->getAttribute('core')->toArray();
        }

        $productStream = null;
        if ($category->getProductStream()) {
            $productStream = $this->convertRelatedProductStreamStruct($category->getProductStream());
        }

        
$nextProduct = isset($products[$index + 1]) ? $products[$index + 1] : null;

            $navigation = [];

            if ($previousProduct && $previousListProduct = $this->listProductService->get($previousProduct->getNumber()$context)) {
                $navigation['previousProduct']['orderNumber'] = $previousListProduct->getNumber();
                $navigation['previousProduct']['link'] = $this->config->get('sBASEFILE') . '?sViewport=detail&sDetails=' . $previousListProduct->getId() . '&sCategory=' . $categoryId;
                $navigation['previousProduct']['name'] = $previousListProduct->getName();

                $previousCover = $previousListProduct->getCover();
                if ($previousCover) {
                    $navigation['previousProduct']['image'] = $this->legacyStructConverter->convertMediaStruct(
                        $previousCover
                    );
                }
            }

            if ($nextProduct && $nextListProduct = $this->listProductService->get($nextProduct->getNumber()$context)) {
                $navigation['nextProduct']['orderNumber'] = $nextListProduct->getNumber();
                $navigation['nextProduct']['link'] = $this->config->get('sBASEFILE') . '?sViewport=detail&sDetails=' . $nextListProduct->getId() . '&sCategory=' . $categoryId;
                $navigation['nextProduct']['name'] = $nextListProduct->getName();

                $nextCover = $nextListProduct->getCover();
                

        $this->mediaService = $mediaService;
        $this->structConverter = $structConverter;
        $this->contextService = $contextService;
    }

    public function resolve(): void
    {
        $medias = $this->mediaService->getList($this->resolveIds, $this->contextService->getShopContext());

        foreach ($medias as $id => $media) {
            $this->storage[$id] = $this->structConverter->convertMediaStruct($media);
        }

        $this->resolveIds = [];
    }
}
$covers = $this->variantCoverService->getList($products$context);
        $details = [];
        foreach ($products as $product) {
            $arrayProduct = $this->legacyStructConverter->convertListProductStruct($product);

            if ($product->hasConfigurator()) {
                $variantPrice = $product->getVariantPrice();
                $arrayProduct['referenceprice'] = $variantPrice->getCalculatedReferencePrice();
            }

            if (isset($covers[$product->getNumber()])) {
                $arrayProduct['image'] = $this->legacyStructConverter->convertMediaStruct($covers[$product->getNumber()]);
            }

            if ($product->hasProperties() && isset($propertySets[$product->getNumber()])) {
                $propertySet = $propertySets[$product->getNumber()];
                $arrayProduct['sProperties'] = $this->legacyStructConverter->convertPropertySetStruct($propertySet);
                $arrayProduct['filtergroupID'] = $propertySet->getId();
                $arrayProduct['properties'] = array_map(function D$property) {
                    return $property['name'] . ': ' . $property['value'];
                }$arrayProduct['sProperties']);
                $arrayProduct['properties'] = implode(', ', $arrayProduct['properties']);
            }

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