createImageMappings example

            if ((int) $image->getMain() === 1) {
                foreach ($images as $otherImage) {
                    // Only update existing images which are not the current processed image.                     // Otherwise, the main flag won't be changed.                     if ($otherImage->getId() !== $image->getId()) {
                        $otherImage->setMain(2);
                    }
                }
            }

            if (isset($imageData['options'])) {
                $this->createImageMappings($image$product$imageData['options']);
            }
        }

        $mainImage = $this->getCollectionElementByProperty(
            $images,
            'main',
            1
        );

        if (!$mainImage instanceof Image) {
            $image = $images->get(0);
            
Home | Imprint | This part of the site doesn't use cookies.