New Zenner
- Join Date:
- Mar 2012
- Posts:
- 1
- Plugin Contributions:
- 0
AutoFacebook [Support]
same problems... please somebody post a solution :(
Views: 140,955
New Zenner
same problems... please somebody post a solution :(
Zen Follower
Please try the following as your new facebook_authorization.php file and let me know how it goes. :)
<?php
/**
* facebook_authorization.php
*
* @Toni's AutoFacebook Fix
* @copyright Copyright 2003-2012 Zen Cart Development Team
* @copyright Portions Copyright Facebook
* @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
* @version $Id: facebook_authorization.php Toni Scraparoni 2012-03-30 $
*/
//edit with your info
$app_id = '1234567890987654321'; //given when you created app
$app_secret = 'abcdefghijklmnopqrstuvwxyz12345'; //given when you created app
$app_location = 'http://your-website.com/facebook/facebook_authorization.php'; //full url to location of this file
/////////////////////////////////////////////////////////////////////
// Don't Edit Below This Line
/////////////////////////////////////////////////////////////////////
// get app access token
$app_url = 'https://graph.facebook.com/oauth/access_token';
$params = array('grant_type' => 'client_credentials',
'client_id' => $app_id,
'client_secret' => $app_secret);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $app_url);
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $params);
$at_result = curl_exec($ch);
curl_close($ch);
$at_result = explode("=", $at_result);
$access_token = $at_result[1];
// get user access token
// removed offline access per FB note about deprecating this in May 2012
$scope = "read_stream,publish_stream,manage_pages";
if (!isset($_GET["code"])){
header("location: https://graph.facebook.com/oauth/authorize?client_id=".$app_id."&redirect_uri=".$app_location."&scope=".$scope);
}
elseif (!isset($_GET["access_token"])){
$code = $_GET["code"];
$url = "https://graph.facebook.com/oauth/access_token?client_id=".$app_id."&redirect_uri=".$app_location."&client_secret=".$app_secret."&code=".$code;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$ua_result = curl_exec($ch);
curl_close($ch);
$ua_result = explode("=", $ua_result);
$ua_token = $ua_result[1];
$append = '&expires';
$alength = strlen($append);
$apos = strrpos($ua_token, '&expires');
$replace = "";
$uaccess_token = substr_replace($ua_token, $replace, $apos, $alength);
}
// get page ID
$page_url = 'https://graph.facebook.com/me?access_token='.$uaccess_token;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $page_url);
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$page_result = curl_exec($ch);
curl_close($ch);
$page_result = explode('"', $page_result);
$page_id = $page_result[3];
echo "<h1 style='color: #009900'>Success!</h1><br /><br />
<span style='padding-right: 20px;'>Your Application access token is: </span>
<span style='color: #009900; font-weight: bold'>". $access_token."</span><br /><br /><br /><br />
<span style='padding-right: 20px;'>Your User access token is: </span>
<span style='color: #009900; font-weight: bold'>". $uaccess_token."</span><br /><br /><br /><br />
<span style='padding-right: 20px;'>Your Page ID is: </span>
<span style='color: #009900; font-weight: bold'>". $page_id."</span><br /><br /><br /><br /><br /><br />";
echo "You will only need two out of the three above: Page ID, and your choice of the Application access token <b><u>or</u></b> the User access token.<br /><br /><br />If I understood correctly, user access tokens will expire at some point, while application access does not. There seem to be other differences as well, so I thought it best to provide both and let you choose.<br /><br /><br />Copy and paste your code into the designated spots in admin/includes/modules/update_product.php.<br />
<br /><br />Remember to delete this file from your server when you are finished. You can always upload and run it again if you need to obtain the data or make any changes.<br /><br /><br />
<em>Note: if you see a period (or any other punctuation) at the end of your access tokens, please copy and paste that as well, as it is part of the token. If it's in green, it goes with you. :)</em>";
?>
New Zenner
caprimia:
Trying to install the Light version. Cannot get passed Please Select Page on the facebook storeupdater. I have a page created from my main account, but it can not see it. Even tried to create a new one just for the sake of it, and still, storeupdater will not see it..
!
I also have this problem and need a fix, if anyone can help it would be great.
Zen Follower
I've set up everything for the AutoFacebook and everything works fine, new products showing up on our store page and and all the people who like it see the new products too. BUT there is no share or reshare button for the product in either place. What's going wrong?
Zen Follower
Beau91324:
BUT there is no share or reshare button for the product in either place. What's going wrong?
Not that I use this version of the Auto Facebook mod as I use another version but I am sure this mod does not incorporate the share buttons on your product pages. You need to use a separate mod to accomplish this.
Now you can use this mod here:
http://www.zen-cart.com/index.php?main_page=product_contrib_info&products_id=2026
But if you don't use meta tags in your descriptions then your cache folder is going to fill up with error logs pretty fast as there is a bug with the Facebook part of that module.
So to over come that issue I basically removed all references of the Facebook module from that mod and then used the following code in my tpl_product_info_display.php where I wanted the Facebook button to appear. Or you can just use the following code on it's own if you don't want to add the Google +1 and Twitter modules to your product pages.
<!-- bof Facebook like button to render -->
<iframe src="http://www.facebook.com/plugins/like.php?href=<?php echo urlencode(zen_href_link(zen_get_info_page((int)$_GET['products_id']),'cPath='.(int)$_GET['cPath'].'&products_id=' . (int)$_GET['products_id'])); ?>&layout=standard&show_faces=true&width=450&action=like&colorscheme=light" scrolling="no" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden; width:550px; height:85px;"></iframe>
<!-- eof Facebook like button to render -->
Zen Follower
I finally got this mod working, but it posted to my personal page, not my shop page! I have 4 fan pages, and I tried to follow the instructions at http://www.zen-cart.com/showthread.php?153528-AutoFacebook-Support/page2&p=934180#post934180 but I can't figure out what the url is that I'm supposed to put in at uri=URL ...nothing I've tried works. Help?
I can't just go to my fan page and look at the number, because I named my fan page and so the number no longer shows up. The fan page is just http://www.facebook.com/OpalEssenceShop
Help?
Btw, I moved the AutoTweet3 to the bottom of the page so it shows up when I modify products... but I can't move the FB stuff there without getting errors. Help? And I want to put in those on/off checkboxes... but when I tried that I got errors, too...
New Zenner
Everything worked fine for me, Autofacebook & Autotwitter until i JUST upgraded to v1.5 Zencart via Fantastico which was a stupid move. Now I have to go back, find everything and put everything in. I hope my backups have everything.
New Zenner
Okay - Everything works perfectly fine for me. I just need to find a way so that I can edit my fb post to include a "Share" link where it has ""Like" and "Comment"
Totally Zenned
Hi all - I am using v1.3.9h and am having the same problems as a few other recent posters in that I am gettiing a fatal error returned from facebook. Because it states it cannot validate the SSL certificate I had my host check it out as I had concerns about the effectiveness of my SSL cert. They responded with a link below for a site which addresses this problem.
ERROR FROM FACEBOOK
Notice: Undefined offset: 1 in E:\inetpub\vs144057\facebook_authorization.php on line 956
Fatal error: Uncaught CurlException: 60: SSL certificate problem, verify that the CA cert is OK. Details: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed thrown in (data base address)
LINK = http://net.tutsplus.com/tutorials/php/how-to-authenticate-your-users-with-facebook-connect/
I do not know enough about this stuff to want to meddle with it but I am looking for someone in here to come up with a fix that works for Zencart ... PLEASE :)
I wasn't willing to try the new php code in post on previous page accompanied by comment "give it a try and see what you think" ??
cheers,
Mike
New Zenner
vescera:
Everything was working till today. I try to get new token but I get this code. Try every sugestion from thread for this error but no luck. Any help, thanx.
Notice: Undefined offset: 1 in /htdocs/facebook_authorization.php on line 956
Fatal error: Uncaught CurlException: 28: connect() timed out! thrown in /htdocs/facebook_authorization.php on line 599
Hi,
I decided to use the built in Zen Cart function for displaying the price:
$price = zen_get_products_display_price((int)$products_id);
Hope this helps.
Zen Follower
ToniScraparoni:
Please try the following as your new facebook_authorization.php file and let me know how it goes. :)
You are a star. Thanks
Totally Zenned
BillyBoyle:
You are a star. Thanks
Did that new facebook_authorization.php file work ?????????????
I am really interested to know.
cheers,
Mike
Zen Follower
shags38:
Did that new facebook_authorization.php file work ?????????????
I am really interested to know.
cheers,
Mike
Worked like a charm, I would recommend anyone needing to renew the token use this change. Actually I was building a new sites and had to use to get the authorisation from the start. So yes a necessary change to the installation of auto Facebook add on.
Totally Zenned
v 1.3.9h
Hi all - any ideas on what may be causing this when I try to authorize Facebook?
Fatal error: Uncaught OAuthException: Malformed access token AAAGvh4VXG8IBAPNX4I1ZAfRzRXiL6iZAun8reCvXDwocr8uOonobnpEYHDCwYyKOqCGAyxSnsvGsN1irToJ93nuVVlRCPYWdLSZAWB3wQZDZD&expires thrown in /home/jeweller/public_html/facebook/facebook_authorization.php on line 532
I am using the modified php file by ToniScraparoni (on page 47) - kinda frustrating not being able to get this mod working :(
Any help will be much appreciated.
cheers,
Mike
*** maybe this could be the culprit?? "The Site URL is simply your store's web address followed by a '/' forward slash"
Totally Zenned
*** maybe this could be the culprit?? "The Site URL is simply your store's web address followed by a '/' forward slash"
Last edited by shags38; 16 Jul 2012 at 11:01 PM.
Nope - wasn't that :frusty:
Totally Zenned
Found the problem !!! App went through OK.
For what it is worth for future users - I found that the App ID and APP Secret lines of the Facebook_Autorization.php file has double quote marks (") inside the single (') quote marks where you enter the data so that it becomes '"xxxxxxxxxx"' instead of 'xxxxxxxx' - removing the double quote marks solves the problem.:D
Also reading the instructions carefully helps = url with "/" after it :)
BUT !!!! I loaded a new product to the site and it isn't showing up on the Facebook page :dontgetit .... What could be the issue now ??
cheers,
Mike
Zen Follower
WHOSYOURDADDY:
IMPORTANT UPDATE FOR THOSE WHO MANAGE SEVERAL FACEBOOK PAGES
Like most I have been scratching my head on how to get this app from Jamielife (Thanks Jamielife:cool:) to post new products in our zen cart to the proper Fan Page/Business Page.
Each fan page has its own page id and access token. The easy part was getting the page ID the hard part was figuring out how to get the the access token for the specific page.
After you have gone through the initial steps outlined by Jamielife to get the app authorized the next steps will allow you to have this app post to the page of your choosing.
Here is the solution.:
- Run this link in your Browser. Please replace
URLwith your connect URL (Facebook Application dialog) andAPPIDwith your application IDYou will need to add https// to the following links
If done correctly you get your zen cart with the URL Parameter Access Token
This URL will return to you a URL parameter access_token.
Save the token somewhere;
Load This URL. Replace
TOKENwith the token received from Facebook at point 2.As a result you will get the json with all your pages and all access tokens. Save them somewhere;
Once you have this data it is simple going into the update_product.php at lines 88-92 and change them according to the information associated with the specific page that you want to mod to post to.
Test to make sure it works
I have tested it on 1.3.9f with the latest version of Jamielife's mod with success :clap:
Good Luck
i cannot get the link mentioned in 1 right. this is what i put:https://graph.facebook.com/oauth/authorize?type=user_agent&client_id=310583505703490&redirect_uri=www.best4future.com/&scope=publish_str eam,offline_access,manage_pages
but i got http 400 error. where i did wrong?
is connect URL going like https://www.best4future.com?
Totally Zenned
scottrdj:
I am getting this error as well
Fatal error: Uncaught OAuthException: Error validating application. thrown in /home/djdepot/public_html/facebook/facebook_authorization.php on line 532
I posted this yesterday - it may help. I had the same frustrating problem.
cheers,
Mike
Found the problem !!! App went through OK.
For what it is worth for future users - I found that the App ID and APP Secret lines of the Facebook_Autorization.php file has double quote marks (") inside the single (') quote marks where you enter the data so that it becomes '"xxxxxxxxxx"' instead of 'xxxxxxxx' - removing the double quote marks solves the problem.
Also reading the instructions carefully helps = url with "/" after it :)
BUT !!!! I loaded a new product to the site and it isn't showing up on the Facebook page .... What could be the issue now ??
cheers,
Mike
Totally Zenned
Is anyone managing the support for this mod? - how can I get some assistance? - see previous posts. I have authorization but new products are not updating in facebook - where are they supposed to go to? Confused and frustrated.
many thanks,
Mike
Zen Follower
lina0962:
i cannot get the link mentioned in 1 right. this is what i put:https://graph.facebook.com/oauth/authorize?type=user_agent&client_id=310583505703490&redirect_uri=www.best4future.com/&scope=publish_str eam,offline_access,manage_pages
but i got http 400 error. where i did wrong?
is connect URL going like https://www.best4future.com?
graph.facebook.com/oauth/authorize?type=user_agent&client_id=APPID&redirect_uri=URL&scope=publish_str eam,offline_access,manage_pages
Is it right to have "," instead of "."?
Can anybody be kind to tell me how to replace URL with your connect URL (Facebook Application dialog)? Please give me an example!!
Fields marked required must be completed.
Tell staff why this post should be reviewed.
Required for login, security, and core site functionality.
Help us understand how the site is used so we can improve it.
Used for promotion and personalized campaign measurement.