Wednesday, February 19, 2014

Adding Video On Products Page In magento

There are several ways to embed videos on products page in magento store.They Can be Added directly on to a Content Page,embedded in static block,placed on products page or category page using attributes.

Today I'll show you How to add Videos using Attributes.Take a Look:
  • Login to your admin control panel.
  • Go to Catalog --> Attributes --> Manage Attributes
  • You will see something like this: 











  • Click on "Add New Attribute" in the top right corner as shown above.
  • In Attribute Properties Column,Enter the new Product Attribute Code as "video".
  • Select Scope from drop down menu.It should be Global.
  • Select Catalog input type as "Text Field".
  • Unique Value --> No
  • Apply to all products --> Select "All Product Types".





















In FrontEnd Properties Column, Enter the values as per your Need. for example. If you want to add Video Products in search then just select option :

  • Use in Quick Search:Yes 
  • Use in Advanced Search: Yes/No
  • Used for Sorting in Product Listing: Yes




























  • After This Select manage Label/Options On left side.
  • Enter title for your video Attribute as shown below:













  • Now you Have successfully created video Attribute for adding video on product page.
  • Next Important  Part is Managing video attribute sets.
  • go to catalog --> Attributes -->manage Attributes sets
  • Select the Default Attribute set from the lIst.
  • On the right side,under "Unassigned attribute" video Attribute is listed.
  • Just Drag That Video attribute to any Group Of your choice.for example.general --> below Short Description.
  • Just see the Below Attachment
































  • Now the Important Part is to add Code in Backend To Show video On Products page.
  • For that, go to magento root Folder.
  • Then Go to app\design\frontend\base\default\template\catalog\product/view.html
  • Search for "short-description".

Immediately after that,Put this code: 

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

On the Product page,You just have to add video Code From youtube And you're done.Here is the Final attachment:


No comments: