Jump to content

Prestashop 1.7 guest one page checkout redirects to login instead of going to shipping carrier step


atlrpll

Recommended Posts

Latest 1.7 prestashop version. As I go through the one page order steps, order as guest:

after I input the address details and click continue I get redirected to account login page with message: "successfully created" instead of going on the one page order to the next step (shipping method)

Also, from the checkout page it takes 10-15seconds to load the one page order page 

Link to comment
Share on other sites

I managed to solve the bug. For me it was due to the old structure of the theme I use for PS 1.7 that had some missing parts coded in the newer version of the standard theme.

I replaced in all 3 theme files the code with the code from the new updated Classic theme from PS 17.6.8 which added some structure changes which allow the one-page-checkout to insert messages at the top, or through the address form (error messages) without leaving the page. I've attached a photo of all 3 files opened side-by-side to copy from the latest theme the updated templates. For me it didn't change the styling so all good.

PS. remember to clear cache and stuff like this...

Capture.JPG

Link to comment
Share on other sites

  • 2 months later...
On 10/21/2020 at 7:45 PM, atlrpll said:

I managed to solve the bug. For me it was due to the old structure of the theme I use for PS 1.7 that had some missing parts coded in the newer version of the standard theme.

I replaced in all 3 theme files the code with the code from the new updated Classic theme from PS 17.6.8 which added some structure changes which allow the one-page-checkout to insert messages at the top, or through the address form (error messages) without leaving the page. I've attached a photo of all 3 files opened side-by-side to copy from the latest theme the updated templates. For me it didn't change the styling so all good.

PS. remember to clear cache and stuff like this...

Capture.JPG

Hi, I modified the tpl files you indicated in my custom template and I still have the same problem. Obviously I cleared the cache and double-checked the changes several times but nothing. Sure you didn't have to edit any other files?

Link to comment
Share on other sites

30 minutes ago, pierol85 said:

Hi, I modified the tpl files you indicated in my custom template and I still have the same problem. Obviously I cleared the cache and double-checked the changes several times but nothing. Sure you didn't have to edit any other files?

Hi, yes that did it for me. You should install the standard theme and rule out the possibility that the theme is the problem. If you put the default theme and the problem goes away, then you know for sure it is another file from your theme that needs to be updated with the code from the default theme of your current prestashop version. Most times it's the theme. I find the platform to be rather unstable, especially with the constant updates and theme compatibilities. But I guess it's a good thing that they are at least working on bugs. That's the least they could do for a platform that costs 50-100euro per module to do basic stuff.

Link to comment
Share on other sites

51 minutes ago, pierol85 said:

Hi, thanks for the reply. I did the test you told me but I still find the problem ... I set the classic theme but the problem persists. I also tried to change php version as recommended in some topic, but nothing ... still the same problem

If it's not php related, nor theme problem than I suggest ditching the guest account option for now and wait for a new prestashop update. Do you have any payment module or other module that might interfere? Also, sometimes the problems caused after moving/updating prestashop were related to not deleting the var/cache folder (apart from clearing all prestashop caches and browser cache)

Link to comment
Share on other sites

45 minutes ago, atlrpll said:

If it's not php related, nor theme problem than I suggest ditching the guest account option for now and wait for a new prestashop update. Do you have any payment module or other module that might interfere? Also, sometimes the problems caused after moving/updating prestashop were related to not deleting the var/cache folder (apart from clearing all prestashop caches and browser cache)

Hi, also thanks to what you wrote, I did a lot of checks by deactivating the theme and third-party modules and I finally identified the problem that in my case was due to an external plugin for additional registration fields. This module has a setting that redirects after user registration.

Obviously, after an update of the module and of Prestashop this started to work also during the checkout creating the bug. I solved by turning off the module redirect.

Thank you very much for your support

Link to comment
Share on other sites

36 minutes ago, pierol85 said:

Hi, also thanks to what you wrote, I did a lot of checks by deactivating the theme and third-party modules and I finally identified the problem that in my case was due to an external plugin for additional registration fields. This module has a setting that redirects after user registration.

Obviously, after an update of the module and of Prestashop this started to work also during the checkout creating the bug. I solved by turning off the module redirect.

Thank you very much for your support

I'm glad you managed to solve it by yourself. And for anyone else hitting such errors/bugs the troubleshooting list should start with swapping the default theme and then de-activating the modules one-by-one until you identify the bug. If the problem is server/database related, then you will need hosting or a developer's help. Good luck with your shop!

Link to comment
Share on other sites

  • 1 month later...
On 10/21/2020 at 7:45 PM, atlrpll said:

I managed to solve the bug. For me it was due to the old structure of the theme I use for PS 1.7 that had some missing parts coded in the newer version of the standard theme.

I replaced in all 3 theme files the code with the code from the new updated Classic theme from PS 17.6.8 which added some structure changes which allow the one-page-checkout to insert messages at the top, or through the address form (error messages) without leaving the page. I've attached a photo of all 3 files opened side-by-side to copy from the latest theme the updated templates. For me it didn't change the styling so all good.

PS. remember to clear cache and stuff like this...

Capture.JPG

Sorry, I can't open the pic. Anyone who can help. Thank you

Link to comment
Share on other sites

The files I needed to change with the original code from the standard theme were:

Addresses.tpl

Address-form.tpl

So my bug was due to Prestashop update that made my theme out-dated. Changing the code in the template files related to the checkout page solved my problem. This is what the small printscreen illustrated.

Link to comment
Share on other sites

10 hours ago, atlrpll said:

The files I needed to change with the original code from the standard theme were:

Addresses.tpl

Address-form.tpl

So my bug was due to Prestashop update that made my theme out-dated. Changing the code in the template files related to the checkout page solved my problem. This is what the small printscreen illustrated.

Thank you. I am not totally clear of what to change. Please take a look of my inserted addresses.tpl and address-form.tpl below:

/public_html/themes/classic/templates/checkout/_partials/address-form.tpl

{extends file='customer/_partials/address-form.tpl'}

{block name='form_field'}
  {if $field.name eq "alias" and $customer.is_guest}
    {* we don't ask for alias here if customer is not registered *}
  {else}
    {$smarty.block.parent}
  {/if}
{/block}

{block name="address_form_url"}
    <form
      method="POST"
      action="{url entity='order' params=['id_address' => $id_address]}"
      data-id-address="{$id_address}"
      data-refresh-url="{url entity='order' params=['ajax' => 1, 'action' => 'addressForm']}"
    >
{/block}

{block name='form_fields' append}
  <input type="hidden" name="saveAddress" value="{$type}">
  {if $type === "delivery"}
    <div class="form-group row">
      <div class="col-md-9 col-md-offset-3">
        <input name = "use_same_address" id="use_same_address" type = "checkbox" value = "1" {if $use_same_address} checked {/if}>
        <label for="use_same_address">{l s='Use this address for invoice too' d='Shop.Theme.Checkout'}</label>
      </div>
    </div>
  {/if}
{/block}

{block name='form_buttons'}
  {if !$form_has_continue_button}
    <button type="submit" class="btn btn-primary float-xs-right">{l s='Save' d='Shop.Theme.Actions'}</button>
    <a class="js-cancel-address cancel-address float-xs-right" href="{url entity='order' params=['cancelAddress' => {$type}]}">{l s='Cancel' d='Shop.Theme.Actions'}</a>
  {else}
    <form>
      <button type="submit" class="continue btn btn-primary float-xs-right" name="confirm-addresses" value="1">
          {l s='Continue' d='Shop.Theme.Actions'}
      </button>
      {if $customer.addresses|count > 0}
        <a class="js-cancel-address cancel-address float-xs-right" href="{url entity='order' params=['cancelAddress' => {$type}]}">{l s='Cancel' d='Shop.Theme.Actions'}</a>
      {/if}
    </form>
  {/if}
{/block}
 

/public_html/themes/classic/templates/customer/addresses.tpl

{extends file='customer/page.tpl'}

{block name='page_title'}
  {l s='Your addresses' d='Shop.Theme.Customeraccount'}
{/block}

{block name='page_content'}
  {foreach $customer.addresses as $address}
    <div class="col-lg-4 col-md-6 col-sm-6">
    {block name='customer_address'}
      {include file='customer/_partials/block-address.tpl' address=$address}
    {/block}
    </div>
  {/foreach}
  <div class="clearfix"></div>
  <div class="addresses-footer">
    <a href="{$urls.pages.address}" data-link-action="add-address">
      <i class="material-icons">&#xE145;</i>
      <span>{l s='Create new address' d='Shop.Theme.Actions'}</span>
    </a>
  </div>
{/block}
 

I would really avoid to make a clean installation of 1.7.7.1 due to the work needed for this

Link to comment
Share on other sites

3 hours ago, atlrpll said:

You should copy the template files from the original theme to your custom theme. see if that solves the problem, then the problem is in the code of your theme, not compatible with the Prestashop update anymore (the theme is outdated)

I only use the original theme classic. When updating to 1.7.7.1 the theme was updated as well, but with the same result

Link to comment
Share on other sites

Then your error is not generated from the same reason as mine. Mine was theme incompatibility related due to update.

Another reason might be third party modules interfering with the form submit which "throws" you to the login page.

PS: Always clear cash and disable all cache services when working with such bugs. You might have solved it but the cache somewhere keeps old code.

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...