Skip to content

Instantly share code, notes, and snippets.

@stefanbc
Created May 13, 2014 11:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stefanbc/1e8301f23cc0d324b456 to your computer and use it in GitHub Desktop.
Save stefanbc/1e8301f23cc0d324b456 to your computer and use it in GitHub Desktop.
Login with Facebook using Login Radius in Prestashop
<!-- Requires dependencies https://github.com/carhartl/jquery-cookie -->
<script src="{$js_dir}jquery.cookie.js"></script>
{if $smarty.get.fb == 1 && $page_name == 'index'}
<script type="text/javascript">
$(document).ready(function(){
// console.log("BEFORE");
var cookie = $.cookie("loggedinFB");
// console.log("Cookie: " + cookie);
if (cookie != 'logged') {
// console.log("AFTER");
$.cookie("loggedinFB", 'logged');
window.location.href = 'https://%YOUR_LOGINRADIUS_URL%/requesthandlor.aspx?apikey=%YOUR_API_KEY%&provider=facebook&callback={$base_uri}?fb=1';
} else {
window.location.href = 'https://apps.facebook.com/%YOUR_FACEBOOK_APP%';
}
});
</script>
{/if}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment