Zen Cart Logo
Forums / All Other Contributions/Addons / Facebook Like Button

Facebook Like Button

Views: 52,534

Results 321 to 340 of 347
4 Oct 2012, 4:29 PM
#321
delia avatar

delia

Totally Zenned

Join Date:
May 2006
Location:
Gardiner, Maine
Posts:
2,383
Plugin Contributions:
7

Facebook Like Button

If you are trying to do a facebook like on any other pages besides the product page, that is what happens. The mod is set only for the product pages.

4 Oct 2012, 4:34 PM
#322
serious avatar

serious

Totally Zenned

Join Date:
Feb 2011
Posts:
686
Plugin Contributions:
0

Re: Facebook Like Button

No, I installed it exactly per the instructions.
Not trying to customize or do anything unusual at all.

The "Like" button and text appear on the product pages only.

4 Oct 2012, 4:37 PM
#323
delia avatar

delia

Totally Zenned

Join Date:
May 2006
Location:
Gardiner, Maine
Posts:
2,383
Plugin Contributions:
7

Re: Facebook Like Button

You sure you have replaced / merged the modules/metatags.php and the templates/common/tpl_html_header.php. Both go into your override template folders so be sure you have not just uploaded the folder in the package which of course is not named correctly.

4 Oct 2012, 5:01 PM
#324
serious avatar

serious

Totally Zenned

Join Date:
Feb 2011
Posts:
686
Plugin Contributions:
0

Re: Facebook Like Button

I just downloaded a copy of* includes/modules/CUSTOM/meta_tags.php* and compared it with the same file in the add-on using WinMerge. No differences at all.

templates/common/tpl_html_header.php....?
I do not have this file, searched all files.

I do have:
includes/templates/CUSTOM/common/html_header.php
includes/templates/CUSTOM/common/tpl_header.php

5 Oct 2012, 2:34 AM
#325
darkangel avatar

darkangel

Totally Zenned

Join Date:
Oct 2007
Location:
Emporia, Kansas
Posts:
1,729
Plugin Contributions:
0

Re: Facebook Like Button

@ serious

I just used the dark --- actually it was to show on dark backgrounds is what I used...that just lets the link show up in the stores link color of choice

you are right there is no tpl_html_header.php, it was a mistyped thing...you have the two correct files.

5 Oct 2012, 12:01 PM
#326
delia avatar

delia

Totally Zenned

Join Date:
May 2006
Location:
Gardiner, Maine
Posts:
2,383
Plugin Contributions:
7

Re: Facebook Like Button

Still ugly! Thanks DarkAngel

5 Oct 2012, 1:09 PM
#327
darkangel avatar

darkangel

Totally Zenned

Join Date:
Oct 2007
Location:
Emporia, Kansas
Posts:
1,729
Plugin Contributions:
0

Re: Facebook Like Button

ok, I have some code that trust me I have no idea where it came from but...I remember once I was having an issue with FB changing their button and not liking the share/like thumbs up button...soooooo

this is the code I have for my link...which is worded a little different with my own FB button I did like...lol In red is where I added the color for the font of the text and the text I decided on...it changes the text of the wording to your choice, regardless of what your links are set to be for your store.

in the tpl_product_info_display.php I placed mine here so look for the first line in your file if you want it in the same place...go to my store to see where it is and what it looks like---my live store is not with colored text, otherwise put it where you want your link to appear. I also added the breaks to give it some space below and above it.

------------------------------beginning of code-----------------------------------

<!--eof Product Price block -->

<br><br>

<script>function fbs_click() {u=location.href;t=document.title;window.open('http://www.facebook.com/sharer.php?u='+encodeURIComponent(u)+'&t='+encodeURIComponent(t),'sharer','toolbar=0,status=0,width=626,height=436');return false;}</script><style> html .fb_share_link { padding:2px 0 0 20px; height:32px;) no-repeat top left; }</style><a href="http://www.facebook.com/share.php?u=<?php echo "http://" . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'] . "?" . $_SERVER['QUERY_STRING'];?>" onclick="return fbs_click()" target="_blank" class="fb_share_link"><img src=http://fantasiesrealm.com/images/facebook.gif width=25>**<font size=+2 color=#cc0000>**  Share on FaceBook:  <strong><?php echo $products_name; ?></strong></a></font><br><br><br><br>

------------------------------end of code------------------------------------

hope it helps

15 Oct 2012, 2:24 PM
#328
delia avatar

delia

Totally Zenned

Join Date:
May 2006
Location:
Gardiner, Maine
Posts:
2,383
Plugin Contributions:
7

Re: Facebook Like Button

I just confirmed that the like button in one of my original installations is showing META_TAG_TITLE instead of product title. I have no earthly idea how this has happened because this part is not Facebook but zen cart coding which has not changed. This is on a 1.3.9h cart by the way. Any of you using the original mod with no changes, please check to see if it is happening in your carts as well.

15 Oct 2012, 2:28 PM
#329
delia avatar

delia

Totally Zenned

Join Date:
May 2006
Location:
Gardiner, Maine
Posts:
2,383
Plugin Contributions:
7

Re: Facebook Like Button

I'll bet you that it depends on the version of php you are using. I'm now on 5.3 so if you have a problem and it's on 5.3, please let me know.

15 Oct 2012, 8:58 PM
#330
darkangel avatar

darkangel

Totally Zenned

Join Date:
Oct 2007
Location:
Emporia, Kansas
Posts:
1,729
Plugin Contributions:
0

Re: Facebook Like Button

delia:

I just confirmed that the like button in one of my original installations is showing META_TAG_TITLE instead of product title. I have no earthly idea how this has happened because this part is not Facebook but zen cart coding which has not changed. This is on a 1.3.9h cart by the way. Any of you using the original mod with no changes, please check to see if it is happening in your carts as well.

well my test 1.5 store got deleted from the server but the one on my computer disappeared...lol

but

1.3.9h cart:

<title><?php echo META_TAG_TITLE; ?></title> <meta property="og:title" content="<?php echo META_TAG_FBTITLE; ?>"/> <meta property="og:title" content="<?php echo META_TAG_TITLE; ?>"/> <meta property="og:site_name" content="<?php echo TITLE; ?>"/> <meta property="og:image" content="<?php echo META_TAG_FBIMG; ?>"/> <meta property="og:url" content="<?php echo $canonicalLink; ?>"/> <meta property="og:type" content="product"/> <meta property="fb:admins" content="my info"/>

That is how mine is written and I have no problems with facebook button what so ever....save the button change to my liking.

13 Nov 2012, 3:44 PM
#331
doooomed avatar

doooomed

Zen Follower

Join Date:
Jun 2009
Posts:
275
Plugin Contributions:
0

Re: Facebook Like Button

Hello,

(using 1.5) I have been searching around but I can't seem to find a complete answer (at least not one that I understand) so if this is posted/answered elsewhere, apologies.

I have this installed, and seems to work fine with the exception that I do not get pictures on my FB page after liking a product, just a link to the product page, nothing else. Any help would be great!

13 Nov 2012, 9:25 PM
#332
darkangel avatar

darkangel

Totally Zenned

Join Date:
Oct 2007
Location:
Emporia, Kansas
Posts:
1,729
Plugin Contributions:
0

Re: Facebook Like Button

doooomed:

Hello,

(using 1.5) I have been searching around but I can't seem to find a complete answer (at least not one that I understand) so if this is posted/answered elsewhere, apologies.

I have this installed, and seems to work fine with the exception that I do not get pictures on my FB page after liking a product, just a link to the product page, nothing else. Any help would be great!

A link to your store would help a lot and save guess work

Did you do these edits:

  1. tpl_product_info.php

look afor this at the top of the page:

//require(DIR_WS_MODULES . '/debug_blocks/product_info_prices.php');
?>

<div class="centerColumn" id="productGeneral">

Add this code after it

<!-- bof Facebook Like Button -->
<div id="likeButton"><fb:like></fb:like></div>

<div id="fb-root"></div>
<script>
  window.fbAsyncInit = function() {
    FB.init({appId: '**your application id**', status: true, cookie: true,
             xfbml: true});
    FB.Event.subscribe('edge.create', function(href, widget) {

// Do something, e.g. track the click on the "Like" button here
});
};
(function() {
var e = document.createElement('script');
e.type = 'text/javascript';
e.src = document.location.protocol +
'//connect.facebook.net/en_US/all.js';
e.async = true;
document.getElementById('fb-root').appendChild(e);
}());
</script>

<!-- eof Facebook Like Button -->

after

<div class="centerColumn" id="productGeneral"> at the top of the file
  1. html_header.php
    Change the second line of the file to: <html xmlns="http://www.w3.org/1999/xhtml" <?php echo HTML_PARAMS; ?>> to
<html xmlns="http://www.w3.org/1999/xhtml" <?php echo HTML_PARAMS; ?> xmlns:fb="http://www.facebook.com/2008/fbml">

Add this code
<meta property="og:title" content="<?php echo META_TAG_FBTITLE; ?>"/>
<meta property="og:site_name" content="<?php echo TITLE; ?>"/>
<meta property="og:image" content="<?php echo META_TAG_FBIMG; ?>"/>
<meta property="og:url" content="<?php echo $canonicalLink; ?>"/>
<meta property="fb:admins" content="**your_application_id or facebook admins**"/>
<meta property="og:type" content="product"/>

anywhere before the </html> tag.

******* **this is how mine looks:<meta property="og:title" content="<?php echo META_TAG_FBTITLE; ?>"/>
<meta property="og:title" content="<?php echo META_TAG_TITLE; ?>"/>
<meta property="og:site_name" content="<?php echo TITLE; ?>"/>
<meta property="og:image" content="<?php echo META_TAG_FBIMG; ?>"/>
<meta property="og:url" content="<?php echo $canonicalLink; ?>"/>
<meta property="og:type" content="product"/>
<meta property="fb:admins" content="app_id_here"/> *****

  1. metatags.php
    Replace this code (line 210 in 1.3.8)
    $sql= "select pd.products_name, p.products_model, p.products_price_sorter, p.products_tax_class_id,
    p.metatags_title_status, p.metatags_products_name_status, p.metatags_model_status,
    p.products_id, p.metatags_price_status, p.metatags_title_tagline_status,
    pd.products_description, p.product_is_free, p.product_is_call,
    mtpd.metatags_title, mtpd.metatags_keywords, mtpd.metatags_description

with this

$sql= "select pd.products_name, p.products_model, p.products_price_sorter, p.products_tax_class_id, p.products_image,
p.metatags_title_status, p.metatags_products_name_status, p.metatags_model_status,
p.products_id, p.metatags_price_status, p.metatags_title_tagline_status,
pd.products_description, p.product_is_free, p.product_is_call,
mtpd.metatags_title, mtpd.metatags_keywords, mtpd.metatags_description

  1. metatags.php
    Add this code (line 293 in 1.3.8):

    //bof facebook like button
    if($product_info_metatags->fields['products_image']!='') {
    $FBimgURL = (($request_type == 'SSL') ? HTTPS_SERVER . DIR_WS_HTTPS_CATALOG : HTTP_SERVER . DIR_WS_CATALOG ) . DIR_WS_IMAGES . $product_info_metatags->fields['products_image'];
    define('META_TAG_FBIMG', $FBimgURL);
    } else {
    define('META_TAG_FBIMG', '');
    }
    define('META_TAG_FBTITLE', str_replace('"','',zen_clean_html($product_info_metatags->fields['products_name'])));
    //eof facebook like button

between this

} // CUSTOM META TAGS

and this

} // EOF
break;

also I have this code added and am able to have image go up when link is clicked too:

place it in tpl_product_info_display.php also which I put after <!--eof Product Price block -->

<script>function fbs_click() {u=location.href;t=document.title;window.open('http://www.facebook.com/sharer.php?u='+encodeURIComponent(u)+'&t='+encodeURIComponent(t),'sharer','toolbar=0,status=0,width=626,height=436');return false;}</script><style> html .fb_share_link { padding:2px 0 0 20px; height:32px;) no-repeat top left; }</style><a href="http://www.facebook.com/share.php?u=<?php echo "http://" . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'] . "?" . $_SERVER['QUERY_STRING'];?>" onclick="return fbs_click()" target="_blank" class="fb_share_link"><img src=http://fantasiesrealm.com/images/facebook.gif width=25><font size=+2>  Share on FaceBook:  <strong><?php echo $products_name; ?></strong></a></font><br/><br/><br/><br/>

all the <br/> are there by me fo spacing on my template you can go to my store to look where I have my FB link at in product pages...so those can be removed.

hope this helps

14 Nov 2012, 12:56 PM
#333
delia avatar

delia

Totally Zenned

Join Date:
May 2006
Location:
Gardiner, Maine
Posts:
2,383
Plugin Contributions:
7

Re: Facebook Like Button

That metatags stuff in the html_header is where it makes sure the product image is being pulled. So that and the metatags.php file are the 2 important things there.

14 Nov 2012, 8:33 PM
#334
doooomed avatar

doooomed

Zen Follower

Join Date:
Jun 2009
Posts:
275
Plugin Contributions:
0

Re: Facebook Like Button

Hi Delia,

I forgot to mention that I am only using "product music" so I am editing tpl_product_music_info_display.php instead of tpl_product_info_display.php

Would I need to alter any of the other files to reflect this? I ask because I've gone through this three times and still not working!

14 Nov 2012, 8:57 PM
#335
delia avatar

delia

Totally Zenned

Join Date:
May 2006
Location:
Gardiner, Maine
Posts:
2,383
Plugin Contributions:
7

Re: Facebook Like Button

No, shouldn't make a difference. I'm seeing some oddities here and there though. Why don't you pm me - or post a url if you want. Sometimes I find that it works for others when it doesn't work for your self. After all it is Facebook we are talking about and those folks love playing with their code and making changes. (Really, I heard a Facebook employee speak about this at a conference last Feb).

4 Dec 2012, 6:12 AM
#336
darkangel avatar

darkangel

Totally Zenned

Join Date:
Oct 2007
Location:
Emporia, Kansas
Posts:
1,729
Plugin Contributions:
0

Re: Facebook Like Button

Not sure if this is a bug that attacked my FB button mod but......here is my query this time.

I swear that at one time no matter where I used the FB button (at store and have a mod for smf in forum too) but I used to submit link (or click like button) and it would go straight to my page on FB. It would show what I was posting and I could edit it to the way I wished A N D I could choose which image to use from an array of them (the little arrows that the box has)....not anymore

Now when I post a link everything works as it should but I am only left with the primary image, no longer does it show all images available.

Ideas on what may be the problem?

4 Dec 2012, 7:19 AM
#337
volkeram avatar

volkeram

New Zenner

Join Date:
Dec 2012
Location:
960 MARKHAM ROAD, APPT # 1101, SCARBOROUGH, ON. M1H 2Y4 Canada
Posts:
5
Plugin Contributions:
0

Re: Facebook Like Button

I would like to add my own image in place of the standard Facebook image to link to my page there. I'm having difficulties getting it done though. Can anybody help me?

4 Dec 2012, 9:12 AM
#338
darkangel avatar

darkangel

Totally Zenned

Join Date:
Oct 2007
Location:
Emporia, Kansas
Posts:
1,729
Plugin Contributions:
0

Re: Facebook Like Button

volkeram:

I would like to add my own image in place of the standard Facebook image to link to my page there. I'm having difficulties getting it done though. Can anybody help me?

do you mean where your FB link in product page is, you have a small image to use instead of that thumb?

I have this code added red for the image and purple for how I changed the wording:

place it in tpl_product_info_display.php also which I put after <!--eof Product Price block -->

<script>function fbs_click() {u=location.href;t=document.title;window.open('http://www.facebook.com/sharer.php?u='+encodeURIComponent(u)+'&t='+encodeURIComponent(t),'sharer','toolb ar=0,status=0,width=626,height=436');return false;}</script><style> html .fb_share_link { padding:2px 0 0 20px; height:32px;) no-repeat top left; }</style><a href="http://www.facebook.com/share.php?u=<?php echo "http://" . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'] . "?" . $_SERVER['QUERY_STRING'];?>" onclick="return fbs_click()" target="_blank" class="fb_share_link"><img src=http://fantasiesrealm.com/images/facebook.gif width=25><font size=+2>  Share on FaceBook:  <strong><?php echo $products_name; ?></strong></a></font><br/><br/><br/><br/>

all the <br/> are there by me fo spacing on my template you can go to my store to look where I have my FB link at in product pages...so those can be removed.

hope this helps

4 Dec 2012, 1:00 PM
#339
delia avatar

delia

Totally Zenned

Join Date:
May 2006
Location:
Gardiner, Maine
Posts:
2,383
Plugin Contributions:
7

Re: Facebook Like Button

DarkAngel:

Not sure if this is a bug that attacked my FB button mod but......here is my query this time.

I swear that at one time no matter where I used the FB button (at store and have a mod for smf in forum too) but I used to submit link (or click like button) and it would go straight to my page on FB. It would show what I was posting and I could edit it to the way I wished A N D I could choose which image to use from an array of them (the little arrows that the box has)....not anymore

Now when I post a link everything works as it should but I am only left with the primary image, no longer does it show all images available.

Ideas on what may be the problem?

I've not seen that but I only use it on the product page. When I didn't have the metatags in there that designated the product image, I didn't see a choice. But I have to say - this would be a facebook thing and have nothing to do with the mod itself.

4 Dec 2012, 10:13 PM
#340
darkangel avatar

darkangel

Totally Zenned

Join Date:
Oct 2007
Location:
Emporia, Kansas
Posts:
1,729
Plugin Contributions:
0

Re: Facebook Like Button

delia:

I've not seen that but I only use it on the product page. When I didn't have the metatags in there that designated the product image, I didn't see a choice. But I have to say - this would be a facebook thing and have nothing to do with the mod itself.

I thought so too but just asked for ya never know.

The store mod you created is grand and I loves, loves, loves it. I added my own button cause I can't stand that thumb and reworded the link to show my way...lol

The promo used in FB is the main product image and does not let us choose from the additional images but tis fine.

The other one that does pull every single image on the page (not just the post) is in our forum. Not sure how he wrote that mod to pull any image but at times that is helpful to use.

Thanks and have a Happy Yule.