Jump to content
Sign in to follow this  
puggybelle

Social Bookmarks code for Facebook Like not working

Recommended Posts

2.3.4.1 CE and PHP 7.0 here

Playing with the different options to set up links in the Social Bookmarks module in Admin.

Installing Facebook Like results in a large chunk of white space appearing in the infobox. 

The code in catalog/includes/modules/social_bookmarks/sb_facebook_like.php looks like this:

return '<iframe src="//www.facebook.com/plugins/like.php?href=' . urlencode(tep_href_link('product_info.php', 'products_id=' . $_GET['products_id'], 'NONSSL', false)) . '&amp;layout=' . $style . '&amp;show_faces=' . $faces . '&amp;width=' . $width . '&amp;action=' . $action . '&amp;colorscheme=' . $scheme . '&amp;height=35" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:' . $width . 'px; height:35px;" allowTransparency="true"></iframe>';

The url that the code is trying to connect to is:  www.facebook.com/plugins/like.php

Going to that manually results in a white screen.  I suppose that url is no longer valid for Facebook.  ???

Anyone know what the replacement would be? 

- Andrea

Share this post


Link to post
Share on other sites

Hello @ArtcoInc

I looked at that page prior to posting.  First step is:

1. Choose URL or Page

 

Pick the URL of a website or Facebook Page you want to use with the like button.

--------------------------

I don't understand how to create a button for over 6,000 items. 

What would my URL be to create the button?  https://www.mysite.com/????????????????

- Andrea

Share this post


Link to post
Share on other sites
8 minutes ago, puggybelle said:

I don't understand how to create a button for over 6,000 items. 

For that you need to add a product_info button then you will have a link to each product url. have a looks at this product info page.

https://chilleddisplays.co.uk/product_info.php/products_id/42

done with this, I.m sure other are available.

https://apps.oscommerce.com/ZxuJW&jcm-product-info-share-or-contact-v1-3


 

Share this post


Link to post
Share on other sites

Hi @JcMagpie

I guess I should ask:  what's the difference between the Facebook link that does work and the Facebook Like that doesn't work?

I don't care to put buttons here, there and everywhere.  I just wanted to add Facebook Like to my 'Share Product' infobox and be done with it.

- Andrea

 

Share this post


Link to post
Share on other sites
12 minutes ago, puggybelle said:

I just wanted to add Facebook Like to my 'Share Product' infobox and be done with it

I don't know what that is? if it's just a box then unless you have some method of it knowing what product page the customer is on it can not send product info link. It will just be a facebook link.

Remember you don't need to use all the buttons you can just have the facebook one on it's own.

Edited by JcMagpie

 

Share this post


Link to post
Share on other sites

Sorry we are talking about diferent things. You already have a facebook button in your box and it is linked to the product page. You should be able to simple add another button to that fro the like button. Simply use the same code that links the first button to the product page in the place of the URL link part of the like button.

replace "https://developers.facebook.com/docs/plugins/"        

with your own code for each product page.

<div class="fb-like" data-href="https://developers.facebook.com/docs/plugins/" data-width="30" data-layout="standard" data-action="like" data-size="small" data-show-faces="true" data-share="true"></div>

 

Edited by JcMagpie

 

Share this post


Link to post
Share on other sites

There seems to be trouble with the Google mods, too.  Apparently, Google abandoned ship on those.

social.JPG.127f21790762c2b46555c21f4058f517.JPG

I see that Phoenix does not come with those two.  However, the Facebook Like is still in Phoenix.  I'm using Edge, I think.

That's why I thought maybe someone had a fix for that, a replacement url for the code.

I'll give it a play and see what I can come up with.

- Andrea

Share this post


Link to post
Share on other sites

I traded out urls and still just end up with a chunk of white space where the Facebook Like button should be. 

Think I'll probably just let that one go...or check back to see if anyone has come up with a remedy.  Thanks!

- Andrea

Share this post


Link to post
Share on other sites

Without turning on Facebook Like, my box looks like this:

beforelike.JPG.3ff4632bb9f85e6cb5be20a71d21f10d.JPG

After turning on Facebook Like, I get a chunk of white space where the like button should be appearing.

afterlike.JPG.39f2326bc095a64a1012cb7a781ab3b4.JPG

See my problem?

- Andrea

Share this post


Link to post
Share on other sites

Yes i see but that's down to the local setup the default stock works fine. Check your html output in browser and any erros as it must have a conflict stopping it from showing.


 

Share this post


Link to post
Share on other sites
2 minutes ago, JcMagpie said:

Have you made any changes to the class files?

I have no idea.  Maybe?  Maybe not?  I do like to hack things up a bit to get what I want.  :)

The error logs are empty.  When I view the page source, the code for Facebook Like is showing just fine.  Just not inside my box!

- Andrea

Share this post


Link to post
Share on other sites

In public_html/includes/modules/social_bookmarks/sb_facebook_like.php

line 39 should be like this,

return '<iframe src="//www.facebook.com/plugins/like.php?href=' . urlencode(tep_href_link('product_info.php', 'products_id=' . $_GET['products_id'], 'NONSSL', false)) . '&amp;layout=' . $style . '&amp;show_faces=' . $faces . '&amp;width=' . $width . '&amp;action=' . $action . '&amp;colorscheme=' . $scheme . '&amp;height=35" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:' . $width . 'px; height:35px;" allowTransparency="true"></iframe>';
     

 


 

Share this post


Link to post
Share on other sites

I removed the http: from the beginning of the url and now it shows.  Yay!

When I click it, is it supposed to disappear?  Or is it supposed to take me somewhere? 

The other social links open a new browser window.

I'm not sure if it's really fixed or not - hope I'm making sense.

- Andrea

Share this post


Link to post
Share on other sites

Ignore my last post.  I ended up copying and pasting the entire line you gave me and now it's working fine.  Layout is screwy, but I'll play with that.

The original file has that URL beginning with http: - interesting how that had to be stripped out in order to make it work.

Thanks so much, Zahid!  You're wonderful!

- Andrea

Share this post


Link to post
Share on other sites

Not sure what the problem is with the layout of this box but got it to behave by making a small change. Changed the code to

<div class="card-body float-left">   for the box and then deleted all the buttons and installed them again one at a time and changed  facebook like button width to 60px. Look's ok now? well sort of.

 

image.png.861cbfaedc5377c375241c80a2072e92.png

image.thumb.png.d658c38b8b5ce9b6cf06f844ff22cfe4.png


 

Share this post


Link to post
Share on other sites

Looks nice, but still have an issue.

For what it's worth, thought I'd mention that the http: I had to strip out of the url must have been because my whole website is in SSL mode, so...I put it back as https: and the button appears just fine. 

I'd appreciate it, @JcMagpie, if you would go to my test site and view a product and click on the Like button.  I've turned it off in my live site for now.

When I click on it...it vanishes.  Just disappears from the box.  Only if I click around and go back to the item and try again does it work, with the thumbs up appearing.  Very strange.  I have no idea how to troubleshoot such a thing.  The error logs are empty. 

Once you click Like and get a thumbs up, you can then do it all over the website without a problem.  It's just that first click when entering the store that makes it literally vanish from the box.  Very weird.

Share this post


Link to post
Share on other sites

Looks to be working fine for me? tested on chrome and firefox and work on both. I have seen issues like this before, browsers are now very strict about none SSL links if a button or link or image points to a none SSL link then the will not show that button , image or link.  It may have been that the product page you tested had a none SSL link? not sure but it worked fine on all the products I tested.


 

Share this post


Link to post
Share on other sites

Thanks for looking.  I don't know how to explain it...it's just behaving oddly for me.

Thing I'm noticing, too....when I first enter the site, view a product and run my mouse over the Like button....the alt text that appears simply says Like.

Click on a few pages, next thing you know...I run my mouse over the button and it now says...Like Name Of Product | Name Of Website

I don't know.  Something very buggy is going on...for me, anyway!

Share this post


Link to post
Share on other sites

Cleared the cache, history, everything.  Still happening.

If you would please...go to the test site and click on Cheap Test Product on the far right, top row under New Products For September.

Run your mouse over the Like button...I think the alt text will display as Like Cheap Test Product | My Store Name

Now...go back to the homepage and click on the item immediately to its left.

The alt text for that one is showing only....Like.  No product name - no store name.

It's random.  Some will show it, some won't.  Makes no sense.

Are you able to duplicate that? 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×