Last Updated: May 03, 2017
·
3.365K
· dja4mower

Easily Add YouTube Videos to Magento product page

Create "video" text input attribute.

Now you should find the place in the following file where you want the video to appear: app/design/frontend/yourpackage/yourtheme/template/catalog/product/view.phtml
In this example we will place it under the product name.

<?php if($_product->getVideo()): ?>
   <iframe width="560" height="315" src="http://www.youtube.com/embed/<?php echo $_product->getVideo() ?>" frameborder="0" allowfullscreen></iframe>
<?php endif; ?>

1 Response
Add your response

You have to insert the code given above just below the following code in view.phtml file. Only then the video will be displayed under the product name.

<div class="product-name">
<h1><?php echo $helper->productAttribute($product, $_product->getName(), 'name') ?></h1>
</div>

For more: http://www.demagento.com/how-to-add-magento-product-video-programmatically/

over 1 year ago ·