How to add Youtube video to product details page in magento

1. Add an attribute called video_embed_code
2. Add the attribute into your products’ attribute sets.
3. Fill in youtube embed codes into these attributes.
4. Where you want to render the videos, place the following code:


<div><code> <div class='youtube-vid'>
<?php if ($_product->getData('video_embed_code')): ?>
 <?php $youtubevid= $_product->getResource()->getAttribute('video_embed_code')->getFrontend()->getValue($_product); ?>
 <?php echo $youtubevid; ?>
<?php endif; ?>
</div> </code></div>
<div>

now enjoy magento

for more magento tutorial visit: http://blog.free-extension.com/

  1. July 16th, 2011
    Trackback from : Magento « PHP Web Developer

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.