How to create customer login block

Today I want to show you how to create customer login block.  In this tutorial I will use free html block module for PrestaShop. What i mean by customer login block? Let me explain. By default prestashop dosn't allow to create block like this, you as a customer can only go to the authentication page, fill the form with your email and password and click login.  So, the customer login block is a place in one of the column where yout customers can insert own credentials and hit "login" button. Exactly as i show on image below. You can also check demo of this code here: customer login block demo

 

Prestashop Customer Login Block example

prestashop customer login block free

 

As I said - to achieve this it is necessary to use free module: html blockSo, download this addon and install it in your prestashop back office. Then go to the module configuration page. From the available hooks on the left hand side - select the "left column" hook (if you want to display customer login block there) if you want to display block in the right column - select right column. You can also select other hooks like footer, header or top.

 

Okay, so now it's time to create own login block code. We want to create Dark Gray header "Login" and to create two fields: Email Address and Password. Of course "login" button is also necessary. Paste this code to the "content" box and save the changes. That's all - Here is the code:

<div class="block">
  <form action="index.php?controller=authentication&amp;back=my-account" method="post" id="login_form" class="std">
    <p class="title_block" style="margin-bottom: 10px;">Login</p>
    <div class="form_content clearfix">
        <p class="text">
            <label for="email">Email address</label>
            <span><input type="text" id="email" name="email" value="" class="account_input" style="width: 192px;" /></span>
        </p>
        <p class="text">
            <label for="passwd">Password</label>
            <span><input type="password" id="passwd" name="passwd" value="" class="account_input" style="width: 192px;" /></span>
        </p>
        <p class="submit">
            <input type="hidden" class="hidden" name="back" value="my-account" /> <input type="submit" id="SubmitLogin" name="SubmitLogin" class="button" value="Log in" />
        </p>
    </div>
  </form>
</div>

After save you can go to your shop front-end and refresh it - you will see login block in the hook you selected. If it doesn't work - make sure that you use correct authentication page in the <form> definition in the code above. By default it looks like: index.php?controller=authentication&back=my-account

 

You can read also how to disable customer login block when user is logged in. if you've got any questions related to this topic - feel free to post your question below.

 

 

PopUp Login Block

 

customer popup login module

 

author milos myszczuk
Article by Milosz Myszczuk PrestaShop expert, official PrestaShop community moderator. PHP developer, specialist in relative and spatial databases management, GIS Analyst, CEO & founder of VEKIA interactive agency. Read more about VEKIA company
If you like my articles and want much more valuable tips, feel free to send me donation
1.4 version 1.4.11 1.6 404 addon admin advertise ahref ajax alpha animation api app application authentication back office backup badge banner basics block bootstrap button cache carrier cart catalog category certificate changelog chat class clear client clip cms code colors columns comments configuration contact container content controller cookie counter country coupon css csv currency customer dashboard database debug default delete delivery desktop developer device disable discount displayNav displayTop download dynamic editor effect empty encrypt engine error exchange exclude export facebook faceshop fade fancoupon fancybox fanpage fatal feature feed field file fix fixed font footer free friendly url front ftp full gallery generate gift global godaddy google google+ gray grid groupon header help hide highlight homefeatured homepage hook hosting hover howto htaccess html html5 ID image import include input instagram installation integration iPhone issue javascript jquery kgb knowhow languages law left likebox link list livingsocial loading log login logo loyality mail mailing maintenance manufacturer marketing marquee mcrypt menu meta mobile modification module movie moving multilanguage multiupload must have mysql news newsletter notification number open graph order override page password performance PHP phpmyadmin picture pinterest plugin popup post prestashop prestashop 1.0 prestashop 1.1 prestashop 1.2 prestashop 1.3 prestashop 1.4 prestashop 1.5 price rules problem product profile promotion proslider purifier quantity query quick tip random rates register reinsurance release reporting reset responsive restore results ribbon rich text right sales search security seo service shadow share shipping shop shopmania slider smarty social networks SQL SSL statistics stock store style subcategory superuser support switcher tab tablet tag tax template text theme tinyMCE tips and tricks tpl tracking translations tree trends trigger tumblr tutorial twitter update upgrade upload variables video visits voucher vulnerability web2print wide widget width window wishlist wysiwyg youtube zip zopim