Update: There has been a few updates to the code below, especially the Google Buzz code.
——-
I have been building a magento based site over the past few months for a new project I am working on with Ruth. The end product will be an online food store that sell Australian Gourmet Foods.
I spent a while searching around Google trying to figure out how to add social networking buttons into the products page. I basically wanted people to click “Share on Facebook”, “Tweet This” and more recently “Buzz This” and send the product name, the URL and any other text I wanted.
All you really need to know the two pieces of code below that will grab the product name and URL you need to insert into the URL of the code you are going to be placing on your page. I have already inserted this code into each URL.
Twitter
Facebook
——-
I have been building a magento based site over the past few months for a new project I am working on with Ruth. The end product will be an online food store that sell Australian Gourmet Foods.
I spent a while searching around Google trying to figure out how to add social networking buttons into the products page. I basically wanted people to click “Share on Facebook”, “Tweet This” and more recently “Buzz This” and send the product name, the URL and any other text I wanted.
All you really need to know the two pieces of code below that will grab the product name and URL you need to insert into the URL of the code you are going to be placing on your page. I have already inserted this code into each URL.
- <?php echo $this->htmlEscape($_product->getName()) ?> = This code fetches the product name
- <?php echo $_product->getProductUrl() ?> = This code fetches the Product URL
<a title=”Send this page to Twitter!” href=”http://twitter.com/home?status=Check out the <?php echo $this->htmlEscape($_product->getName()) ?> at <?php echo $_product->getProductUrl() ?> @foodoAU” target=”_blank”><img src=”YOUR BUTTON HERE” alt=”Follow foodoAU on Twitter“/></a>
<a href=”http://www.facebook.com/sharer.php?u=<?php echo $_product->getProductUrl() ?>&t=Check+this+out” target=”_blank” title=”Share on Facebook”><img src=”YOUR BUTTON HERE” alt=”Share on Facebook”></a>
Google Buzz
<a href=”http://www.google.com/buzz/post?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 src=”YOUR BUTTON” ” alt=”Google Buzz This!” /></a>
No comments:
Post a Comment