Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function getGalleryImagesJson()
- {
- $imagesItems = [];
- foreach ($this->getGalleryImages() as $image) {
- $imagesItems[] = [
- 'thumb' => $image->getData('small_image_url'),
- 'img' => $image->getData('medium_image_url'),
- 'full' => $image->getData('large_image_url'),
- 'caption' => ($image->getLabel() ?: $this->getProduct()->getName()),
- 'position' => $image->getPosition(),
- 'isMain' => $this->isMainImage($image),
- 'type' => str_replace('external-', '', $image->getMediaType()),
- 'videoUrl' => $image->getVideoUrl(),
- 'video' => $image->getVideoUrl(), //This is new
- ];
- }
- if (empty($imagesItems)) {
- $imagesItems[] = [
- 'thumb' => $this->_imageHelper->getDefaultPlaceholderUrl('thumbnail'),
- 'img' => $this->_imageHelper->getDefaultPlaceholderUrl('image'),
- 'full' => $this->_imageHelper->getDefaultPlaceholderUrl('image'),
- 'caption' => '',
- 'position' => '0',
- 'isMain' => true,
- 'type' => 'image',
- 'videoUrl' => null,
- 'video' => null, //This is new
- ];
- }
- return json_encode($imagesItems);
- }
Add Comment
Please, Sign In to add comment