Page 1 of 1

Facebook Comments

Posted: Sat Mar 09, 2013 5:30 am
by Bluesplayer
This is pretty interesting and could well boost sales - Facebook Comments

Take a look at this page and then click on the comments tag

puchipetwear.com/collars-amp-leads/dog-leads/crown-jewels-dog-lead

I am going to look into this later on and find out how it is implemented.

Re: Facebook Comments

Posted: Sat Mar 09, 2013 8:26 am
by leo

Code: Select all

 http://developers.facebook.com/docs/reference/plugins/comments/ 

Re: Facebook Comments

Posted: Sat Mar 09, 2013 8:32 am
by Bluesplayer
Thanks.

Looks pretty easy to implement too. Will see if I can do it properly this time and create a tab for it as well :ugeek: .

Re: Facebook Comments

Posted: Sat Mar 09, 2013 2:45 pm
by Bluesplayer
I have implemented this at the cost of reviews. Going by my experience with my others sites very few people will bother writing a review and really what is there to write about with regard to pet products? A comment is as good as usually and gets more attention. To convert the reviews to Facebook comments was quite easy. This is how I did it:

1. edited template layout.tpl and added this above the </body> tag:

Code: Select all

<div id="fb-root"></div>
<script>(function(d, s, id) {
  var js, fjs = d.getElementsByTagName(s)[0];
  if (d.getElementById(id)) return;
  js = d.createElement(s); js.id = id;
  js.src = "//connect.facebook.net/en_GB/all.js#xfbml=1";
  fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>
2. then edited products.tpl by removing this:

Code: Select all

	    <?php if($review_status){?>
		<div class="review_write"><br><a href="<?php echo $write; ?>"><img src="catalog/styles/<?php echo $this->style?>/image/write.png" alt="<?php echo $text_write_short; ?>"></a><br><br>
		<a href="<?php echo $write; ?>"><?php echo $text_write; ?></a></div>
	    <?php } ?>
and replacing it with this:

Code: Select all

	    <?php if($review_status){?>
		<div class="review_write">

<?php $url="http://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']; ?>

<div class="fb-comments" data-href="<?php echo $url; ?>/" data-width="470" data-num-posts="10"></div>

</div>
	    <?php } ?>
3. then I altered the language controller product.php file by altering 'tabs tab_write' to 'Comments' and also by altering 'reviews text_empty' by deleting the contents of.

What the above does is get the current url of the page and allocates it to the Facebook comment code which is needed to make the comments unique and also for them to work once posted to Facebook.

Working now :D . And Facebook is visiting the site a lot now too which might help with getting the site ranked.

My pages are developing nicely now with my new 'Sizes & Measuring' tab and now 'Comments':

apet4life.co.uk/diamond-quilted-leather-collars.html

Nice and neat plus informative :) .

UPDATE

To get the comment count showing next to the tab comment title I did this:

1. edited the product.tpl file where it shows this:

Code: Select all

<?php  if($review_status){
I added code so that it became:

Code: Select all

<?php

$url="http://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];

 if($review_status){
2. then replaced this code:

Code: Select all

$Review_tabs = "<a><div class=\"tab_text\">".$tab_write." </div></a>";
with this:

Code: Select all

$Review_tabs = "<a><div class=\"tab_text\">".$tab_write." <fb:comments-count href=$url></fb:comments-count></div></a>";
Working on my site.

Example page:
apet4life.co.uk/dog-store/dog-coats/sherpa-leather-coat.html

Re: Facebook Comments

Posted: Sat Mar 09, 2013 4:32 pm
by Bluesplayer
I am trying to use this code:

Code: Select all

<fb:comments-count href=page url needed here/></fb:comments-count>
right next to the review tab (currently displaying as comments). This will then display the number of comments on that page. I have tried all ways with javascript and php but failed. The code I have used earlier on to get the page url won't work higher up the product.tpl file for some reason so I can't use this:

Code: Select all

<?php echo curPageURL(); ?>
.

I have tried messing with the product controller file by adding a function in there but that didn't work either. Any ideas?

Re: Facebook Comments

Posted: Sat Mar 09, 2013 5:44 pm
by Brent
I assuming the comments are on the URL you are looking at. Is the count listed? If you, you can get the count similar to how we get currency. Look in the library/currency and you will see the code that retrieves currency conversions.
The same method should work here for you.

Re: Facebook Comments

Posted: Sat Mar 09, 2013 5:48 pm
by Bluesplayer
Brent wrote:I assuming the comments are on the URL you are looking at. Is the count listed? If you, you can get the count similar to how we get currency. Look in the library/currency and you will see the code that retrieves currency conversions.
The same method should work here for you.
I have fixed it now. Going to update this post with the solution.

Thanks.

Re: Facebook Comments

Posted: Sat Mar 09, 2013 6:03 pm
by Bluesplayer
Looking good I think - check it out:

apet4life.co.uk/dog-store/dog-coats/sherpa-leather-coat.html

Re: Facebook Comments

Posted: Sun May 19, 2013 9:40 pm
by readsilk
Great .
Thanks.

Re: Facebook Comments

Posted: Thu May 16, 2019 10:27 pm
by paras
Thanks for the info related to social media