we would love to hear from you. 202.269.2066 · info@blencorp.com

 

How to add Social links on Magento Product Page?


I was have a lot of trouble building social link to the product page of a Magento website. I searched and found nothing except on extension that doesn’t work at all.

The instructions seem straight forward but it didn’t work for me. Sure I could use one of those Social Networking Bookmarking tools that work with JavaScript like Share this and Add this; but it doesn’t give you flexibility to customize and change.

So I hard coded it to work with my theme. Here are the code:

Facebook

<a href="http://www.facebook.com/sharer.php?u=<?php echo $_product->getProductUrl() ?>&t=Check+this+out" target="_blank" title="Share this on Facebook" target="_blank"><img src="<?php echo $this->getSkinUrl('') ?>/images/icons/YOUR ICON HERE" alt="Share on Facebook" class="noborder"/></a>

Delicious

	<a href="http://delicious.com/save" onclick="window.open('http://delicious.com/save?v=5&noui&jump=close&url='+encodeURIComponent(location.href)+'&title='+encodeURIComponent(document.title), 'delicious','toolbar=no,width=550,height=550'); return false;"><img class=noborder" src="<?php echo $this->getSkinUrl('') ?>/images/icons/YOUR ICON HERE" alt="Delicious" /> </a>

Google Buzz

			<a href="http://www.google.com/reader/link?url=<?php echo $_product->getProductUrl() ?>&title=<?php echo $this->htmlEscape($_product->getName()) ?>&srcURL=YOUR URL&srcTitle=YOUR SITE NAME" target="_blank" rel="nofollow external" title="Google Buzz This"><img class="noborder" src="<?php echo $this->getSkinUrl('') ?>/images/icons/YOUR ICON HERE" alt="Google Buzz This!" /></a><!--more-->

Twitter

		<a title="Send this page on Twitter!" href="http://twitter.com/home?status=Check out the <?php echo $this->htmlEscape($_product->getName()) ?> at <?php echo $_product->getProductUrl() ?> @YOURTWITTERACCOUNT" target="_blank"><img class="noborder" src="<?php echo $this->getSkinUrl('') ?>/images/icons/YOUR ICON HERE" alt="Follow bernos on Twitter"/></a>

To use this simple open the

[/php]view.phtml[php]

located the app/design/default/THEME/Template/product/of your magneto installation. Note that the location of the view.phtml may differ in some instances if your theme is using the template files in the base. Paste the above code with few updates like the your twitter account and the file name of your icons. And it should display in your product pages.

3 Responses to “How to add Social links on Magento Product Page?”

  1. Hi there,

    there is much, much simplified way to do this. Just go to http://www.addthis.com, grab this code (or any other that you can generate there)

    Share
    |



    Then go to your magento folder, find app/template/catalog/product/view/addto.phtml and pass this code at the bottom of content. You will get neet small set of programmed, functional icons.
    I gave this example of how to add this to this particular place of product view page, but you can add this code anywhere you like.

    Justin

    April 3rd, 2010 | 5:04 am
  2. uhh.. I see that my code is not displayed in my previous comments. Anyway, just go to addthis.com and generate yours. They all work. you can see how it looks at our managed webstore. Icon set is placed just after the add to cart button (not english, but vissible :) the link > http://www.ekopievos.lt/cattier-balzamas-po-skutimosi.html

    April 3rd, 2010 | 5:07 am
  3. Yes they use the javascript thing but I wanted the solution without integrating into one button. But your solution works well as well.

    April 7th, 2010 | 3:20 pm

Leave a Reply