Jump to content

Guest checkout - only require email


Recommended Posts

Dear fellow PrestaShop masters, I come to you for guidance.

 

 

I have spent the last two days searching the web and small-coding trying to solve this difficult yet so simple problem in order to finally complete my first store. The lack of findings made me believe that I am not the only one biting my nails for this one.  :wacko:

 

Problem: It is quite simple, I would like the only requirement for guest checkout to be email authentication – that’s it. However, I would still like to keep the same old requirements for registration, so just disabling or removing them completely won’t do it.

 

 

 

I would truly appreciate your wisdom and forever be grateful if we can solve this together, thank you!

Link to comment
Share on other sites

Hi ndiaga,

 

Thank you for your guidance. Could you please elaborate your answer or possibly include exact changes that need to be made since I'm not that experienced of source coding? BTW I'm using multiple step checkout, not one page checkout.

 

 

Would truly be grateful, thank you!

Edited by Dongster (see edit history)
Link to comment
Share on other sites

 

When you comment a variable from the template if that variable is required you will get an error so try to use :

<input type="hidden" name="ndiaga"  value="PrestaShop expert">

instead of :

<input type="text" name="ndiaga"  value="{if isset($smarty.post.ndiaga)}{$smarty.post.ndiaga|stripslashes}{/if}" >

You will just need to put your own data for those fields by default .

Let us take password for example:

 

You have:

<div class="form-group">
<label for="passwd">{l s='Password'}</label>
<span><input class="is_required validate account_input form-control" type="password" data-validate="isPasswd" id="passwd" name="passwd" value="{if isset($smarty.post.passwd)}{$smarty.post.passwd|stripslashes}{/if}" /></span>
</div>

after using hidden:

<div class="form-group">
<!--<label for="passwd">{l s='Password'}</label>-->
<span><input class="is_required validate account_input form-control" type="hidden" data-validate="isPasswd" id="passwd" name="passwd" value="my_default_password" /></span>
</div>

 

 

 

 

 

Truly appreciate your guidance!

 

I follow and understand what you mean, maybe I was not clear enough. I have deleted every other variable except email in the authentication.tpl file and have the following code right now:

 

{if isset($inOrderProcess) && $inOrderProcess && $PS_GUEST_CHECKOUT_ENABLED}
<form action="{$link->getPageLink('authentication', true, NULL, "back=$back")|escape:'html':'UTF-8'}" method="post" id="new_account_form" class="form-horizontal std clearfix">
<h3 class="page-heading bottom-indent">{l s='Instant checkout'}</h3>
<div class="panel panel-default">
<h3 class="page-subheading">{l s='Without registration'}</h3>
<p>{l s='Only if the email address is not previously registered. If you are already registered, please select the option "Already registred?" above.'}</p> 
<div id="opc_account_form" class="panel-body clearfix"style="display: block; "> 
<div class="required form-group">
<label for="guest_email">{l s='Email address'} <sup></sup></label>
<input type="text" class="is_required validate form-control" data-validate="isEmail" id="guest_email" name="guest_email" value="{if isset($smarty.post.guest_email)}{$smarty.post.guest_email}{/if}" />
</div>
{$HOOK_CREATE_ACCOUNT_FORM}
</div>
<p class="cart_navigation required submit clearfix">
<!-- <span><sup>*</sup>{l s='Required field'}</span> -->
<input type="hidden" name="display_guest_checkout" value="1" />
<button type="submit" class="button btn btn-default button-medium" name="submitGuestAccount" id="submitGuestAccount">
<span>
{l s='Next'}
<i class="icon-chevron-right right"></i>
</span>
</button>
</p>
</form>
{/if}
 
However the following errors are still there when entering a valid email using guest checkout:
 
THERE ARE 10 errors
You must enter at least one phone number.
last name is required.
First Name is required.
passwd required.
id_country required.
alias required.
address1 required.
City is required.
Country can not be charged with address> id_country
Country is not correct

 

How can I avoid these errors when using guest checkout? I believe that I need to edit some more code but don't know which  :wacko:

Edited by Dongster (see edit history)
Link to comment
Share on other sites

take a look at order-opc.tpl  you will see the list of related files.

 

You are a legend man! After some thinking I followed your previous advise and it worked like a charm, however I edited the authentication.tpl file since I'm using multiple step checkout. I can't explain how grateful I am, spent so much time and energy and finally solved it!

 

Do you perhaps know how to disable the creation of new accounts for every customers that only use the guest checkout? This is unnecessary for my store and will also create problems when same customers revisit my site and place new orders.

 

Truly appreciate all of your guidance!

Link to comment
Share on other sites

I don't think that this solves the problem since I'm not using OPC, but instead multiple step checkout which require changes to be made in the authentication.tpl and AuthController.php files.

 

don't want Prestashop to create a new account for guest checkout at all and directly direct them to payment page ("Speed Checkout"). However still remain the same with the same options for guests who want to register.

Edited by Dongster (see edit history)
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...