One nice thing you should add to your Magento site is the Social Links.
Let your customers promote your products on twitter, facebook and more.
ShareThis
You can grab his code and paste it to your site http://xyz.com/
Your own code
This one is my favorite option. You can code the social links by your own.
Let’s digg into this second option:
First of all Set template path hints to yes and you’ll see wich file you’ll have to edit. It just depens in your theme and where you want to place the code.
System -> Configuration -> Advanced -> Developer
I wanted to place my social links in the product detail page. I found my view.phtml.
It’s very easy. We just need to know wich format the social network needs (facebook, twitter…).
I’m using 2 functions from magento:
Store URL
<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB); ?>
Product Name (if needed)
<?php echo $_helper->productAttribute($_product, $_product->getName(), 'name') ?>
Examples
3 examples using Facebook, Twitter and Delicious.
<a href="http://www.facebook.com/share.php?u=<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB); ?>< ?=substr($_SERVER['REQUEST_URI'], 1)?>"><img src="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_SKIN); ?/>frontend/base/theme156/images/facebook.jpg" alt="" /></a>
<a href="http://twitter.com/home?status=<?php echo $_helper->productAttribute($_product, $_product->getName(), 'name') ?>+<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB); ?>< ?=substr($_SERVER['REQUEST_URI'], 1)?>"><img src="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_SKIN); ?/>frontend/base/theme156/images/twitter.jpg" alt="" /></a>
<a href="http://xyz.com/post?url=<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB); ?>< ?=substr($_SERVER['REQUEST_URI'], 1)?>&title=<?php echo str_replace(" ", "+", $_helper->productAttribute($_product, $_product->getName(), 'name'));?>"><img src="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_SKIN); ?/>frontend/base/theme156/images/delicious.jpg" alt="" /></a>
No comments:
Post a Comment