in local.xml:
<reference name="head">
<!-- Share this -->
<block type="core/text" name="share_this">
<action method="setText">
<text>
<![CDATA[
<script type="text/javascript" src="http://w.sharethis.com/button/buttons.js"></script>
<script type="text/javascript">stLight.options({publisher: "pub_number_here", doNotHash: false, doNotCopy: false, hashAddressBar: false});</script>
]]>
</text>
</action>
</block>
</reference>
in page/html/head.phtml:
<?php /* Open Graph Protocol for Facebook and SEO */ ?>
<?php if(Mage::registry('current_product')): ?>
<?php $product = Mage::registry('current_product'); ?>
<meta property="og:title" content="<?php echo ($product->getName()); ?>" />
<meta property="og:type" content="article" />
<meta property="og:url" content="<?php echo Mage::registry('product')->getProductUrl(); ?>" />
<meta property="og:image" content="<?php echo $this->helper('catalog/image')->init($product, 'small_image')->resize(200,200);?>" />
<meta property="og:image:type" content="image/png" />
<meta property="og:image:width" content="200" />
<meta property="og:image:height" content="200" />
<meta property="og:description" content="<?php echo strip_tags(($product->getShortDescription())); ?>" />
<meta property="og:site_name" content="<?php echo Mage::app()->getStore()->getName(); ?>" />
<?php elseif(Mage::registry('current_category')): ?>
<meta property="og:title" content="<?php echo $this->getTitle() ?>" />
<meta property="og:type" content="website" />
<meta property="og:url" content="<?php echo $this->helper('core/url')->getCurrentUrl();?>" />
<meta property="og:description" content="<?php echo strip_tags($this->getDescription()) ?>" />
<meta property="og:site_name" content="<?php echo Mage::app()->getStore()->getName(); ?>" />
<?php else: ?>
<meta property="og:title" content="<?php echo $this->getTitle() ?>" />
<meta property="og:type" content="website" />
<meta property="og:url" content="<?php echo $this->helper('core/url')->getCurrentUrl();?>" />
<meta property="og:description" content="<?php echo strip_tags($this->getDescription()) ?>" />
<meta property="og:site_name" content="<?php echo Mage::app()->getStore()->getName(); ?>" />
<?php endif; ?>
in catalog/product/view.phtml:
<div class="social">
<ul>
<li><span class='st_facebook'></span></li>
<li><span class='st_twitter'></span></li>
<li><span class='st_pinterest'></span></li>
<li><span class='st_googleplus'></span></li>
</ul>
</div>
css:
.social {
line-height: 30px;
ul li {
float: left;
padding-right: 6px;
}
ul li .stButton {
background-image: url(../images/social-all@2x.png);
background-size: 180px 60px;
background-position-y: 0;
text-indent: -9999px;
width: 30px !important;
height: 30px;
display: block;
}
.st_facebook .stButton {
background-position-x: 0;
}
.st_twitter .stButton {
background-position-x: -30px;
}
.st_pinterest .stButton {
background-position-x: -60px;
}
.st_googleplus .stButton {
background-position-x: -120px;
}
ul li .stButton:hover {
background-position-y: 30px;
}
}