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 info visit mage-people

Advertisements
  1. Wonderful paintings! This is the kind of information that should be shared across the internet. Shame on Google for no longer positioning this publish upper! Come on over and discuss with my site . Thank you =)

  2. I’m not that much of a internet reader to be honest but your sites really nice,
    keep it up! I’ll go ahead and bookmark your website to come back later. Cheers

  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 )

Google+ photo

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

Connecting to %s

%d bloggers like this: