Jump to content

Address 2 missing from guest checkout


Dave Riley

Recommended Posts

Prestashop 1.5.6.0, set up for UK.

Address (Line 2) is not shown in the DELIVERY ADDRESS section of the guest (instant) checkout. It is shown if you register for an account and it shows up in all the places in MY ACCOUNT. I've made sure that address2 is present in the address formats of both the countries (UK & Ireland) that my shop is set up for.

 

I've done some investigation and part of the reason is that in order-opc-new-account.tpl the address 2 input field and its label are enclosed within a <p> tag which has the class "is_customer_param" and the Javascript associated with that page page (order-opc.js) is hiding all fields of that class. Removing the "is_customer_param" class from the <p> tag does indeed make the Address 2 field show up - however, any data entered into it is not saved into the database (neither is the gender setting as it happens). One clue is in controllers\front\OrderOpcController.php, line 423 - there's an array filled with various address fields - address1 is there but address2 is not.

 

So, it looks like this is deliberate, but why? And if so is there any way to change it? I'm reluctant to just add address2 to the list in OrderOpcController.php as there could be other places which are involved too. Should I be logging an issue in the forge?

 

Any info gratefully received.

Thanks,

 Dave

Link to comment
Share on other sites

  • 10 months later...
  • 6 months later...
  • 2 months later...

Has anyone figured this out? What a bummer!

 

Yes. It takes 30 seconds.

 

Here's my guide.

 

#1 First create a new class in global.css.

 

global.css can be found in: /yourtheme/css/

 

.rizzzle

{display:inherit!important;}

 

Save the file.

 

#2 Now open: order-opc-new-account.tpl

 

This can be found in: /yourtheme/

 

Search for:

 

<div class="text is_customer_param form-group">

                    <label for="address2">{l s='Address (Line 2)'}</label>

                    <input type="text" class="text form-control validate" name="address2" id="address2" data-validate="isAddress" value="{if isset($guestInformations) && isset($guestInformations.address2) && isset($guestInformations) && isset($guestInformations.address2) && $guestInformations.address2}{$guestInformations.address2}{/if}" />

                </div>

 

#3  Add your style onto this line:

 

<div class="text is_customer_param form-group">

 

Which would make:

 

<div class="text is_customer_param form-group rizzzle">

 

#4 Save file. Remember to force compile the tpl. DONE.

 

 

Explanation of how this works

 

The display:inherit!Important tag in your new class overrides the display:none

 

!important prioritises css.

  • Like 1
Link to comment
Share on other sites

  • 2 months later...

Thanks aliaspt.

Worked for me. Except my order-opc-new-account.tpl looked different:

</p>
{elseif $field_name eq "address2"}
	<p class="text is_customer_param rizzle">
	<label for="address2_invoice">{l s='Address (Line 2)'}</label>
	<input type="text" class="text" name="address2_invoice" id="address2_invoice" value="" />

Using Prestashop 1.6.0.8

Link to comment
Share on other sites

  • 2 years later...
  • 6 months later...

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