Jump to content


Corporate Sponsors


Latest News: (loading..)

- - - - -

Facebook Connect Support Thread


176 replies to this topic

#161 juanmasi1

  • Community Member
  • 14 posts
  • Real Name:Ariel

Posted 30 December 2011, 08:52

View Postgjferrando, on 29 December 2011, 13:30, said:


Si, me pasaba lo mismo con Internet Explorer y Mozilla Firefox por eso le agregué el setTimeout('document.location.href = "create_account.php"', 0);

Cuál navegador usas..?
Justo habia probado con estos dos, Mozilla Firefox y Exlorer, y con Chrome pasa algo raro me lleva a logoff, ahora esta linea va en create account y login ? setTimeout('document.location.href = "create_account.php"', 0); igualmente voy a probar no es el drama esto, y te cuento si me encuentro con algun problema, pero te recomiendo una vez probado subirlo a las contribuciones de oscomerce, sería de gran utilidad para la comunidad...un abrazo y gracias por tu tiempo [img]http://forums.oscommerce.com//public/style_emoticons/default/thumbsup.gif[/img]

#162 juanmasi1

  • Community Member
  • 14 posts
  • Real Name:Ariel

Posted 30 December 2011, 09:46

View Postjuanmasi1, on 30 December 2011, 08:52, said:

Justo habia probado con estos dos, Mozilla Firefox y Exlorer, y con Chrome pasa algo raro me lleva a logoff, ahora esta linea va en create account y login ? setTimeout('document.location.href = "create_account.php"', 0); igualmente voy a probar no es el drama esto, y te cuento si me encuentro con algun problema, pero te recomiendo una vez probado subirlo a las contribuciones de oscomerce, sería de gran utilidad para la comunidad...un abrazo y gracias por tu tiempo [img]http://forums.oscommerce.com//public/style_emoticons/default/thumbsup.gif[/img]
Probé y anda de maravilla, todavia no lo probe en mozilla o en crhrome, pero no creo que haya problemas, un abrazo y gracias

#163 apolyshow

  • Community Member
  • 242 posts
  • Real Name:Andreas
  • Gender:Male

Posted 30 December 2011, 17:34

View PostJenniferJordan, on 30 July 2011, 17:33, said:

Hey Everyone!

I don't have these codes in my files::

<tr>
						<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
						<td align="right"><?php echo tep_image_submit('button_login.gif', IMAGE_BUTTON_LOGIN); ?></td>
						<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
					  </tr>

<tr>
		<td class="smallText"><br><?php echo sprintf(TEXT_ORIGIN_LOGIN, tep_href_link(FILENAME_LOGIN, tep_get_all_get_params(), 'SSL')); ?></td>
	  </tr>
	  <tr>
		<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
	  </tr>


 
I'm going to try adding the code that I'm supposed to add before/after anyway, just to see what happens. Looking forward to an answer! [img]http://forums.oscommerce.com/public/style_emoticons/default/smile.gif[/img] Thanks!

Have you find a solution for the osc 2.3.1?
And to all others we don't speak spanish....
One amateur made the Arc, 5.000 pro made the Titanic...

#164 juanmasi1

  • Community Member
  • 14 posts
  • Real Name:Ariel

Posted 02 January 2012, 22:01

View Postapolyshow, on 30 December 2011, 17:34, said:


Have you find a solution for the osc 2.3.1?
And to all others we don't speak spanish....
If you want to past the code, or past link of contribution for OSC 2.3.1 we will try...Regards

#165 juanmasi1

  • Community Member
  • 14 posts
  • Real Name:Ariel

Posted 02 January 2012, 22:09

View Postandes1, on 30 December 2011, 01:47, said:

hola hasta hpy me doy cuenta que el face connect no funciona... jejje. con estas nuevas modificaciones ya fuanciona as usual?
Hola si ya esta funcionando en mi página, saludos

#166 juanmasi1

  • Community Member
  • 14 posts
  • Real Name:Ariel

Posted 02 January 2012, 22:14

View Postaddeaz, on 21 December 2011, 09:45, said:

Here is some info of the changes, I did not fix it myself yet, anyone else get it?[img]http://forums.oscommerce.com//public/style_emoticons/default/smile.png[/img]

http://developers.fa.../blog/post/614/
https://developers.f.../blog/post/525/

Btw. Now when I did a resetting, nothing happens when I click the fb.button. The same problem for me now with 2.2 RC2 as you before with OScommerce version 2.3.1
Hi Andreas, if you change the code Its work perfect now

#167 kshop

  • Community Member
  • 29 posts
  • Real Name:A
  • Gender:Male

Posted 10 January 2012, 21:46

Has everyone solved problems with the latest FB SDK. I have a problem since December 2011. It looks like when I click the "login with facebook" button logout() is called (i have an alert() there) and the user does log in.
I have already modified fbconnect.php and $fbme variable is OK. I have no idea what is going on.
Osc 2.2.

Edited by kshop, 10 January 2012, 21:47.


#168 rabon33

  • Community Member
  • 51 posts
  • Real Name:jason ravone

Posted 19 January 2012, 04:03

Hello! everything Works now with the new modifications… but the customer cannot log out, everything seems do so, but when hit account or perform an activity in the web page he will be logged in automat, does no matter that his session on facebook itself was finished.

Any clue?
I think that was something with

On
Find
'cookie' => true,
Change by
'cookie' => false,


Or
On login.php
Find
<fb:login-button autologoutlink="true"

Changing to
<fb:login-button autologoutlink="false"

#169 kshop

  • Community Member
  • 29 posts
  • Real Name:A
  • Gender:Male

Posted 21 January 2012, 09:48

View Postkshop, on 10 January 2012, 21:46, said:

Has everyone solved problems with the latest FB SDK. I have a problem since December 2011. It looks like when I click the "login with facebook" button logout() is called (i have an alert() there) and the user does log in.
I have already modified fbconnect.php and $fbme variable is OK. I have no idea what is going on.
Osc 2.2.
I have made my own FB login code, I deleted all the FB javascript and do not use FB SDK anymore. I put a link (fb image button) to the file facebook login file in the login.php and in create_account.php. It's not perfect, but it works. The facebook login file is as follows:
<?php
//Facebook Connect

require('includes/application_top.php');
define('FILENAME_DO_FBLOGIN','dofblogin.php');//this file
// If user is logged in and session is valid.
if(!isset($_GET["code"]))
{
    $_SESSION['state'] = md5(uniqid(rand(), TRUE)); //CSRF protection
  $url="https://graph.facebook.com/oauth/authorize?client_id=".$fbconfig['appid' ]."&redirect_uri=".tep_href_link(FILENAME_DO_FBLOGIN)."&state="
	   . $_SESSION['state'];
  header("location:".$url);
   exit();
}
 
  if(isset($_GET["code"]))
{
    if($_REQUEST['state'] == $_SESSION['state']) {
	 $token_url ="https://graph.facebook.com/oauth/access_token?client_id="
	  . $fbconfig['appid' ] . "&redirect_uri=" . tep_href_link(FILENAME_DO_FBLOGIN)
	  . "&client_secret=" . $fbconfig['secret']
	  . "&code=" . $_GET['code'];
	 
	   $access_token = file_get_contents($token_url);
	   $_SESSION["access_token"]=$access_token;
   //$_SESSION["steps_facebook"]="authorized";


  $graph_url = "https://graph.facebook.com/me?" .$_SESSION["access_token"];
  $results = json_decode(file_get_contents($graph_url));
 
  
if(isset($results->id))
{   //user is logged in into FB
	  $fb_customer_query = tep_db_query("select customers_id, customers_firstname, customers_password, customers_email_address, customers_default_address_id from " . TABLE_CUSTOMERS . " where customers_email_address = '" . $results->email . "'");
	  $fb_customer_check = tep_db_num_rows($fb_customer_query);
   
	 if($fb_customer_check <= 0){
	    //check for id, email may not be available in case the user has changed FB privacy settings
	    $fb_customer_query = tep_db_query("select customers_id, customers_firstname, customers_password, customers_email_address, customers_default_address_id from " . TABLE_CUSTOMERS . " where fb_user_id = '" . $results->id . "'");  
	    $fb_customer_check = tep_db_num_rows($fb_customer_query);
	  }
	  // if user is logged in, set current user's login FB login (merge)
	  if (($fb_customer_check <= 0) and (!empty($_SESSION['customer_id']))){
	    $fb_customer_query = tep_db_query("select customers_id, customers_firstname, customers_password, customers_email_address, customers_default_address_id from " . TABLE_CUSTOMERS . " where customers_id = '" . (int)$_SESSION['customer_id'] . "'");  
	    $fb_customer_check = tep_db_num_rows($fb_customer_query);
	  }
	  if ($fb_customer_check > 0){
	    if (SESSION_RECREATE == 'True') {
		  tep_session_recreate();
	    }
	
	  $fb_customer = tep_db_fetch_array($fb_customer_query);
	   
	  $fb_country_query = tep_db_query("select entry_country_id, entry_zone_id from " . TABLE_ADDRESS_BOOK . " where customers_id = '" . (int)$fb_customer['customers_id'] . "' and address_book_id = '" . (int)$fb_customer['customers_default_address_id'] . "'");
	   $fb_country = tep_db_fetch_array($fb_country_query);
	  $customer_default_address_id = $fb_customer['customers_default_address_id'];
	    global  $customer_first_name;
	  $customer_first_name = $fb_customer['customers_firstname'];
	  $customer_country_id = $fb_country['entry_country_id'];
	  $customer_zone_id = $fb_country['entry_zone_id'];
	  $_SESSION['customer_id']=$fb_customer['customers_id'];
	    $_SESSION['customer_default_address_id']=$customer_default_address_id;
	    $_SESSION['customer_first_name']=$customer_first_name;
	    $_SESSION['customer_country_id']=$customer_country_id;
	    $_SESSION['customer_zone_id']=$customer_zone_id;
	   
	    tep_db_query("update " . TABLE_CUSTOMERS . " set fb_user_id = " . $results->id . " where customers_id = '" . (int)$fb_customer['customers_id']. "'");
	  tep_db_query("update " . TABLE_CUSTOMERS_INFO . " set customers_info_date_of_last_logon = now(), customers_info_number_of_logons = customers_info_number_of_logons+1 where customers_info_id = '" . (int)$fb_customer['customers_id'] . "'");
	
	
	  //restore cart contents
	  //$cart->restore_contents();
	   
		 if (sizeof($navigation->snapshot) > 0) {
		   $origin_href = tep_href_link($navigation->snapshot['page'], tep_array_to_string($navigation->snapshot['get'], array(tep_session_name())), $navigation->snapshot['mode']);
		    $navigation->clear_snapshot();
		   tep_redirect($origin_href);
		 } else {
		  tep_redirect(tep_href_link(FILENAME_DEFAULT));
		 }
	 }else{
		  //fb user not found in customers table
		  $account=array();
		  $account['customers_nickname']=$results->first_name;
		  $account['customers_firstname']=$results->first_name;
		  $account['customers_lastname']=$results->last_name;
		  /*if (isset($results->gender)){
		    if ($results->gender=='female'){
			  $account['customers_gender']='f';
		    } else {
			  $account['customers_gender']='m';
		    }
		  } else {
		    $account['customers_gender']='m';
		  }
		  */
		  if (isset($results->email)) {
		  $account['customers_email_address']=$results->email;
		  } else {
		    $account['customers_email_address']=tep_create_random_value(10).'@[member='unknown'].addr';
		  }
		  $newpass = tep_create_random_value(8);
		  $crypted_password = tep_encrypt_password($newpass);
		  $account['customers_password']=$crypted_password;
		  $account['fb_user_id']=$results->id;
		  $account['customers_default_address_id']=1;
		 
		  tep_db_perform(TABLE_CUSTOMERS,$account);
		  $fb_customer_query = tep_db_query("select customers_id from " . TABLE_CUSTOMERS . " where fb_user_id = '" . $results->id . "'");  
		  $fb_customer = tep_db_fetch_array($fb_customer_query);
		  $_SESSION['customer_id']=$fb_customer['customers_id'];
		  $_SESSION['customer_default_address_id']=1;
		 
		  tep_redirect(tep_href_link(FILENAME_ACCOUNT_EDIT));//account_edit
		
	  }
}//results->id

} else {
    echo("The state does not match. You may be a victim of CSRF.");
  }
  }//code
 
  require(DIR_WS_INCLUDES . 'application_bottom.php');
?>


#170 mcollina

  • Community Member
  • 7 posts
  • Real Name:Marcelo
  • Gender:Male

Posted 23 January 2012, 02:32

People...

Can someone help me please?

The buttons (on create account or in login), isn't no working, I review everything, but i dont know how to fix...

Tks for the help...

#171 rabon33

  • Community Member
  • 51 posts
  • Real Name:jason ravone

Posted 23 January 2012, 18:16

View Postkshop, on 21 January 2012, 09:48, said:

I have made my own FB login code, I deleted all the FB javascript and do not use FB SDK anymore. I put a link (fb image button) to the file facebook login file in the login.php and in create_account.php. It's not perfect, but it works. The facebook login file is as follows:


hello.. where did you place the code???

#172 kshop

  • Community Member
  • 29 posts
  • Real Name:A
  • Gender:Male

Posted 23 January 2012, 21:35

View Postrabon33, on 23 January 2012, 18:16, said:

hello.. where did you place the code???
The code above is in a separate file "dofblogin.php". In the login.php there is following code:
		  <tr>
			<td width="50%" align="right" valign="top"><?php echo '<a href="' . tep_href_link(FILENAME_CREATE_ACCOUNT, '', 'SSL') . '">' . tep_image_button('button_continue.gif', IMAGE_BUTTON_CONTINUE) . '</a>'; ?></td>
			<td width="50%" align="right" valign="top"><?php echo tep_image_submit('button_login.gif', IMAGE_BUTTON_LOGIN); ?></td>
		  </tr>
		  <tr>
<td>
</td>
<td width="50%" align="right" valign="top">
<?php
echo '<a href="' . tep_href_link(FILENAME_DO_FBLOGIN, '', 'SSL') . '">' . tep_image_button('button_fb_login.png', IMAGE_BUTTON_LOGIN) . '</a>';
?>
</td>
</tr>
create_account.php:
<!-- body_text //-->
	<td width="100%" valign="top"><?php echo tep_draw_form('account_edit', tep_href_link(FILENAME_CREATE_ACCOUNT_PROCESS, '', 'SSL'), 'post', 'onSubmit="return check_form();"') . tep_draw_hidden_field('action', 'process'); ?><table border="0" width="100%" cellspacing="0" cellpadding="0">
	  <tr>
		<td><table border="0" width="100%" cellspacing="0" cellpadding="0">
		  <tr>
			<td class="pageHeading"><?php echo HEADING_TITLE; ?></td>
			<td class="pageHeading" align="right"><?php //echo tep_image(DIR_WS_IMAGES . 'table_background_account.gif', HEADING_TITLE, HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td>
		  </tr>
		</table></td>
	  </tr>
<tr>
  <td>
  <?php
  echo '<a href="' . tep_href_link(FILENAME_DO_FBLOGIN, '', 'SSL') . '">' . tep_image_button('button_fb_login.png', IMAGE_BUTTON_LOGIN) . '</a>';
  ?>
  </td>
</tr>
the definition define('FILENAME_DO_FBLOGIN','dofblogin.php'); should be moved to includes/filenames.php
$fbconfig['secret'], $fbconfig['appid' ] could be placed in the includes/config.php and replaced by define().
You should uncomment the line
//$cart->restore_contents();

My osc 2.2 is very heavily modified, however I have posted the entire dofblogin.php file above, so it should work with no problems.

Edited by kshop, 23 January 2012, 21:44.


#173 kshop

  • Community Member
  • 29 posts
  • Real Name:A
  • Gender:Male

Posted 23 January 2012, 21:54

By the way it seems google will abandon its google friend connect very soon, however the code to use google account for logging in should be almost identical the one above if I am right. I had found and example of multi login (google, fb, yahoo, twitter...) somewhere on the internet (code.google.com ???). I cannot find it now when I need :-(

Edited by kshop, 23 January 2012, 21:57.


#174 rabon33

  • Community Member
  • 51 posts
  • Real Name:jason ravone

Posted 25 January 2012, 01:25

View Postkshop, on 23 January 2012, 21:54, said:

By the way it seems google will abandon its google friend connect very soon, however the code to use google account for logging in should be almost identical the one above if I am right. I had found and example of multi login (google, fb, yahoo, twitter...) somewhere on the internet (code.google.com ???). I cannot find it now when I need :-(
openid????

#175 Peper

  • Community Member
  • 343 posts
  • Real Name:Pierre
  • Gender:Male
  • Location:South Africa

Posted 03 February 2012, 06:15

Anyone got this addon to work wih the latest facebook update in January?

Please post neccesary code changes to get it working again
Contributions successfully installed : Header tags SEO, Scrolling new products, Customer testimonials, Support tickets, Polls, Link exchange, SPPC, X-sell, Master products, Dhtml menu, Image cache, Slide show, Product videos, Product custom sort, Product notes, Discount coupons, Ask question(review style + admin), CP builder, Customers also purchased, price list, // SEO URLS 5, and forgot the others and then a real admin setup.

#176 anant26692

  • Community Member
  • 1 posts
  • Real Name:Anant Parmar

Posted 10 February 2012, 17:20

It will be really helpfull if some one shares the facebook connect for version 2.3.1

#177 hho

  • Community Member
  • 18 posts
  • Real Name:Hans
  • Gender:Male
  • Location:Rainy Sweden

Posted 24 March 2012, 13:46

Installed the addon, no worries, but the fb connect button is inactive. I suppose it's the new fb sdk.

Did anyone figure out how to use this on OSC 2.3.1, with the new FB SDK? Or if anyone has any ideas?