[*] FO : Retrieve invoice address in OPC + guest checkout, thanks @Piotr Moćko
This commit is contained in:
@@ -376,6 +376,9 @@ class OrderOpcControllerCore extends ParentOrderController
|
||||
$customer = $this->context->customer;
|
||||
$address_delivery = new Address($this->context->cart->id_address_delivery);
|
||||
|
||||
$id_address_invoice = $this->context->cart->id_address_invoice != $this->context->cart->id_address_delivery ? (int)$this->context->cart->id_address_invoice : 0;
|
||||
$address_invoice = new Address($id_address_invoice);
|
||||
|
||||
if ($customer->birthday)
|
||||
$birthday = explode('-', $customer->birthday);
|
||||
else
|
||||
@@ -404,7 +407,21 @@ class OrderOpcControllerCore extends ParentOrderController
|
||||
'id_gender' => (int)$customer->id_gender,
|
||||
'sl_year' => $birthday[0],
|
||||
'sl_month' => $birthday[1],
|
||||
'sl_day' => $birthday[2]
|
||||
'sl_day' => $birthday[2],
|
||||
'id_address_invoice' => $id_address_invoice,
|
||||
'company_invoice' => Tools::htmlentitiesUTF8($address_invoice->company),
|
||||
'lastname_invoice' => Tools::htmlentitiesUTF8($address_invoice->lastname),
|
||||
'firstname_invoice' => Tools::htmlentitiesUTF8($address_invoice->firstname),
|
||||
'vat_number_invoice' => Tools::htmlentitiesUTF8($address_invoice->vat_number),
|
||||
'dni_invoice' => Tools::htmlentitiesUTF8($address_invoice->dni),
|
||||
'address1_invoice' => Tools::htmlentitiesUTF8($address_invoice->address1),
|
||||
'address2_invoice' => Tools::htmlentitiesUTF8($address_invoice->address2),
|
||||
'postcode_invoice' => Tools::htmlentitiesUTF8($address_invoice->postcode),
|
||||
'city_invoice' => Tools::htmlentitiesUTF8($address_invoice->city),
|
||||
'phone_invoice' => Tools::htmlentitiesUTF8($address_invoice->phone),
|
||||
'phone_mobile_invoice' => Tools::htmlentitiesUTF8($address_invoice->phone_mobile),
|
||||
'id_country_invoice' => (int)($address_invoice->id_country),
|
||||
'id_state_invoice' => (int)($address_invoice->id_state),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -180,13 +180,11 @@
|
||||
{$stateExist = false}
|
||||
{$postCodeExist = false}
|
||||
{foreach from=$dlv_all_fields item=field_name}
|
||||
{if $field_name eq "company"}
|
||||
{if $b2b_enable}
|
||||
{if $field_name eq "company" && $b2b_enable}
|
||||
<p class="text">
|
||||
<label for="company">{l s='Company'}</label>
|
||||
<input type="text" class="text" id="company" name="company" value="{if isset($guestInformations) && $guestInformations.company}{$guestInformations.company}{/if}" />
|
||||
</p>
|
||||
{/if}
|
||||
{elseif $field_name eq "firstname"}
|
||||
<p class="required text">
|
||||
<label for="firstname">{l s='First name'} <sup>*</sup></label>
|
||||
@@ -224,7 +222,7 @@
|
||||
<select name="id_country" id="id_country">
|
||||
<option value="">-</option>
|
||||
{foreach from=$countries item=v}
|
||||
<option value="{$v.id_country}" {if (isset($guestInformations) AND $guestInformations.id_country == $v.id_country) OR (!isset($guestInformations) && $sl_country == $v.id_country)} selected="selected"{/if}>{$v.name|escape:'htmlall':'UTF-8'}</option>
|
||||
<option value="{$v.id_country}"{if (isset($guestInformations) AND $guestInformations.id_country == $v.id_country) OR (!isset($guestInformations) && $sl_country == $v.id_country)} selected="selected"{/if}>{$v.name|escape:'htmlall':'UTF-8'}</option>
|
||||
{/foreach}
|
||||
</select>
|
||||
</p>
|
||||
@@ -277,7 +275,7 @@
|
||||
</p>
|
||||
<p class="{if isset($one_phone_at_least) && $one_phone_at_least}required {/if}text">
|
||||
<label for="phone_mobile">{l s='Mobile phone'}{if isset($one_phone_at_least) && $one_phone_at_least} <sup>*</sup>{/if}</label>
|
||||
<input type="text" class="text" name="phone_mobile" id="phone_mobile" value="" />
|
||||
<input type="text" class="text" name="phone_mobile" id="phone_mobile" value="{if isset($guestInformations) && $guestInformations.phone_mobile}{$guestInformations.phone_mobile}{/if}" />
|
||||
</p>
|
||||
<input type="hidden" name="alias" id="alias" value="{l s='My address'}" />
|
||||
|
||||
@@ -291,7 +289,7 @@
|
||||
{assign var=postCodeExist value=false}
|
||||
<h3>{l s='Invoice address'}</h3>
|
||||
{foreach from=$inv_all_fields item=field_name}
|
||||
{if $field_name eq "company"}
|
||||
{if $field_name eq "company" && $b2b_enable}
|
||||
<p class="text is_customer_param">
|
||||
<label for="company_invoice">{l s='Company'}</label>
|
||||
<input type="text" class="text" id="company_invoice" name="company_invoice" value="" />
|
||||
@@ -305,39 +303,39 @@
|
||||
</div>
|
||||
<p class="required text dni_invoice">
|
||||
<label for="dni">{l s='Identification number'}</label>
|
||||
<input type="text" class="text" name="dni_invoice" id="dni_invoice" value="{if isset($guestInformations) && $guestInformations.dni}{$guestInformations.dni}{/if}" />
|
||||
<input type="text" class="text" name="dni_invoice" id="dni_invoice" value="{if isset($guestInformations) && $guestInformations.dni_invoice}{$guestInformations.dni_invoice}{/if}" />
|
||||
<span class="form_info">{l s='DNI / NIF / NIE'}</span>
|
||||
</p>
|
||||
{elseif $field_name eq "firstname"}
|
||||
<p class="required text">
|
||||
<label for="firstname_invoice">{l s='First name'} <sup>*</sup></label>
|
||||
<input type="text" class="text" id="firstname_invoice" name="firstname_invoice" value="" />
|
||||
<input type="text" class="text" id="firstname_invoice" name="firstname_invoice" value="{if isset($guestInformations) && $guestInformations.firstname_invoice}{$guestInformations.firstname_invoice}{/if}" />
|
||||
</p>
|
||||
{elseif $field_name eq "lastname"}
|
||||
<p class="required text">
|
||||
<label for="lastname_invoice">{l s='Last name'} <sup>*</sup></label>
|
||||
<input type="text" class="text" id="lastname_invoice" name="lastname_invoice" value="" />
|
||||
<input type="text" class="text" id="lastname_invoice" name="lastname_invoice" value="{if isset($guestInformations) && $guestInformations.firstname_invoice}{$guestInformations.firstname_invoice}{/if}" />
|
||||
</p>
|
||||
{elseif $field_name eq "address1"}
|
||||
<p class="required text">
|
||||
<label for="address1_invoice">{l s='Address'} <sup>*</sup></label>
|
||||
<input type="text" class="text" name="address1_invoice" id="address1_invoice" value="" />
|
||||
<input type="text" class="text" name="address1_invoice" id="address1_invoice" value="{if isset($guestInformations) && $guestInformations.address1_invoice}{$guestInformations.address1_invoice}{/if}" />
|
||||
</p>
|
||||
{elseif $field_name eq "address2"}
|
||||
<p class="text is_customer_param">
|
||||
<label for="address2_invoice">{l s='Address (Line 2)'}</label>
|
||||
<input type="text" class="text" name="address2_invoice" id="address2_invoice" value="" />
|
||||
<input type="text" class="text" name="address2_invoice" id="address2_invoice" value="{if isset($guestInformations) && $guestInformations.address2_invoice}{$guestInformations.address2_invoice}{/if}" />
|
||||
</p>
|
||||
{elseif $field_name eq "postcode"}
|
||||
{$postCodeExist = true}
|
||||
<p class="required postcode_invoice text">
|
||||
<label for="postcode_invoice">{l s='Zip / Postal Code'} <sup>*</sup></label>
|
||||
<input type="text" class="text" name="postcode_invoice" id="postcode_invoice" value="" onkeyup="$('#postcode').val($('#postcode').val().toUpperCase());" />
|
||||
<input type="text" class="text" name="postcode_invoice" id="postcode_invoice" value="{if isset($guestInformations) && $guestInformations.postcode_invoice}{$guestInformations.postcode_invoice}{/if}" onkeyup="$('#postcode').val($('#postcode').val().toUpperCase());" />
|
||||
</p>
|
||||
{elseif $field_name eq "city"}
|
||||
<p class="required text">
|
||||
<label for="city_invoice">{l s='City'} <sup>*</sup></label>
|
||||
<input type="text" class="text" name="city_invoice" id="city_invoice" value="" />
|
||||
<input type="text" class="text" name="city_invoice" id="city_invoice" value="{if isset($guestInformations) && $guestInformations.city_invoice}{$guestInformations.city_invoice}{/if}" />
|
||||
</p>
|
||||
{elseif $field_name eq "country" || $field_name eq "Country:name"}
|
||||
<p class="required select">
|
||||
@@ -345,7 +343,7 @@
|
||||
<select name="id_country_invoice" id="id_country_invoice">
|
||||
<option value="">-</option>
|
||||
{foreach from=$countries item=v}
|
||||
<option value="{$v.id_country}" {if ($sl_country == $v.id_country)} selected="selected"{/if}>{$v.name|escape:'htmlall':'UTF-8'}</option>
|
||||
<option value="{$v.id_country}"{if (isset($guestInformations) AND $guestInformations.id_country_invoice == $v.id_country) OR (!isset($guestInformations) && $sl_country == $v.id_country)} selected="selected"{/if}>{$v.name|escape:'htmlall':'UTF-8'}</option>
|
||||
{/foreach}
|
||||
</select>
|
||||
</p>
|
||||
@@ -382,11 +380,11 @@
|
||||
{/if}
|
||||
<p class="text">
|
||||
<label for="phone_invoice">{l s='Home phone'}</label>
|
||||
<input type="text" class="text" name="phone_invoice" id="phone_invoice" value="" />
|
||||
<input type="text" class="text" name="phone_invoice" id="phone_invoice" value="{if isset($guestInformations) && $guestInformations.phone_invoice}{$guestInformations.phone_invoice}{/if}" />
|
||||
</p>
|
||||
<p class="{if isset($one_phone_at_least) && $one_phone_at_least}required {/if}text is_customer_param">
|
||||
<label for="phone_mobile_invoice">{l s='Mobile phone'}{if isset($one_phone_at_least) && $one_phone_at_least} <sup>*</sup>{/if}</label>
|
||||
<input type="text" class="text" name="phone_mobile_invoice" id="phone_mobile_invoice" value="" />
|
||||
<input type="text" class="text" name="phone_mobile_invoice" id="phone_mobile_invoice" value="{if isset($guestInformations) && $guestInformations.phone_mobile_invoice}{$guestInformations.phone_mobile_invoice}{/if}" />
|
||||
</p>
|
||||
<input type="hidden" name="alias_invoice" id="alias_invoice" value="{l s='My Invoice address'}" />
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user