Jump to content

1.5.4.1 Update issue lastname and firstname are required opc


Recommended Posts

Hi all.

 

While upgrading my prestashop site from 1.5.4.0 to 1.5.4.1(1-click upgrade module) I have one issue. The thing is that when I fill in firstname and lastname in one page checkout, guest checkout or create an account mode the prestashop says:

 

1. firstname is requiered.

2. lastname is required.

 

But they are filled. On normal checkout new user creates without errors. What can I do with it any thougths?

 

I am using default theme, english or russian language, no modifications are made to core files. Site address _scantool62.ru. I think problem is somewhere in attached files...

 

themes/default/js/order-opc.js

 

 

/*
* 2007-2013 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to [email protected] so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
*  @author PrestaShop SA <[email protected]>
*  @copyright  2007-2013 PrestaShop SA
*  @license	http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
*  International Registered Trademark & Property of PrestaShop SA
*/
function updateCarrierList(json)
{
var html = json.carrier_block;

// @todo  check with theme 1.4
//if ($('#HOOK_EXTRACARRIER').length == 0 && json.HOOK_EXTRACARRIER !== null && json.HOOK_EXTRACARRIER != undefined)
// html += json.HOOK_EXTRACARRIER;

$('#carrier_area').replaceWith(html);
bindInputs();
/* update hooks for carrier module */
$('#HOOK_BEFORECARRIER').html(json.HOOK_BEFORECARRIER);
}
function updatePaymentMethods(json)
{
$('#HOOK_TOP_PAYMENT').html(json.HOOK_TOP_PAYMENT);
$('#opc_payment_methods-content #HOOK_PAYMENT').html(json.HOOK_PAYMENT);
}
function updatePaymentMethodsDisplay()
{
var checked = '';
if ($('#cgv:checked').length !== 0)
 checked = 1;
else
 checked = 0;
$('#opc_payment_methods-overlay').fadeIn('slow', function(){
 $.ajax({
  type: 'POST',
  headers: { "cache-control": "no-cache" },
  url: orderOpcUrl + '?rand=' + new Date().getTime(),
  async: true,
  cache: false,
  dataType : "json",
  data: 'ajax=true&method=updateTOSStatusAndGetPayments&checked=' + checked + '&token=' + static_token,
  success: function(json)
  {
updatePaymentMethods(json);
  }
 });
 $(this).fadeOut('slow');
});
}
function updateAddressSelection()
{
var idAddress_delivery = ($('#opc_id_address_delivery').length == 1 ? $('#opc_id_address_delivery').val() : $('#id_address_delivery').val());
var idAddress_invoice = ($('#opc_id_address_invoice').length == 1 ? $('#opc_id_address_invoice').val() : ($('#addressesAreEquals:checked').length == 1 ? idAddress_delivery : ($('#id_address_invoice').length == 1 ? $('#id_address_invoice').val() : idAddress_delivery)));
$('#opc_account-overlay').fadeIn('slow');
$('#opc_delivery_methods-overlay').fadeIn('slow');
$('#opc_payment_methods-overlay').fadeIn('slow');

$.ajax({
 type: 'POST',
 headers: { "cache-control": "no-cache" },
 url: orderOpcUrl + '?rand=' + new Date().getTime(),
 async: true,
 cache: false,
 dataType : "json",
 data: 'ajax=true&method=updateAddressesSelected&id_address_delivery=' + idAddress_delivery + '&id_address_invoice=' + idAddress_invoice + '&token=' + static_token,
 success: function(jsonData)
 {
  if (jsonData.hasError)
  {
var errors = '';
for(var error in jsonData.errors)
 //IE6 bug fix
 if(error !== 'indexOf')
  errors += jsonData.errors[error] + "\n";
alert(errors);
  }
  else
  {
// Update all product keys with the new address id
$('#cart_summary .address_'+deliveryAddress).each(function() {
 $(this)
  .removeClass('address_'+deliveryAddress)
  .addClass('address_'+idAddress_delivery);
 $(this).attr('id', $(this).attr('id').replace(/_\d+$/, '_'+idAddress_delivery));
 if ($(this).find('.cart_unit span').length > 0 && $(this).find('.cart_unit span').attr('id').length > 0)
  $(this).find('.cart_unit span').attr('id', $(this).find('.cart_unit span').attr('id').replace(/_\d+$/, '_'+idAddress_delivery));
 if ($(this).find('.cart_total span').length > 0 && $(this).find('.cart_total span').attr('id').length > 0)
  $(this).find('.cart_total span').attr('id', $(this).find('.cart_total span').attr('id').replace(/_\d+$/, '_'+idAddress_delivery));
 if ($(this).find('.cart_quantity_input').length > 0 && $(this).find('.cart_quantity_input').attr('name').length > 0)
 {
  var name = $(this).find('.cart_quantity_input').attr('name')+'_hidden';
  $(this).find('.cart_quantity_input').attr('name', $(this).find('.cart_quantity_input').attr('name').replace(/_\d+$/, '_'+idAddress_delivery));
  if ($(this).find('[name='+name+']').length > 0)
   $(this).find('[name='+name+']').attr('name', name.replace(/_\d+_hidden$/, '_'+idAddress_delivery+'_hidden'));
 }
 if ($(this).find('.cart_quantity_delete').length > 0 && $(this).find('.cart_quantity_delete').attr('id').length > 0)
 {
  $(this).find('.cart_quantity_delete')
   .attr('id', $(this).find('.cart_quantity_delete').attr('id').replace(/_\d+$/, '_'+idAddress_delivery))
   .attr('href', $(this).find('.cart_quantity_delete').attr('href').replace(/id_address_delivery=\d+&/, 'id_address_delivery='+idAddress_delivery+'&'));
 }

 if ($(this).find('.cart_quantity_down').length > 0 && $(this).find('.cart_quantity_down').attr('id').length > 0)
 {
  $(this).find('.cart_quantity_down')
   .attr('id', $(this).find('.cart_quantity_down').attr('id').replace(/_\d+$/, '_'+idAddress_delivery))
   .attr('href', $(this).find('.cart_quantity_down').attr('href').replace(/id_address_delivery=\d+&/, 'id_address_delivery='+idAddress_delivery+'&'));
 }
 if ($(this).find('.cart_quantity_up').length > 0 && $(this).find('.cart_quantity_up').attr('id').length > 0)
 {
  $(this).find('.cart_quantity_up')
   .attr('id', $(this).find('.cart_quantity_up').attr('id').replace(/_\d+$/, '_'+idAddress_delivery))
   .attr('href', $(this).find('.cart_quantity_up').attr('href').replace(/id_address_delivery=\d+&/, 'id_address_delivery='+idAddress_delivery+'&'));
 }
});
// Update global var deliveryAddress
deliveryAddress = idAddress_delivery;
if (window.ajaxCart !== undefined)
{
 $('#cart_block_list dd, #cart_block_list dt').each(function(){
  if (typeof($(this).attr('id')) != 'undefined')
   $(this).attr('id', $(this).attr('id').replace(/_\d+$/, '_' + idAddress_delivery));
 });
}
updateCarrierList(jsonData.carrier_data);
updatePaymentMethods(jsonData);
updateCartSummary(jsonData.summary);
updateHookShoppingCart(jsonData.HOOK_SHOPPING_CART);
updateHookShoppingCartExtra(jsonData.HOOK_SHOPPING_CART_EXTRA);
if ($('#gift-price').length == 1)
 $('#gift-price').html(jsonData.gift_price);
$('#opc_account-overlay, #opc_delivery_methods-overlay, #opc_payment_methods-overlay').fadeOut('slow');
  }
 },
 error: function(XMLHttpRequest, textStatus, errorThrown) {
  if (textStatus !== 'abort')
alert("TECHNICAL ERROR: unable to save adresses \n\nDetails:\nError thrown: " + XMLHttpRequest + "\n" + 'Text status: ' + textStatus);
  $('#opc_account-overlay, #opc_delivery_methods-overlay, #opc_payment_methods-overlay').fadeOut('slow');
 }
});
}
function getCarrierListAndUpdate()
{
$('#opc_delivery_methods-overlay').fadeIn('slow');
$.ajax({
 type: 'POST',
 headers: { "cache-control": "no-cache" },
 url: orderOpcUrl + '?rand=' + new Date().getTime(),
 async: true,
 cache: false,
 dataType : "json",
 data: 'ajax=true&method=getCarrierList&token=' + static_token,
 success: function(jsonData)
 {
  if (jsonData.hasError)
  {
var errors = '';
for(var error in jsonData.errors)
 //IE6 bug fix
 if(error !== 'indexOf')
  errors += jsonData.errors[error] + "\n";
alert(errors);
  }
  else
updateCarrierList(jsonData);
  $('#opc_delivery_methods-overlay').fadeOut('slow');
 }
});
}
function updateCarrierSelectionAndGift()
{
var recyclablePackage = 0;
var gift = 0;
var giftMessage = '';

var delivery_option_radio = $('.delivery_option_radio');
var delivery_option_params = '&';
$.each(delivery_option_radio, function(i) {
 if ($(this).prop('checked'))
  delivery_option_params += $(delivery_option_radio[i]).attr('name') + '=' + $(delivery_option_radio[i]).val() + '&';
});
if (delivery_option_params == '&')
 delivery_option_params = '&delivery_option=&';
if ($('input#recyclable:checked').length)
 recyclablePackage = 1;
if ($('input#gift:checked').length)
{
 gift = 1;
 giftMessage = encodeURIComponent($('#gift_message').val());
}

$('#opc_delivery_methods-overlay, #opc_payment_methods-overlay').fadeOut('slow');
$.ajax({
 type: 'POST',
 headers: { "cache-control": "no-cache" },
 url: orderOpcUrl + '?rand=' + new Date().getTime(),
 async: true,
 cache: false,
 dataType : "json",
 data: 'ajax=true&method=updateCarrierAndGetPayments' + delivery_option_params + 'recyclable=' + recyclablePackage + '&gift=' + gift + '&gift_message=' + giftMessage + '&token=' + static_token ,
 success: function(jsonData)
 {
  if (jsonData.hasError)
  {
var errors = '';
for(var error in jsonData.errors)
 //IE6 bug fix
 if(error !== 'indexOf')
  errors += jsonData.errors[error] + "\n";
alert(errors);
  }
  else
  {
updateCartSummary(jsonData.summary);
updatePaymentMethods(jsonData);
updateHookShoppingCart(jsonData.summary.HOOK_SHOPPING_CART);
updateHookShoppingCartExtra(jsonData.summary.HOOK_SHOPPING_CART_EXTRA);
updateCarrierList(jsonData.carrier_data);
$('#opc_delivery_methods-overlay, #opc_payment_methods-overlay').fadeOut('slow');
refreshDeliveryOptions();
  }
 },
 error: function(XMLHttpRequest, textStatus, errorThrown) {
  if (textStatus !== 'abort')
alert("TECHNICAL ERROR: unable to save carrier \n\nDetails:\nError thrown: " + XMLHttpRequest + "\n" + 'Text status: ' + textStatus);
  $('#opc_delivery_methods-overlay, #opc_payment_methods-overlay').fadeOut('slow');
 }
});
}
function confirmFreeOrder()
{
if ($('#opc_new_account-overlay').length !== 0)
 $('#opc_new_account-overlay').fadeIn('slow');
else
 $('#opc_account-overlay').fadeIn('slow');
$('#opc_delivery_methods-overlay, #opc_payment_methods-overlay').fadeOut('slow');
$('#confirmOrder').attr('disabled', 'disabled');
$.ajax({
 type: 'POST',
 headers: { "cache-control": "no-cache" },
 url: orderOpcUrl + '?rand=' + new Date().getTime(),
 async: true,
 cache: false,
 dataType : "html",
 data: 'ajax=true&method=makeFreeOrder&token=' + static_token ,
 success: function(html)
 {
  $('#confirmOrder').attr('disabled', '');
  var array_split = html.split(':');
  if (array_split[0] == 'freeorder')
  {
if (isGuest)
 document.location.href = guestTrackingUrl+'?id_order='+encodeURIComponent(array_split[1])+'&email='+encodeURIComponent(array_split[2]);
else
 document.location.href = historyUrl;
  }
 },
 error: function(XMLHttpRequest, textStatus, errorThrown) {
  if (textStatus !== 'abort')
alert("TECHNICAL ERROR: unable to confirm the order \n\nDetails:\nError thrown: " + XMLHttpRequest + "\n" + 'Text status: ' + textStatus);
 }
});
}
function saveAddress(type)
{
if (type !== 'delivery' && type !== 'invoice')
 return false;

var params = 'firstname='+encodeURIComponent($('#firstname'+(type == 'invoice' ? '_invoice' : '')).val())+'&lastname='+encodeURIComponent($('#lastname'+(type == 'invoice' ? '_invoice' : '')).val())+'&';
params += 'company='+encodeURIComponent($('#company'+(type == 'invoice' ? '_invoice' : '')).val())+'&';
params += 'vat_number='+encodeURIComponent($('#vat_number'+(type == 'invoice' ? '_invoice' : '')).val())+'&';
params += 'dni='+encodeURIComponent($('#dni'+(type == 'invoice' ? '_invoice' : '')).val())+'&';
params += 'address1='+encodeURIComponent($('#address1'+(type == 'invoice' ? '_invoice' : '')).val())+'&';
params += 'address2='+encodeURIComponent($('#address2'+(type == 'invoice' ? '_invoice' : '')).val())+'&';
params += 'postcode='+encodeURIComponent($('#postcode'+(type == 'invoice' ? '_invoice' : '')).val())+'&';
params += 'city='+encodeURIComponent($('#city'+(type == 'invoice' ? '_invoice' : '')).val())+'&';
params += 'id_country='+encodeURIComponent($('#id_country').val())+'&';
if ($('#id_state'+(type == 'invoice' ? '_invoice' : '')).val())
 params += 'id_state='+encodeURIComponent($('#id_state'+(type == 'invoice' ? '_invoice' : '')).val())+'&';
params += 'other='+encodeURIComponent($('#other'+(type == 'invoice' ? '_invoice' : '')).val())+'&';
params += 'phone='+encodeURIComponent($('#phone'+(type == 'invoice' ? '_invoice' : '')).val())+'&';
params += 'phone_mobile='+encodeURIComponent($('#phone_mobile'+(type == 'invoice' ? '_invoice' : '')).val())+'&';
params += 'alias='+encodeURIComponent($('#alias'+(type == 'invoice' ? '_invoice' : '')).val())+'&';
if (type == 'delivery' && $('#opc_id_address_delivery').val() != undefined && parseInt($('#opc_id_address_delivery').val()) > 0)
 params += 'opc_id_address_delivery='+encodeURIComponent($('#opc_id_address_delivery').val())+'&';
if (type == 'invoice' && $('#opc_id_address_invoice').val() != undefined && parseInt($('#opc_id_address_invoice').val()) > 0)  
 params += 'opc_id_address_invoice='+encodeURIComponent($('#opc_id_address_invoice').val())+'&';
// Clean the last &
params = params.substr(0, params.length-1);
var result = false;

$.ajax({
 type: 'POST',
 headers: { "cache-control": "no-cache" },
 url: addressUrl + '?rand=' + new Date().getTime(),
 async: false,
 cache: false,
 dataType : "json",
 data: 'ajax=true&submitAddress=true&type='+type+'&'+params+'&token=' + static_token,
 success: function(jsonData)
 {
  if (jsonData.hasError)
  {
var tmp = '';
var i = 0;
for(var error in jsonData.errors)
 //IE6 bug fix
 if(error !== 'indexOf')
 {
  i = i+1;
  tmp += '<li>'+jsonData.errors[error]+'</li>';
 }
tmp += '</ol>';
var errors = '<b>'+txtThereis+' '+i+' '+txtErrors+':</b><ol>'+tmp;
$('#opc_account_errors').slideUp('fast', function(){
 $(this).html(errors).slideDown('slow', function(){
  $.scrollTo('#opc_account_errors', 800);
 });
});
$('#opc_account-overlay, #opc_delivery_methods-overlay, #opc_payment_methods-overlay').fadeOut('slow');
result = false;
  }
  else
  {
// update addresses id
$('input#opc_id_address_delivery').val(jsonData.id_address_delivery);
$('input#opc_id_address_invoice').val(jsonData.id_address_invoice);
result = true;
  }
 },
 error: function(XMLHttpRequest, textStatus, errorThrown) {
  if (textStatus !== 'abort')
alert("TECHNICAL ERROR: unable to save adresses \n\nDetails:\nError thrown: " + XMLHttpRequest + "\n" + 'Text status: ' + textStatus);
  $('#opc_account-overlay, #opc_delivery_methods-overlay, #opc_payment_methods-overlay').fadeOut('slow');
 }
 });
return result;
}
function updateNewAccountToAddressBlock()
{
$('#opc_account-overlay, #opc_delivery_methods-overlay, #opc_payment_methods-overlay').fadeOut('slow');;
$.ajax({
 type: 'POST',
 headers: { "cache-control": "no-cache" },
 url: orderOpcUrl + '?rand=' + new Date().getTime(),
 async: true,
 cache: false,
 dataType : "json",
 data: 'ajax=true&method=getAddressBlockAndCarriersAndPayments&token=' + static_token ,
 success: function(json)
 {
  isLogged = 1;
  if (json.no_address == 1)
document.location.href = addressUrl;

  $('#opc_new_account').fadeOut('fast', function() {
$('#opc_new_account').html(json.order_opc_adress);
// update block user info
if (json.block_user_info !== '' && $('#header_user').length == 1)
{
 var elt = $(json.block_user_info).find('#header_user_info').html();	
 $('#header_user_info').fadeOut('nortmal', function() {
  $(this).html(elt).fadeIn();
 });
}
$('#opc_new_account').fadeIn('fast', function() {
 //After login, the products are automatically associated to an address
 $.each(json.summary.products, function() {
  updateAddressId(this.id_product, this.id_product_attribute, '0', this.id_address_delivery);
 });
 updateAddressesDisplay(true);
 updateCarrierList(json.carrier_data);
 updateCarrierSelectionAndGift();
 updatePaymentMethods(json);
 if ($('#gift-price').length == 1)
  $('#gift-price').html(json.gift_price);
 $('#opc_delivery_methods-overlay, #opc_payment_methods-overlay').fadeOut('slow');
});
  });
 },
 error: function(XMLHttpRequest, textStatus, errorThrown) {
  if (textStatus !== 'abort')
alert("TECHNICAL ERROR: unable to send login informations \n\nDetails:\nError thrown: " + XMLHttpRequest + "\n" + 'Text status: ' + textStatus);
  $('#opc_delivery_methods-overlay, #opc_payment_methods-overlay').fadeOut('slow');
 }
});
}
$(function() {
// GUEST CHECKOUT / NEW ACCOUNT MANAGEMENT
if ((!isLogged) || (isGuest))
{
 if (guestCheckoutEnabled && !isLogged)
 {
  $('#opc_account_choice').show();
  $('#opc_account_form, #opc_invoice_address').hide();

  $('#opc_createAccount').click(function() {
$('.is_customer_param').show();
$('#opc_account_form').slideDown('slow');
$('#is_new_customer').val('1');
$('#opc_account_choice, #opc_invoice_address').hide();
updateState();
updateNeedIDNumber();
updateZipCode();
  });
  $('#opc_guestCheckout').click(function() {
$('.is_customer_param').hide();
$('#opc_account_form').slideDown('slow');
$('#is_new_customer').val('0');
$('#opc_account_choice, #opc_invoice_address').hide();
$('#new_account_title').html(txtInstantCheckout);
updateState();
updateNeedIDNumber();
updateZipCode();
  });
 }
 else if (isGuest)
 {
  $('.is_customer_param').hide();
  $('#opc_account_form').show('slow');
  $('#is_new_customer').val('0');
  $('#opc_account_choice, #opc_invoice_address').hide();
  $('#new_account_title').html(txtInstantCheckout);
  updateState();
  updateNeedIDNumber();
  updateZipCode();
 }
 else
 {
  $('#opc_account_choice').hide();
  $('#is_new_customer').val('1');
  $('.is_customer_param, #opc_account_form').show();
  $('#opc_invoice_address').hide();
  updateState();
  updateNeedIDNumber();
  updateZipCode();
 }

 // LOGIN FORM
 $('#openLoginFormBlock').click(function() {
  $('#openNewAccountBlock').show();
  $(this).hide();
  $('#login_form_content').slideDown('slow');
  $('#new_account_form_content').slideUp('slow');
  return false;
 });
 // LOGIN FORM SENDING
 $('#SubmitLogin').click(function() {
  $.ajax({
type: 'POST',
headers: { "cache-control": "no-cache" },
url: authenticationUrl + '?rand=' + new Date().getTime(),
async: false,
cache: false,
dataType : "json",
data: 'SubmitLogin=true&ajax=true&email='+encodeURIComponent($('#login_email').val())+'&passwd='+encodeURIComponent($('#login_passwd').val())+'&token=' + static_token ,
success: function(jsonData)
{
 if (jsonData.hasError)
 {
  var errors = '<b>'+txtThereis+' '+jsonData.errors.length+' '+txtErrors+':</b><ol>';
  for(var error in jsonData.errors)
   //IE6 bug fix
   if(error !== 'indexOf')
	errors += '<li>'+jsonData.errors[error]+'</li>';
  errors += '</ol>';
  $('#opc_login_errors').html(errors).slideDown('slow');
 }
 else
 {
  // update token
  static_token = jsonData.token;
  updateNewAccountToAddressBlock();
 }
},
error: function(XMLHttpRequest, textStatus, errorThrown) {
 if (textStatus !== 'abort')
  alert("TECHNICAL ERROR: unable to send login informations \n\nDetails:\nError thrown: " + XMLHttpRequest + "\n" + 'Text status: ' + textStatus);
}
  });
  return false;
 });

 // INVOICE ADDRESS
 $('#invoice_address').click(function() {
  bindCheckbox();
 });

 // VALIDATION / CREATION AJAX
 $('#submitAccount').click(function() {
  $('#opc_new_account-overlay, #opc_delivery_methods-overlay, #opc_payment_methods-overlay').fadeIn('slow')

  var callingFile = '';
  var params = '';
  if (parseInt($('#opc_id_customer').val()) == 0)
  {
callingFile = authenticationUrl;
params = 'submitAccount=true&';
  }
  else
  {
callingFile = orderOpcUrl;
params = 'method=editCustomer&';
  }
  $('#opc_account_form input:visible, #opc_account_form input[type=hidden]').each(function() {
if ($(this).is('input[type=checkbox]'))
{
 if ($(this).is(':checked'))
  params += encodeURIComponent($(this).attr('name'))+'=1&';
}
else if ($(this).is('input[type=radio]'))
{
 if ($(this).is(':checked'))
  params += encodeURIComponent($(this).attr('name'))+'='+encodeURIComponent($(this).val())+'&';
}
else
 params += encodeURIComponent($(this).attr('name'))+'='+encodeURIComponent($(this).val())+'&';
  });
  $('#opc_account_form select:visible').each(function() {
params += encodeURIComponent($(this).attr('name'))+'='+encodeURIComponent($(this).val())+'&';
  });
  params += 'customer_lastname='+encodeURIComponent($('#customer_lastname').val())+'&';
  params += 'customer_firstname='+encodeURIComponent($('#customer_firstname').val())+'&';
  params += 'alias='+encodeURIComponent($('#alias').val())+'&';
  params += 'other='+encodeURIComponent($('#other').val())+'&';
  params += 'is_new_customer='+encodeURIComponent($('#is_new_customer').val())+'&';
  // Clean the last &
  params = params.substr(0, params.length-1);

  $.ajax({
type: 'POST',
headers: { "cache-control": "no-cache" },
url: callingFile + '?rand=' + new Date().getTime(),
async: false,
cache: false,
dataType : "json",
data: 'ajax=true&'+params+'&token=' + static_token ,
success: function(jsonData)
{
 if (jsonData.hasError)
 {
  var tmp = '';
  var i = 0;
  for(var error in jsonData.errors)
   //IE6 bug fix
   if(error !== 'indexOf')
   {
	i = i+1;
	tmp += '<li>'+jsonData.errors[error]+'</li>';
   }
  tmp += '</ol>';
  var errors = '<b>'+txtThereis+' '+i+' '+txtErrors+':</b><ol>'+tmp;
  $('#opc_account_errors').slideUp('fast', function(){
   $(this).html(errors).slideDown('slow', function(){
	$.scrollTo('#opc_account_errors', 800);
   });	  
  });
 }
 else
 {
  $('#opc_account_errors').slideUp('slow', function(){
   $(this).html('');
  });
 }
 isGuest = parseInt($('#is_new_customer').val()) == 1 ? 0 : 1;
 // update addresses id
 if(jsonData.id_address_delivery !== undefined && jsonData.id_address_delivery > 0)
  $('#opc_id_address_delivery').val(jsonData.id_address_delivery);
 if(jsonData.id_address_invoice !== undefined && jsonData.id_address_invoice > 0)
  $('#opc_id_address_invoice').val(jsonData.id_address_invoice);	

 if (jsonData.id_customer !== undefined && jsonData.id_customer !== 0 && jsonData.isSaved)
 {
  // update token
  static_token = jsonData.token;

  // It's not a new customer
  if ($('#opc_id_customer').val() !== '0')
   if (!saveAddress('delivery'))
	return false;

  // update id_customer
  $('#opc_id_customer').val(jsonData.id_customer);

  if ($('#invoice_address:checked').length !== 0)
  {
   if (!saveAddress('invoice'))
	return false;
  }

  // update id_customer
  $('#opc_id_customer').val(jsonData.id_customer);

  // force to refresh carrier list
  if (isGuest)
  {
   isLogged = 1;
   $('#opc_account_saved').fadeIn('slow');
   $('#submitAccount').hide();
   updateAddressSelection();
  }
  else
   updateNewAccountToAddressBlock();
 }
 $('#opc_new_account-overlay, #opc_delivery_methods-overlay, #opc_payment_methods-overlay').fadeIn('slow');
},
error: function(XMLHttpRequest, textStatus, errorThrown) {
 if (textStatus !== 'abort')
  alert("TECHNICAL ERROR: unable to save account \n\nDetails:\nError thrown: " + XMLHttpRequest + "\n" + 'Text status: ' + textStatus);
 $('#opc_new_account-overlay, #opc_delivery_methods-overlay, #opc_payment_methods-overlay').fadeIn('slow')
}
  });
  return false;
 });
}

bindCheckbox();
bindInputs();

$('#opc_account_form input,select,textarea').change(function() {
 if ($(this).is(':visible'))
 {
  $('#opc_account_saved').fadeOut('slow');
  $('#submitAccount').show();
 }
});

});
function bindCheckbox()
{
if ($('#invoice_address:checked').length > 0)
{
 $('#opc_invoice_address').slideDown('slow');
 if ($('#company_invoice').val() == '')
  $('#vat_number_block_invoice').hide();
 updateState('invoice');
 updateNeedIDNumber('invoice');
 updateZipCode('invoice');
}
else
 $('#opc_invoice_address').slideUp('slow');
}
function bindInputs()
{
// Order message update
$('#message').blur(function() {
 $('#opc_delivery_methods-overlay').fadeIn('slow');
 $.ajax({
  type: 'POST',
  headers: { "cache-control": "no-cache" },
  url: orderOpcUrl + '?rand=' + new Date().getTime(),
  async: false,
  cache: false,
  dataType : "json",
  data: 'ajax=true&method=updateMessage&message=' + encodeURIComponent($('#message').val()) + '&token=' + static_token ,
  success: function(jsonData)
  {
if (jsonData.hasError)
{
 var errors = '';
 for(var error in jsonData.errors)
  //IE6 bug fix
  if(error !== 'indexOf')
   errors += jsonData.errors[error] + "\n";
 alert(errors);
}
  else
$('#opc_delivery_methods-overlay').fadeOut('slow');
  },
  error: function(XMLHttpRequest, textStatus, errorThrown) {
if (textStatus !== 'abort')
 alert("TECHNICAL ERROR: unable to save message \n\nDetails:\nError thrown: " + XMLHttpRequest + "\n" + 'Text status: ' + textStatus);
$('#opc_delivery_methods-overlay').fadeOut('slow');
  }
 });
});

// Recyclable checkbox
$('#recyclable').click(function() {
 updateCarrierSelectionAndGift();
});

// Gift checkbox update
$('#gift').click(function() {
 if ($('#gift').is(':checked'))
  $('#gift_div').show();
 else
  $('#gift_div').hide();
 updateCarrierSelectionAndGift();
});

if ($('#gift').is(':checked'))
 $('#gift_div').show();
else
 $('#gift_div').hide();
// Gift message update
$('#gift_message').change(function() {
 updateCarrierSelectionAndGift();
});

// Term Of Service (TOS)
$('#cgv').click(function() {
 updatePaymentMethodsDisplay();
});
}
function multishippingMode(it)
{
if ($(it).prop('checked'))
{
 $('#address_delivery, .address_delivery').hide();
 $('#address_invoice').removeClass('alternate_item').addClass('item');
 $('#multishipping_mode_box').addClass('on');
 $('.addressesAreEquals').hide();
 $('#address_invoice_form').show();

 $('#link_multishipping_form').click(function() {return false;});
 $('.address_add a').attr('href', addressMultishippingUrl);

 $('#link_multishipping_form').fancybox({
  'transitionIn': 'elastic',
  'transitionOut': 'elastic',
  'type': 'ajax',
  'onClosed': function()
  {
// Reload the cart
$.ajax({
 type: 'POST',
 headers: { "cache-control": "no-cache" },
 url: orderOpcUrl + '?rand=' + new Date().getTime(),
 data: 'ajax=true&method=cartReload',
 dataType : 'html',
 cache: false,
 success: function(data) {
  $('#cart_summary').replaceWith($(data).find('#cart_summary'));
  $('.cart_quantity_input').typeWatch({ highlight: true, wait: 600, captureLength: 0, callback: function(val) { updateQty(val, true, this.el); } });
 }
});
updateCarrierSelectionAndGift();
  },
  'onStart': function()
  {
// Removing all ids on the cart to avoid conflic with the new one on the fancybox
// This action could "break" the cart design, if css rules use ids of the cart
$.each($('#cart_summary *'), function(it, el) {
 $(el).attr('id', '');
});
  },
  'onComplete': function()
  {
$('#fancybox-content .cart_quantity_input').typeWatch({ highlight: true, wait: 600, captureLength: 0, callback: function(val) { updateQty(val, false, this.el);} });
cleanSelectAddressDelivery();
$('#fancybox-content').append($('<div class="multishipping_close_container"><a id="multishipping-close" class="button_large" href="#">' + CloseTxt + '</a></div>'));
$('#multishipping-close').click(function() {
 var newTotalQty = 0;
 $('#fancybox-content .cart_quantity_input').each(function(){
  newTotalQty += parseInt($(this).val());
 });
 if (newTotalQty !== totalQty) {
  if(!confirm(QtyChanged)) {
   return false;
  }
 }
 $.fancybox.close();
 return false;
});
totalQty = 0;
$('#fancybox-content .cart_quantity_input').each(function(){
 totalQty += parseInt($(this).val());
});
  }
 });
}
else
{
 $('#address_delivery, .address_delivery').show();
 $('#address_invoice').removeClass('item').addClass('alternate_item');
 $('#multishipping_mode_box').removeClass('on');
 $('.addressesAreEquals').show();
 if ($('.addressesAreEquals').find('input:checked').length)
  $('#address_invoice_form').hide();
 else
  $('#address_invoice_form').show();
 $('.address_add a').attr('href', addressUrl);

 // Disable multi address shipping
 $.ajax({
  type: 'POST',
  headers: { "cache-control": "no-cache" },  
  url: orderOpcUrl + '?rand=' + new Date().getTime(),
  async: true,
  cache: false,
  data: 'ajax=true&method=noMultiAddressDelivery'
 });

 // Reload the cart
 $.ajax({
  type: 'POST',
  headers: { "cache-control": "no-cache" },  
  url: orderOpcUrl + '?rand=' + new Date().getTime(),
  async: true,
  cache: false,
  data: 'ajax=true&method=cartReload',
  dataType : 'html',
  success: function(data) {
$('#cart_summary').replaceWith($(data).find('#cart_summary'));
  }
 });
}
}
$(document).ready(function() {
// If the multishipping mode is off assure us the checkbox "I want to specify a delivery address for each products I order." is unchecked.
$('#multishipping_mode_checkbox').attr('checked', false);
// If the multishipping mode is on, check the box "I want to specify a delivery address for each products I order.".
if (typeof(multishipping_mode) !== 'undefined' && multishipping_mode)
{
 $('#multishipping_mode_checkbox').click();
 $('.addressesAreEquals').hide().find('input').attr('checked', false);
}
if (typeof(open_multishipping_fancybox) !== 'undefined' && open_multishipping_fancybox)
 $('#link_multishipping_form').click();
});

 

order-opc.tpl

 

{*
* 2007-2013 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to [email protected] so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
*  @author PrestaShop SA <[email protected]>
*  @copyright  2007-2013 PrestaShop SA
*  @license	http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
*  International Registered Trademark & Property of PrestaShop SA
*}
{if $opc}
{assign var="back_order_page" value="order-opc.php"}
{else}
{assign var="back_order_page" value="order.php"}
{/if}
{if $PS_CATALOG_MODE}
{capture name=path}{l s='Your shopping cart'}{/capture}
{include file="$tpl_dir./breadcrumb.tpl"}
<h2 id="cart_title">{l s='Your shopping cart'}</h2>
<p class="warning">{l s='Your new order was not accepted.'}</p>
{else}
<script type="text/javascript">
// <![CDATA[
var imgDir = '{$img_dir}';
var authenticationUrl = '{$link->getPageLink("authentication", true)}';
var orderOpcUrl = '{$link->getPageLink("order-opc", true)}';
var historyUrl = '{$link->getPageLink("history", true)}';
var guestTrackingUrl = '{$link->getPageLink("guest-tracking", true)}';
var addressUrl = '{$link->getPageLink("address", true, NULL, "back={$back_order_page}")}';
var orderProcess = 'order-opc';
var guestCheckoutEnabled = {$PS_GUEST_CHECKOUT_ENABLED|intval};
var currencySign = '{$currencySign|html_entity_decode:2:"UTF-8"}';
var currencyRate = '{$currencyRate|floatval}';
var currencyFormat = '{$currencyFormat|intval}';
var currencyBlank = '{$currencyBlank|intval}';
var displayPrice = {$priceDisplay};
var taxEnabled = {$use_taxes};
var conditionEnabled = {$conditions|intval};
var countries = new Array();
var countriesNeedIDNumber = new Array();
var countriesNeedZipCode = new Array();
var vat_management = {$vat_management|intval};

var txtWithTax = "{l s='(tax incl.)' js=1}";
var txtWithoutTax = "{l s='(tax excl.)' js=1}";
var txtHasBeenSelected = "{l s='has been selected' js=1}";
var txtNoCarrierIsSelected = "{l s='No carrier has been selected' js=1}";
var txtNoCarrierIsNeeded = "{l s='No carrier is needed for this order' js=1}";
var txtConditionsIsNotNeeded = "{l s='You do not need to accept the Terms of Service for this order.' js=1}";
var txtTOSIsAccepted = "{l s='The service terms have been accepted' js=1}";
var txtTOSIsNotAccepted = "{l s='The service terms have not been accepted' js=1}";
var txtThereis = "{l s='There is' js=1}";
var txtErrors = "{l s='Error(s)' js=1}";
var txtDeliveryAddress = "{l s='Delivery address' js=1}";
var txtInvoiceAddress = "{l s='Invoice address' js=1}";
var txtModifyMyAddress = "{l s='Modify my address' js=1}";
var txtInstantCheckout = "{l s='Instant checkout' js=1}";
var txtSelectAnAddressFirst = "{l s='Please start by selecting an address.' js=1}";
var errorCarrier = "{$errorCarrier}";
var errorTOS = "{$errorTOS}";
var checkedCarrier = "{if isset($checked)}{$checked}{else}0{/if}";
var addresses = new Array();
var isLogged = {$isLogged|intval};
var isGuest = {$isGuest|intval};
var isVirtualCart = {$isVirtualCart|intval};
var isPaymentStep = {$isPaymentStep|intval};
//]]>
</script>
{if $productNumber}
 <!-- Shopping Cart -->
 {include file="$tpl_dir./shopping-cart.tpl"}
 <!-- End Shopping Cart -->
 {if $isLogged AND !$isGuest}
  {include file="$tpl_dir./order-address.tpl"}
 {else}
  <!-- Create account / Guest account / Login block -->
  {include file="$tpl_dir./order-opc-new-account.tpl"}
  <!-- END Create account / Guest account / Login block -->
 {/if}
 <!-- Carrier -->
 {include file="$tpl_dir./order-carrier.tpl"}
 <!-- END Carrier -->

 <!-- Payment -->
 {include file="$tpl_dir./order-payment.tpl"}
 <!-- END Payment -->
{else}
 {capture name=path}{l s='Your shopping cart'}{/capture}
 {include file="$tpl_dir./breadcrumb.tpl"}
 <h2>{l s='Your shopping cart'}</h2>
 <p class="warning">{l s='Your shopping cart is empty.'}</p>
{/if}
{/if}

 

order-opc-new-account.tpl

 

<div id="opc_new_account" class="opc-main-block">
<div id="opc_new_account-overlay" class="opc-overlay" style="display: none;"></div>
<h2><span>1</span> {l s='Account'}</h2>
<form action="{$link->getPageLink('authentication', true, NULL, "back=order-opc")}" method="post" id="login_form" class="std">
 <fieldset>
  <h3>{l s='Already registered?'}</h3>
  <p><a href="#" id="openLoginFormBlock">» {l s='Click here'}</a></p>
  <div id="login_form_content" style="display:none;">
<!-- Error return block -->
<div id="opc_login_errors" class="error" style="display:none;"></div>
<!-- END Error return block -->
<div style="margin-left:40px;margin-bottom:5px;float:left;width:40%;">
 <label for="login_email">{l s='Email address'}</label>
 <span><input type="text" id="login_email" name="email" /></span>
</div>
<div style="margin-left:40px;margin-bottom:5px;float:left;width:40%;">
 <label for="login_passwd">{l s='Password'}</label>
 <span><input type="password" id="login_passwd" name="login_passwd" /></span>
 <a href="{$link->getPageLink('password', true)}" class="lost_password">{l s='Forgot your password?'}</a>
</div>
<p class="submit">
 {if isset($back)}<input type="hidden" class="hidden" name="back" value="{$back|escape:'htmlall':'UTF-8'}" />{/if}
 <input type="submit" id="SubmitLogin" name="SubmitLogin" class="button" value="{l s='Login'}" />
</p>
  </div>
 </fieldset>
</form>
<form action="javascript:;" method="post" id="new_account_form" class="std" autocomplete="on" autofill="on">
 <fieldset>
  <h3 id="new_account_title">{l s='New Customer'}</h3>
  <div id="opc_account_choice">
<div class="opc_float">
 <p class="title_block">{l s='Instant Checkout'}</p>
 <p>
  <input type="button" class="exclusive_large" id="opc_guestCheckout" value="{l s='Guest checkout'}" />
 </p>
</div>
<div class="opc_float">
 <p class="title_block">{l s='Create your account today and enjoy:'}</p>
 <ul class="bullet">
  <li>{l s='Personalized and secure access'}</li>
  <li>{l s='A fast and easy check out process'}</li>
  <li>{l s='Separate billing and shipping addresses'}</li>
 </ul>
 <p>
  <input type="button" class="button_large" id="opc_createAccount" value="{l s='Create an account'}" />
 </p>
</div>
<div class="clear"></div>
  </div>
  <div id="opc_account_form">
{$HOOK_CREATE_ACCOUNT_TOP}
<script type="text/javascript">
// <![CDATA[
idSelectedCountry = {if isset($guestInformations) && $guestInformations.id_state}{$guestInformations.id_state|intval}{else}false{/if};
{if isset($countries)}
 {foreach from=$countries item='country'}
  {if isset($country.states) && $country.contains_states}
   countries[{$country.id_country|intval}] = new Array();
   {foreach from=$country.states item='state' name='states'}
	countries[{$country.id_country|intval}].push({ldelim}'id' : '{$state.id_state}', 'name' : '{$state.name|escape:'htmlall':'UTF-8'}'{rdelim});
   {/foreach}
  {/if}
  {if $country.need_identification_number}
   countriesNeedIDNumber.push({$country.id_country|intval});
  {/if}
  {if isset($country.need_zip_code)}
   countriesNeedZipCode[{$country.id_country|intval}] = {$country.need_zip_code};
  {/if}
 {/foreach}
{/if}
//]]>
{literal}
function vat_number()
{
 if ($('#company').val() != '')
  $('#vat_number_block').show();
 else
  $('#vat_number_block').hide();
}
function vat_number_invoice()
{
 if ($('#company_invoice').val() != '')
  $('#vat_number_block_invoice').show();
 else
  $('#vat_number_block_invoice').hide();
}

$(document).ready(function() {
 $('#company').blur(function(){
  vat_number();
 });
 $('#company_invoice').blur(function(){
  vat_number_invoice();
 });
 vat_number();
 vat_number_invoice();
});
{/literal}
</script>
<!-- Error return block -->
<div id="opc_account_errors" class="error" style="display:none;"></div>
<!-- END Error return block -->
<!-- Account -->
<input type="hidden" id="is_new_customer" name="is_new_customer" value="0" />
<input type="hidden" id="opc_id_customer" name="opc_id_customer" value="{if isset($guestInformations) && $guestInformations.id_customer}{$guestInformations.id_customer}{else}0{/if}" />
<input type="hidden" id="opc_id_address_delivery" name="opc_id_address_delivery" value="{if isset($guestInformations) && $guestInformations.id_address_delivery}{$guestInformations.id_address_delivery}{else}0{/if}" />
<input type="hidden" id="opc_id_address_invoice" name="opc_id_address_invoice" value="{if isset($guestInformations) && $guestInformations.id_address_delivery}{$guestInformations.id_address_delivery}{else}0{/if}" />
<p class="required text">
 <label for="email">{l s='Email'} <sup>*</sup></label>
 <input type="text" class="text" id="email" name="email" value="{if isset($guestInformations) && $guestInformations.email}{$guestInformations.email}{/if}" />
</p>
<p class="required password is_customer_param">
 <label for="passwd">{l s='Password'} <sup>*</sup></label>
 <input type="password" class="text" name="passwd" id="passwd" />
 <span class="form_info">{l s='(five characters min.)'}</span>
</p>
<p class="radio required">
 <span>{l s='Title'}</span>
 {foreach from=$genders key=k item=gender}
  <input type="radio" name="id_gender" id="id_gender{$gender->id_gender}" value="{$gender->id_gender}" {if isset($smarty.post.id_gender) && $smarty.post.id_gender == $gender->id_gender}checked="checked"{/if} />
  <label for="id_gender{$gender->id_gender}" class="top">{$gender->name}</label>
 {/foreach}
</p>
<p class="required text">
 <label for="firstname">{l s='First name'} <sup>*</sup></label>
 <input type="text" class="text" id="customer_firstname" name="customer_firstname" onblur="$('#firstname').val($(this).val());" value="{if isset($guestInformations) && $guestInformations.customer_firstname}{$guestInformations.customer_firstname}{/if}" />
</p>
<p class="required text">
 <label for="lastname">{l s='Last name'} <sup>*</sup></label>
 <input type="text" class="text" id="customer_lastname" name="customer_lastname" onblur="$('#lastname').val($(this).val());" value="{if isset($guestInformations) && $guestInformations.customer_lastname}{$guestInformations.customer_lastname}{/if}" />
</p>
<p class="select">
 <span>{l s='Date of Birth'}</span>
 <select id="days" name="days">
  <option value="">-</option>
  {foreach from=$days item=day}
   <option value="{$day|escape:'htmlall':'UTF-8'}" {if isset($guestInformations) && ($guestInformations.sl_day == $day)} selected="selected"{/if}>{$day|escape:'htmlall':'UTF-8'}  </option>
  {/foreach}
 </select>
 {*
  {l s='January'}
  {l s='February'}
  {l s='March'}
  {l s='April'}
  {l s='May'}
  {l s='June'}
  {l s='July'}
  {l s='August'}
  {l s='September'}
  {l s='October'}
  {l s='November'}
  {l s='December'}
 *}
 <select id="months" name="months">
  <option value="">-</option>
  {foreach from=$months key=k item=month}
   <option value="{$k|escape:'htmlall':'UTF-8'}" {if isset($guestInformations) && ($guestInformations.sl_month == $k)} selected="selected"{/if}>{l s=$month} </option>
  {/foreach}
 </select>
 <select id="years" name="years">
  <option value="">-</option>
  {foreach from=$years item=year}
   <option value="{$year|escape:'htmlall':'UTF-8'}" {if isset($guestInformations) && ($guestInformations.sl_year == $year)} selected="selected"{/if}>{$year|escape:'htmlall':'UTF-8'}  </option>
  {/foreach}
 </select>
</p>
{if isset($newsletter) && $newsletter}
<p class="checkbox">
 <input type="checkbox" name="newsletter" id="newsletter" value="1" {if isset($guestInformations) && $guestInformations.newsletter}checked="checked"{/if} />
 <label for="newsletter">{l s='Sign up for our newsletter!'}</label>
</p>
<p class="checkbox" >
 <input type="checkbox"name="optin" id="optin" value="1" {if isset($guestInformations) && $guestInformations.optin}checked="checked"{/if} />
 <label for="optin">{l s='Receive special offers from our partners!'}</label>
</p>
{/if}
<h3>{l s='Delivery address'}</h3>
{$stateExist = false}
{foreach from=$dlv_all_fields item=field_name}
{if $field_name eq "company"}
<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>
{elseif $field_name eq "firstname"}
<p class="required text">
 <label for="firstname">{l s='First name'} <sup>*</sup></label>
 <input type="text" class="text" id="firstname" name="firstname" value="{if isset($guestInformations) && $guestInformations.firstname}{$guestInformations.firstname}{/if}" />
</p>
{elseif $field_name eq "lastname"}
<p class="required text">
 <label for="lastname">{l s='Last name'} <sup>*</sup></label>
 <input type="text" class="text" id="lastname" name="lastname" value="{if isset($guestInformations) && $guestInformations.lastname}{$guestInformations.lastname}{/if}" />
</p>
{elseif $field_name eq "address1"}
<p class="required text">
 <label for="address1">{l s='Address'} <sup>*</sup></label>
 <input type="text" class="text" name="address1" id="address1" value="{if isset($guestInformations) && $guestInformations.address1}{$guestInformations.address1}{/if}" />
</p>
{elseif $field_name eq "address2"}
<p class="text is_customer_param">
 <label for="address2">{l s='Address (Line 2)'}</label>
 <input type="text" class="text" name="address2" id="address2" value="" />
</p>
{elseif $field_name eq "postcode"}
<p class="required postcode text">
 <label for="postcode">{l s='Zip / Postal code'} <sup>*</sup></label>
 <input type="text" class="text" name="postcode" id="postcode" value="{if isset($guestInformations) && $guestInformations.postcode}{$guestInformations.postcode}{/if}" onkeyup="$('#postcode').val($('#postcode').val().toUpperCase());" />
</p>
{elseif $field_name eq "city"}
<p class="required text">
 <label for="city">{l s='City'} <sup>*</sup></label>
 <input type="text" class="text" name="city" id="city" value="{if isset($guestInformations) && $guestInformations.city}{$guestInformations.city}{/if}" />

</p>
{elseif $field_name eq "country" || $field_name eq "Country:name"}
<p class="required select">
 <label for="id_country">{l s='Country'} <sup>*</sup></label>
 <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>
  {/foreach}
 </select>
</p>
{elseif $field_name eq "vat_number"}
<div id="vat_number_block" style="display:none;">
 <p class="text">
  <label for="vat_number">{l s='VAT number'}</label>
  <input type="text" class="text" name="vat_number" id="vat_number" value="{if isset($guestInformations) && $guestInformations.vat_number}{$guestInformations.vat_number}{/if}" />
 </p>
</div>
{elseif $field_name eq "state" || $field_name eq 'State:name'}
{$stateExist = true}
<p class="required id_state select" style="display:none;">
 <label for="id_state">{l s='State'} <sup>*</sup></label>
 <select name="id_state" id="id_state">
  <option value="">-</option>
 </select>
</p>
{/if}
{/foreach}
<p class="required text dni">
 <label for="dni">{l s='Identification number'}</label>
 <input type="text" class="text" name="dni" id="dni" value="{if isset($guestInformations) && $guestInformations.dni}{$guestInformations.dni}{/if}" />
 <span class="form_info">{l s='DNI / NIF / NIE'}</span>
</p>
{if !$stateExist}
<p class="required id_state select">
 <label for="id_state">{l s='State'} <sup>*</sup></label>
 <select name="id_state" id="id_state">
  <option value="">-</option>
 </select>
</p>
{/if}
<p class="textarea is_customer_param">
 <label for="other">{l s='Additional information'}</label>
 <textarea name="other" id="other" cols="26" rows="3"></textarea>
</p>
{if isset($one_phone_at_least) && $one_phone_at_least}
 <p class="inline-infos required is_customer_param">{l s='You must register at least one phone number.'}</p>
{/if}	  
<p class="text is_customer_param">
 <label for="phone">{l s='Home phone'}</label>
 <input type="text" class="text" name="phone" id="phone" value="{if isset($guestInformations) && $guestInformations.phone}{$guestInformations.phone}{/if}" />
</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="" />
</p>
<input type="hidden" name="alias" id="alias" value="{l s='My address'}" />
<p class="checkbox is_customer_param">
 <input type="checkbox" name="invoice_address" id="invoice_address" />
 <label for="invoice_address"><b>{l s='Please use another address for invoice'}</b></label>
</p>
<div id="opc_invoice_address" class="is_customer_param">
 {assign var=stateExist value=false}
 <h3>{l s='Invoice address'}</h3>
 {foreach from=$inv_all_fields item=field_name}
 {if $field_name eq "company"}
 <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="" />
 </p>
 {elseif $field_name eq "vat_number"}
 <div id="vat_number_block_invoice" class="is_customer_param" style="display:none;">
  <p class="text">
   <label for="vat_number_invoice">{l s='VAT number'}</label>
   <input type="text" class="text" id="vat_number_invoice" name="vat_number_invoice" value="" />
  </p>
 </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}" />
  <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="" />
 </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="" />
 </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="" />
 </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="" />
 </p>
 {elseif $field_name eq "postcode"}
 <p class="required postcode 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());" />
 </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="" />
 </p>
 {elseif $field_name eq "country" || $field_name eq "Country:name"}
 <p class="required select">
  <label for="id_country_invoice">{l s='Country'} <sup>*</sup></label>
  <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>
   {/foreach}
  </select>
 </p>
 {elseif $field_name eq "state" || $field_name eq 'State:name'}
 {$stateExist = true}
 <p class="required id_state_invoice select" style="display:none;">
  <label for="id_state_invoice">{l s='State'} <sup>*</sup></label>
  <select name="id_state_invoice" id="id_state_invoice">
   <option value="">-</option>
  </select>
 </p>
 {/if}
 {/foreach}
 {if !$stateExist}
 <p class="required id_state_invoice select" style="display:none;">
  <label for="id_state_invoice">{l s='State'} <sup>*</sup></label>
  <select name="id_state_invoice" id="id_state_invoice">
   <option value="">-</option>
  </select>
 </p>
 {/if}
 <p class="textarea is_customer_param">
  <label for="other_invoice">{l s='Additional information'}</label>
  <textarea name="other_invoice" id="other_invoice" cols="26" rows="3"></textarea>
 </p>
 {if isset($one_phone_at_least) && $one_phone_at_least}
  <p class="inline-infos required">{l s='You must register at least one phone number.'}</p>
 {/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="" />
 </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="" />
 </p>
 <input type="hidden" name="alias_invoice" id="alias_invoice" value="{l s='My Invoice address'}" />
</div>
{$HOOK_CREATE_ACCOUNT_FORM}
<p class="submit">
 <input type="submit" class="exclusive button" name="submitAccount" id="submitAccount" value="{l s='Save'}" />
</p>
<p style="display: none;" id="opc_account_saved">
 {l s='Account information saved successfully'}
</p>
<p class="required opc-required" style="clear: both;">
 <sup>*</sup>{l s='Required field'}
</p>
<!-- END Account -->
  </div>
 </fieldset>
</form>
<div class="clear"></div>
</div>

OrderOpcController.php

Link to comment
Share on other sites

×
×
  • Create New...