Forums / Basic Configuration / Facebook comment box on product pages

Facebook comment box on product pages

Views: 9,786

Results 1 to 20 of 26
16 Apr 2011, 2:34 PM
#1
endre avatar

endre

New Zenner

Join Date:
Dec 2008
Posts:
38
Plugin Contributions:
0

Facebook comment box on product pages

Hi all.
I tried searching for a way to add Facebook comment box to the product pages, but I couldn't find anyone that had come up with a way to do this.
After a quick look, I came up with this, which seems to work:

<!--bof Facebook comments--> <div id="fb-root"></div><script src="http://connect.facebook.net/en_US/all.js#appId=APP_ID&xfbml=1"></script><fb:comments href="<?php echo zen_href_link(zen_get_info_page((int)$_GET['products_id']),'cPath= '.(int)$_GET['cPath'].' &products_id=' . (int)$_GET['products_id']); ?>" num_posts="5" width="600"></fb:comments> <!--eof Facebook comments-->

Paste the code where you want the comment box to appear on your /includes/templates/YOUR_TEMPLATE/templates/tpl_product_info_display.php

16 Apr 2011, 2:56 PM
#2
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: Facebook comment box on product pages

'cPath= '.(int)$_GET['cPath']
```This will return only the top category, not necessarily the entire cPath. It likely works because you have tested it in a top-level category. The (int) should not be in this section.
```php
'cPath='.$_GET['cPath']

Also, remove the space after =.

16 Apr 2011, 3:30 PM
#3
endre avatar

endre

New Zenner

Join Date:
Dec 2008
Posts:
38
Plugin Contributions:
0

Re: Facebook comment box on product pages

Hi gjh42.
Thanks for the heads up on the top level issue.
I only have two levels of categories, and I tried it on products in both top and 2nd level category.

I'll leave it to people with more than two category levels to test your suggestion.

Cheers

16 Apr 2011, 3:47 PM
#4
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: Facebook comment box on product pages

It may still basically function while using an incomplete cPath. Can you see the cPath that is used in the comment process/link?
This is the way it is used in /includes/modules/pages/index/header_php.php
Line #57 :
zen_redirect(zen_href_link(zen_get_info_page($listing->fields['products_id']), ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $listing->fields['products_id']));

which, assuming there is a cPath, can be simplified to

zen_redirect(zen_href_link(zen_get_info_page($listing->fields['products_id']), 'cPath=' . $cPath . '&' . 'products_id=' . $listing->fields['products_id']));

(int) forces a string value to be an integer, and has the effect of discarding any characters after initial numerals.
'3_57' would become 3.

16 Apr 2011, 6:01 PM
#5
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: Facebook comment box on product pages

I had recently put a fb like button on my product pages using similar code from picaflor-azul's tutorial, and when I checked the result on fb just now, the backlink led to the product info page, but with the wrong cPath (top cat only, not subcat). This affected the categories sidebox display, and would most likely affect the breadcrumbs.

When I uploaded a version with the (int) removed and rechecked, it led to the correct info page with the correct cPath. Also, the product image showed on fb where it didn't before.

16 Apr 2011, 6:56 PM
#6
endre avatar

endre

New Zenner

Join Date:
Dec 2008
Posts:
38
Plugin Contributions:
0

Re: Facebook comment box on product pages

Hi.
Yes, you are correct.
The incomplete cPath was corrected with removal of (int).

Cheers
Endre

18 Apr 2011, 8:02 AM
#7
endre avatar

endre

New Zenner

Join Date:
Dec 2008
Posts:
38
Plugin Contributions:
0

Re: Facebook comment box on product pages

Endre:

Hi all.
I tried searching for a way to add Facebook comment box to the product pages, but I couldn't find anyone that had come up with a way to do this.
After a quick look, I came up with this, which seems to work:

<!--bof Facebook comments--> <div id="fb-root"></div><script src="http://connect.facebook.net/en_US/all.js#appId=APP_ID&xfbml=1"></script><fb:comments href="<?php echo zen_href_link(zen_get_info_page((int)$_GET['products_id']),'cPath= '.(int)$_GET['cPath'].' &products_id=' . (int)$_GET['products_id']); ?>" num_posts="5" width="600"></fb:comments> <!--eof Facebook comments-->

Paste the code where you want the comment box to appear on your /includes/templates/YOUR_TEMPLATE/templates/tpl_product_info_display.php

I'm trying to add admin moderation capabilities to the code, but no luck so far.
This is what it says on Facebook: "To moderate, you need to list yourself as an admin. To do this, simply include open graph meta tags on the URL specified as the href parameter of the plugin. Include:<meta property="fb:admins" content="YOUR_FACEBOOK_USER_ID}"/>
I can't seem to find the right place to put this piece of code.
Any ideas?

Cheers
Endre

18 Apr 2011, 12:41 PM
#8
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: Facebook comment box on product pages

Have you looked at numinix' tutorial on the subject? That describes adding a bunch of fb og meta properties, so would probably be a good guide.

19 Apr 2011, 11:14 AM
#9
endre avatar

endre

New Zenner

Join Date:
Dec 2008
Posts:
38
Plugin Contributions:
0

Re: Facebook comment box on product pages

Hi.
I can't find this tutorial.
Have looked at his website, searched toe forum on his website and here.
Do you have a link to where I can find it?
I'm very interested in adding moderation capabilities to the FB comments plugin.

Cheers
Endre

21 Apr 2011, 4:01 PM
#11
alex001bbb avatar

alex001bbb

New Zenner

Join Date:
Nov 2009
Posts:
4
Plugin Contributions:
0

Re: Facebook comment box on product pages

Hi guys!
I'm a complete disaster with this... I've not been able to make it work properly. I always get the same error "The comments plugin requires an href parameter." and when I check the code I get a funny URL like this: index.php?main_page=product_info&cPath=%201%20&products_id=1516

without my domain name...

Can anyone post an easy-to-follow instructions for people like me? Thanks in advance!:lookaroun

21 Apr 2011, 4:58 PM
#12
endre avatar

endre

New Zenner

Join Date:
Dec 2008
Posts:
38
Plugin Contributions:
0

Re: Facebook comment box on product pages

Hi,
Paste this code wherever you want the comment field to appear on your product page:

<!--bof Facebook comments--> <div id="fb-root"></div><script src="http://connect.facebook.net/en_US/all.js#appId=APP_ID&xfbml=1"></script><fb:comments href="<?php echo zen_href_link(zen_get_info_page((int)$_GET['products_id']),'cPath='. $_GET['cPath'].' &products_id='. $_GET['products_id']); ?>" num_posts="5" width="600"></fb:comments> <!--eof Facebook comments-->
21 Apr 2011, 5:21 PM
#13
alex001bbb avatar

alex001bbb

New Zenner

Join Date:
Nov 2009
Posts:
4
Plugin Contributions:
0

Re: Facebook comment box on product pages

Hi,
Thank you very much for your help! However I still have the same error:
The code above has been inserted in:
/includes/templates/YOUR_TEMPLATE/templates/tpl_product_info_display.php

And I get the same warning from facebook:
The comments plugin requires an href parameter.

The html code shows this:

<!--bof Facebook comments--> <div id="fb-root"></div><script src="//connect.facebook.net/en_US/all.js#appId=APP_ID&xfbml=1"></script><fb:comments href="index.php?main_page=product_info&cPath=1_20%20&products_id=1900" num_posts="5" width="400"></fb:comments> <!--eof Facebook comments-->

I have also the facebook like button above in the same page and the facebook sidebox on the right. The sidebox seems to be also interefered with the error in someway.When the code is working the sidebox does not work as usual and shows a "go to facebook" link.

Thank you very much. It seems easy to me and I don't see why it's not working. By the way my zencart version is 1.3.8 but with most bugfixes.

21 Apr 2011, 7:16 PM
#14
endre avatar

endre

New Zenner

Join Date:
Dec 2008
Posts:
38
Plugin Contributions:
0

Re: Facebook comment box on product pages

Hi, always use the latest version of ZC.
I recommend using WinMerge to compare your files with the updated version if you have many addons installed.

I have "FB comments" installed on 1.3.9h, alongside addthis.com's "Like it" button, and that works fine.
Might be an issue with XFBML on 1.3.8.
I'm sorry, but then I think you are going to have to rely on someone else to help you.
I'm not a developer, so not sure how you would solve this.

Endre

2 May 2011, 12:14 PM
#15
endre avatar

endre

New Zenner

Join Date:
Dec 2008
Posts:
38
Plugin Contributions:
0

Re: Facebook comment box on product pages

Just a quick update on the Facebook comment plugin.
In order to moderate comments from within the plugin on each product page, put this bit of code in your html_header.php, in the <head> tag of includes/templates/template_default or custom/templates/html_header.php:
<meta property="fb:admins" content='YOUR-FB-ID' />
<meta property="fb:app_id" content='YOUR-FB-APP-ID' />

Cheers
Endre

5 May 2011, 2:06 PM
#16
endre avatar

endre

New Zenner

Join Date:
Dec 2008
Posts:
38
Plugin Contributions:
0

Re: Facebook comment box on product pages

The moderation tool works brilliantly.
If you want to moderate comments within the plugin on every product page only, then you don't need an app id.
But if you want to moderate comments on multiple domains perhaps, or want all comments from one domain on one page, then you have to set up a new application on Facebook Developers.

The admin gets a notification on his/her Facebook profile page whenever a new comment is posted.

Endre

15 May 2011, 1:39 PM
#17
jiapien avatar

jiapien

New Zenner

Join Date:
May 2011
Posts:
5
Plugin Contributions:
0

Re: Facebook comment box on product pages

Hi Guys,

THe scripts work fine. However i faced something really challenging....

1.) the comments box does not shown all the time
2.) the comments will gone after a while and unable to be retrieved using https://graph.facebook.com/comments/?ids=[YOUR URL]

3.) it turned back to the old facebook comment box (not the one we saw in FB site)

it's really annoying !!! :cry: (i'm using zen cart V1.3.9h)

16 May 2011, 1:11 PM
#18
jiapien avatar

jiapien

New Zenner

Join Date:
May 2011
Posts:
5
Plugin Contributions:
0

Re: Facebook comment box on product pages

Hi Guys,

I just found out actually it was caused by the fanbox issue.

DO NOT PUT FANBOX and COMMENTS BOX on the same page. They will cause your comments box functioning not properly!!!

Regards

John

jiapien:

Hi Guys,

THe scripts work fine. However i faced something really challenging....

1.) the comments box does not shown all the time
2.) the comments will gone after a while and unable to be retrieved using https://graph.facebook.com/comments/?ids=[YOUR URL]

3.) it turned back to the old facebook comment box (not the one we saw in FB site)

it's really annoying !!! :cry: (i'm using zen cart V1.3.9h)

21 Jul 2011, 11:06 AM
#19
lilly06 avatar

lilly06

New Zenner

Join Date:
Dec 2010
Location:
monaco
Posts:
40
Plugin Contributions:
0

Re: Facebook comment box on product pages

I'd like to know how to be able to get the image of the products posted in the same time with the comment on FB's wall?

i've added this to my store, but for some reasons when a comment is posted no images are shown on Facebook wall?

i tried to add this code : &products_image='. $_GET['products_images']); but not working

thank you for any help!

21 Jul 2011, 12:43 PM
#20
lilly06 avatar

lilly06

New Zenner

Join Date:
Dec 2010
Location:
monaco
Posts:
40
Plugin Contributions:
0

Re: Facebook comment box on product pages

forget my question i found it! thanx!