Last Updated: May 03, 2017
·
3.574K
· 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 ·

Have a fresh tip? Share with Coderwall community!

Post
Post a tip
Related Tags
#magento
Did you know?

Magento checkout pages are a common target for Magecart-style card skimming. Payment, analytics, and extension scripts on those pages need an inventory and a watch for silent changes.

Security insights from Cside