Search code examples
phpprestashopfancybox-2prestashop-1.6

Prestashop proper way to load login and signup on fancybox iframe pop-up


I want to load authentication.tpl on a fancybox iframe without the header and footer.

I know that appending to the url content_only=1 works on certain pages

( for instance on CMS pages )

I tried:

A - blockuserinfo module nav.tpl template file

        <a class="login" href="{$link->getPageLink('my-account', true)|escape:'html':'UTF-8'}" rel="nofollow" title="{l s='Log in to your customer account' mod='blockuserinfo'}">
        {l s='Sign in' mod='blockuserinfo'}
        </a>

then on the global.js i have the function calling fancybox

// Login Box
$(document).on('click', '.login', function(e){
    e.preventDefault();
    var url = this.href;
    if (!!$.prototype.fancybox)
        $.fancybox({
            'padding':  0,
            'width':    1087,
            'height':   610,
            'type':     'iframe',
            'href':     url + 'content_only=1'
        });
});

the url var output in console is as expected

http://localhost/myprestshop/my-account?content_only=1

B - I also tried setting in AuthController.php

$this->content_only = true;

but in my-account page the smarty variable content_only is still set to 0

what is the proper way to accomplish that on prestashop?


Solution

  • to have a login pop up show in a fancybox iframe without header and footer

    just call authentication instead of my-account

        <a class="login" href="{$link->getPageLink('authentication', true)|escape:'html':'UTF-8'}" rel="nofollow" title="{l s='Log in to your customer account' mod='blockuserinfo'}">
            {l s='Sign in' mod='blockuserinfo'}
        </a>
    

    and then use the javascript function to attach the click handler to it as I did on my OP.