Guest User

Untitled

a guest
Jan 21st, 2019
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.23 KB | None | 0 0
  1. public function getGalleryImagesJson()
  2. {
  3. $imagesItems = [];
  4. foreach ($this->getGalleryImages() as $image) {
  5. $imagesItems[] = [
  6. 'thumb' => $image->getData('small_image_url'),
  7. 'img' => $image->getData('medium_image_url'),
  8. 'full' => $image->getData('large_image_url'),
  9. 'caption' => ($image->getLabel() ?: $this->getProduct()->getName()),
  10. 'position' => $image->getPosition(),
  11. 'isMain' => $this->isMainImage($image),
  12. 'type' => str_replace('external-', '', $image->getMediaType()),
  13. 'videoUrl' => $image->getVideoUrl(),
  14. 'video' => $image->getVideoUrl(), //This is new
  15. ];
  16. }
  17. if (empty($imagesItems)) {
  18. $imagesItems[] = [
  19. 'thumb' => $this->_imageHelper->getDefaultPlaceholderUrl('thumbnail'),
  20. 'img' => $this->_imageHelper->getDefaultPlaceholderUrl('image'),
  21. 'full' => $this->_imageHelper->getDefaultPlaceholderUrl('image'),
  22. 'caption' => '',
  23. 'position' => '0',
  24. 'isMain' => true,
  25. 'type' => 'image',
  26. 'videoUrl' => null,
  27. 'video' => null, //This is new
  28. ];
  29. }
  30. return json_encode($imagesItems);
  31. }
Add Comment
Please, Sign In to add comment