Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Support thread for Facebook Comments addon v2.3.4.1 CE


Recommended Posts

Support thread for Facebook Comments addon v2.3.4.1 CE

A simple addon to let you place a facebook Comments widget on your product information pages.

Again totally standalone with no code change. Simply copy all files into relevant sections and go to admin modules /content and install “facebook Comments ”.

You need to edit one file to put your own website URL so comments are linked to your site. includes/modules/content/product_info/templates/tpl_cm_facebook_comments.php

<!---------------------------put your own website in here----------------->
<div class="col-sm-<?php echo $content_width; ?> cm-pi-facebook_comments">
<div class="fb-comments" data-href="www.yourwebsite.co.uk" data-width="400" data-numposts="5"></div>
</div>

It has been tested on the v2.3.4.1 CE and should just work. You can place it on the product info page like any other item just set it up in admin.

 

facebook.jpg

 

Link to comment
Share on other sites

Dear Zahid , @JcMagpie

Another excellent addon, you are a genius! I try it and it works OK.
The only disadvantage is that it adds comments to the global site, so the comments are the same in each product.

Is it possible to change the data-href parameter to each product page so the customers can comment about each single product?

looking in the forum I found this code, but I think we have to adjust it ....

data-href="<?php echo urlencode(tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $HTTP_GET_VARS['products_id'], 'NONSSL', false)); ?>"

 

Opinions are heard.

Best regards

Valqui

 

 

:heart: Community Oscommerce fan :heart: You'll find the latest osC community version here.

 

Link to comment
Share on other sites

  • 4 weeks later...

change the FILENAME_PRODUCT_INFO to a hard coded 'product_info.php' change the $HTTP_GET_VARS to $_GET

No longer giving free advice. Please place deposit in meter slot provided.  Individual: [=] SME: [==] Corporation: [===]
If deposit does not fit one of the slots provided then you are asking too much! :P

Is your Osc dated try Phoenix  raising oscommerce from the ashes.

Link to comment
Share on other sites

12 hours ago, valquiria23 said:

Dear all, how are you?

Can someone help and say what changes should be made to the PHP code above so a single URL is formed per product info?

 

Best regards.

Valqui

Use dynamic URL instead. Can you try this and see if it works? I don thave facebook account so can not test.

<!-----------------------------------------------------put your own website in here----------------->
<div class="col-sm-<?php echo $content_width; ?> cm-pi-facebook_comments">
  <div class="fb-comments" data-href="<?php echo 'https://'. $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI']; ?>" data-width="400" data-numposts="5"></div>
 
    </div>
 

 

Link to comment
Share on other sites

Ok this is embarrassing apparently I do have a facebook account! Just tested and works comments only appear on page they are placed on. So use this to dynamicly get url.

<div class="fb-comments" data-href="<?php echo 'https://'. $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI']; ?>" data-width="400" data-numposts="5"></div>

 

:unsure: looks like I have had it for years and never known!

 

Link to comment
Share on other sites

Hello Zahid , I hope you are very well!

Yes. now I can leave different comments on each product !!!

But if in the first comment I get the error: "Object Missing a Required Value". Then I refresh the page and in the following comments the error does not appear.

How can this META can be added to the addon so that I can manage the comments?

<meta property = "fb: admins" content = "{YOUR_FACEBOOK_USER_ID}" />

Best regards

Valqui

:heart: Community Oscommerce fan :heart: You'll find the latest osC community version here.

 

Link to comment
Share on other sites

Try on my test website so I can see the problem you are having. https://tbyb.co.uk/product_info.php/matrox-g400-32mb-p-2

I am not seeing any errors, may just be a refresh issue with browser.

to add a admin just change  file to

<head>

<meta property="fb:admins" content="{YOUR_FACEBOOK_USER_ID}"/>

</head>

<!-----------------------------------------------------put your own website in here----------------->
<div class="col-sm-<?php echo $content_width; ?> cm-pi-facebook_comments">
  <div class="fb-comments" data-href="<?php echo 'https://'. $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI']; ?>" data-width="400" data-numposts="5"></div>
 
    </div>

 

Link to comment
Share on other sites

You should be able to manage comments on your website as default. You can make many changes so just amend the code as you like in

includes/modules/content/product_info/templates/tpl_cm_facebook_comments.php

info at https://developers.facebook.com/docs/plugins/comments/#moderation-setup-instructions

This was just a quick simple addon to give a basic addon. I'm sure it can be updated to have all variables changeable in admin but that's one for a commercial developer.

For me as I only need to set this up one time its just easy to update code in one file once.

 

image.png.186b118115987b6068c7fe4b54d50213.png

 

Link to comment
Share on other sites

12 hours ago, JcMagpie said:

Try on my test website so I can see the problem you are having. https://tbyb.co.uk/product_info.php/matrox-g400-32mb-p-2

I am not seeing any errors, may just be a refresh issue with browser.

to add a admin just change  file to

<head>


<meta property="fb:admins" content="{YOUR_FACEBOOK_USER_ID}"/>

</head>

<!-----------------------------------------------------put your own website in here----------------->
<div class="col-sm-<?php echo $content_width; ?> cm-pi-facebook_comments">
  <div class="fb-comments" data-href="<?php echo 'https://'. $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI']; ?>" data-width="400" data-numposts="5"></div>
 
    </div>

@JcMagpie

I had been using: data-href="<?php echo ($PHP_SELF); ?>"

Do you know what the technical differences or benefits would be to you suggestion of: data-href="<?php echo 'https://'. $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI']; ?>"

I am just asking as an inquire... Everything you said and explained worked great when I tested it!

Thank you... Great Add-On Sir!

Link to comment
Share on other sites

As always with PHP you can skin the cat many ways.

PHP_SELF is a variable that simply returns the current script being executed. However it has been deprecated and replaced by $_SERVER['PHP_SELF']

In my humble opinion this is a more robust way of doing this. It will give a full path to the page.

$_SERVER['SERVER_NAME'] is an array containing information such as headers, paths, and script locations. It replaces $HTTP_SERVER_VARS [now removed]

so it wil give you mywebsite.com or you could replace this with $_SERVER['HTTP_HOST'] which will give www.mywebsite.com

$_SERVER['REQUEST_URI'] will hold the full request path including the querystring.

So basically tells script exactly which page to add comment to.

So with both you get mywebsite.com/some-dir/yourpage.php?q=bogus&n=10

Nothing clever all from PHP manual

http://php.net/manual/en/reserved.variables.server.php


 

 

Link to comment
Share on other sites

18 hours ago, JcMagpie said:

As always with PHP you can skin the cat many ways.

PHP_SELF is a variable that simply returns the current script being executed. However it has been deprecated and replaced by $_SERVER['PHP_SELF']

In my humble opinion this is a more robust way of doing this. It will give a full path to the page.

$_SERVER['SERVER_NAME'] is an array containing information such as headers, paths, and script locations. It replaces $HTTP_SERVER_VARS [now removed]

so it wil give you mywebsite.com or you could replace this with $_SERVER['HTTP_HOST'] which will give www.mywebsite.com

$_SERVER['REQUEST_URI'] will hold the full request path including the querystring.

So basically tells script exactly which page to add comment to.

So with both you get mywebsite.com/some-dir/yourpage.php?q=bogus&n=10

Nothing clever all from PHP manual

http://php.net/manual/en/reserved.variables.server.php


 

Awesome Explaination @JcMagpie!!!

You The Man!!!

Link to comment
Share on other sites

Dear Zahid

I did not get a volunteer yet to test the addon. I will wait a few days and if I do not get one I will unfortunately have to create an account (something I do not want ...)

I'll notify you when I can. thanks for your constant support.

Best regards

Valqui

:heart: Community Oscommerce fan :heart: You'll find the latest osC community version here.

 

Link to comment
Share on other sites

  • 4 weeks later...
On 7/28/2018 at 8:37 PM, valquiria23 said:

Hi @Bobber

Could you setup and assign an administrator for comments? ¨

I can not get the "Moderation Tool" button to appear as it appears in the image below.

Any ideas?

Best regards

Valqui

facebook.thumb.png.bb6d8597aeab63c1755cb2afd48bde1f.png

Hi @valquiria23!

Yes I was able too and everything works perfectly for me...

You do need to be logged in with your facebook account and have your developer code in the module for it to work correctly...

Did you create a facebook developer account and create an app so you get the proper code to insert into this module yet?

Link to comment
Share on other sites

Hello @Bobber

I did not do any of that.

Just try with my normal facebook user number (I had to create an account). I do not create or use a developer or developer code account.

I will investigate how it is done and try again.

Thank you so much
Valqui

:heart: Community Oscommerce fan :heart: You'll find the latest osC community version here.

 

Link to comment
Share on other sites

53 minutes ago, valquiria23 said:

Hello @Bobber

I did not do any of that.

Just try with my normal facebook user number (I had to create an account). I do not create or use a developer or developer code account.

I will investigate how it is done and try again.

Thank you so much
Valqui

This should help @valquiria23:

https://developers.facebook.com/docs/plugins/comments/

https://developers.facebook.com/docs/apps/register/

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...