Social networking is all the rage these days. And if you’d like to link your OXID shop up to the largest social network on the Web, it’s quite easy! This article shows you how to easily add Facebook “Share” and “Like” buttons to your product pages, both with and without XFBML.
At the end of this tutorial, you should have product pages that look something like this:
To add Facebook buttons to pages without XFBML, you need a few additional lines of code in your product details pages. Example of adding “Share” and “Like” buttons to details page:
This code assigns the URL of the product page to the parameter “share_url”, which will be shared on facebook. To obtain the product link, use a method call like “$product->getLink()”.
More options on creating “Share” buttons can be found at http://developers.facebook.com/docs/reference/plugins/like.
A “Like” button will be inserted on a page using an iframe. The URL to the product page is assigned in the same way as previously ie. using “$product->getLink()”. Also, you can define the width and height of the iframe for greater control.
More options on creating “Like” buttons can be found at http://www.facebook.com/facebook-widgets/share.php.
Facebook uses XFBML as a way for you to incorporate FBML (Facebook Markup Language, an extension to HTML) into an HTML page. Using XFBML provides an easy way to incorporate Facebook Connect features into a site.
The first step is to connect the OXID shop site to Facebook using Facebook Connect. This includes several steps:
- Creating an application for the site on Facebook.com
- Getting an Application ID
- Adding XFBML support to existing site
These steps are discussed in detail in this tutorial on how to add Facebook Connect to existing sites. Once you’ve completed this task, it is very simple to add “Like” and “Share” buttons.
You can read documentation about the “Like” button at http://developers.facebook.com/docs/reference/plugins/like
You can read documentation about the “Share” button here:
Remember that you must replace the text YOUR_URL_HERE in the above code with a link to the product page:
And that’s all there is to it! Here is a list of other facebook plugins which can be easly added to your site. Have fun!
Facebook Integration Coming in OXID eShop 4.4.0
The next major release of OXID eShop, version 4.4.0, will ship with an awesome integration of Facebook into the Open Source eCommerce system.