[TomatoCart] – Integrate Facebook and Twitter share button into product details page

It is useful to let your customer spread your products in their social account. In this article, I will show you how to integrate Facebook and Twitter share button into product details page of bootstrap template.




Steps to apply this feature for your store

Step 1. Download a package at https://www.dropbox.com/s/3uss81mcj7lv3fy/socialshare.zip?dl=0

Step 2. Extract the package into your local computer.

Snip20150725_7Step 3. Copy above templates fold into your tomatocart root directory in your online host server.

Step 4. Find templates > bootstrap > content > products > info.php.

Snip20150725_8Step 5. Find following code snippet:

 $description = $osC_Product->getShortDescription();
                        if (!empty($description)) {

Add following code above it:

<div class="social-share clearfix">
                            $share_link = osc_href_link(FILENAME_PRODUCTS, $osC_Product->getID() . (isset($_GET['manufacturers']) ? '&manufacturers=' . $_GET['manufacturers'] : ($cPath ? '&cPath=' . $cPath : '')));                            
                        <div class="pull-right">
                            <div class="row">
                                <div class="span5">
                                    <a class="twitter-share-button" href="http://twitter.com/share?url=<?php echo $share_link?>&text=<?php echo $osC_Product->getData('name')?>" data-count="none">Tweet</a>
                                <div class="span2"></div>
                                <div class="span5">
                                    <a class="fb-share-button" data-href="<?php echo $share_link?>" data-layout="button"></a>

Step 6. Add following code at the bottom of file:

<script src="templates/bootstrap/javascript/twitter.js"></script>
<script src="templates/bootstrap/javascript/facebook.js"></script>

That’s it. Note: this plugin just work in bootstrap template. If you are using grass gray template, please don’t apply it.

Looking for quality TomatoCart hosting? Check out Arvixe Web Solutions.

Tags: , , , , , , , , | Posted under TomatoCart | RSS 2.0

Author Spotlight

Jack Yin

TomatoCart Developer & Co Founder - Arvixe Web Hosting / TomatoCart Community Liaison

Leave a Reply

Your email address will not be published. Required fields are marked *