Question

I've tried to get video on product page on other place not on gallery. But i can't retrieve it. I've seen it stored on catalog_product_entity_media_gallery_value_video

I want to get it proper not direct query. anybody knows proper way?

Was it helpful?

Solution

I suggest you to use $product->getMediaGalleryImages()

$galleryImages = $product->getMediaGalleryImages();
if ($galleryImages) {
    foreach ($galleryImages as $image) {
        $imageData = $image->getData();

        // Check media type
        if (isset($imageData['media_type']) && $imageData['media_type'] == 'external-video') {
            // Your code here
        }
    }
}
Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top