[-] FO : Fix #PSCFV-5544 same alias is no more rejected in OPC
This commit is contained in:
@@ -174,16 +174,21 @@ class AddressControllerCore extends FrontController
|
|||||||
$address->dni = null;
|
$address->dni = null;
|
||||||
}
|
}
|
||||||
// Check if the alias exists
|
// Check if the alias exists
|
||||||
if (!$this->context->customer->is_guest && !empty($_POST['alias'])
|
if (!$this->context->customer->is_guest && !empty($_POST['alias']) && (int)$this->context->customer->id > 0)
|
||||||
&& (int)$this->context->customer->id > 0
|
{
|
||||||
&& Db::getInstance()->getValue('
|
$id_address = Tools::getValue('id_address');
|
||||||
|
if(Configuration::get('PS_ORDER_PROCESS_TYPE') && (int)Tools::getValue('opc_id_address_'.Tools::getValue('type')) > 0)
|
||||||
|
$id_address = Tools::getValue('opc_id_address_'.Tools::getValue('type'));
|
||||||
|
|
||||||
|
if (Db::getInstance()->getValue('
|
||||||
SELECT count(*)
|
SELECT count(*)
|
||||||
FROM '._DB_PREFIX_.'address
|
FROM '._DB_PREFIX_.'address
|
||||||
WHERE `alias` = \''.pSql($_POST['alias']).'\'
|
WHERE `alias` = \''.pSql($_POST['alias']).'\'
|
||||||
AND id_address != '.(int)Tools::getValue('id_address').'
|
AND id_address != '.(int)$id_address.'
|
||||||
AND id_customer = '.(int)$this->context->customer->id.'
|
AND id_customer = '.(int)$this->context->customer->id.'
|
||||||
AND deleted = 0') > 0)
|
AND deleted = 0') > 0)
|
||||||
$this->errors[] = sprintf(Tools::displayError('The alias "%s" is already used, please chose another one.'), Tools::safeOutput($_POST['alias']));
|
$this->errors[] = sprintf(Tools::displayError('The alias "%s" is already used, please chose another one.'), Tools::safeOutput($_POST['alias']));
|
||||||
|
}
|
||||||
|
|
||||||
// Check the requires fields which are settings in the BO
|
// Check the requires fields which are settings in the BO
|
||||||
$this->errors = array_merge($this->errors, $address->validateFieldsRequiredDatabase());
|
$this->errors = array_merge($this->errors, $address->validateFieldsRequiredDatabase());
|
||||||
|
|||||||
@@ -400,7 +400,6 @@ class AuthControllerCore extends FrontController
|
|||||||
|
|
||||||
if (!Configuration::get('PS_REGISTRATION_PROCESS_TYPE') && !$this->ajax && !Tools::isSubmit('submitGuestAccount'))
|
if (!Configuration::get('PS_REGISTRATION_PROCESS_TYPE') && !$this->ajax && !Tools::isSubmit('submitGuestAccount'))
|
||||||
{
|
{
|
||||||
|
|
||||||
if (!count($this->errors))
|
if (!count($this->errors))
|
||||||
{
|
{
|
||||||
if (Tools::isSubmit('newsletter'))
|
if (Tools::isSubmit('newsletter'))
|
||||||
|
|||||||
@@ -92,19 +92,22 @@ function updateAddressSelection()
|
|||||||
$(this).find('[name='+name+']').attr('name', name.replace(/_\d+_hidden$/, '_'+idAddress_delivery+'_hidden'));
|
$(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) {
|
if ($(this).find('.cart_quantity_delete').length > 0 && $(this).find('.cart_quantity_delete').attr('id').length > 0)
|
||||||
|
{
|
||||||
$(this).find('.cart_quantity_delete')
|
$(this).find('.cart_quantity_delete')
|
||||||
.attr('id', $(this).find('.cart_quantity_delete').attr('id').replace(/_\d+$/, '_'+idAddress_delivery))
|
.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+'&'));
|
.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) {
|
if ($(this).find('.cart_quantity_down').length > 0 && $(this).find('.cart_quantity_down').attr('id').length > 0)
|
||||||
|
{
|
||||||
$(this).find('.cart_quantity_down')
|
$(this).find('.cart_quantity_down')
|
||||||
.attr('id', $(this).find('.cart_quantity_down').attr('id').replace(/_\d+$/, '_'+idAddress_delivery))
|
.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+'&'));
|
.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) {
|
if ($(this).find('.cart_quantity_up').length > 0 && $(this).find('.cart_quantity_up').attr('id').length > 0)
|
||||||
|
{
|
||||||
$(this).find('.cart_quantity_up')
|
$(this).find('.cart_quantity_up')
|
||||||
.attr('id', $(this).find('.cart_quantity_up').attr('id').replace(/_\d+$/, '_'+idAddress_delivery))
|
.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+'&'));
|
.attr('href', $(this).find('.cart_quantity_up').attr('href').replace(/id_address_delivery=\d+&/, 'id_address_delivery='+idAddress_delivery+'&'));
|
||||||
@@ -122,17 +125,13 @@ function updateAddressSelection()
|
|||||||
updateHookShoppingCartExtra(jsonData.HOOK_SHOPPING_CART_EXTRA);
|
updateHookShoppingCartExtra(jsonData.HOOK_SHOPPING_CART_EXTRA);
|
||||||
if ($('#gift-price').length === 1)
|
if ($('#gift-price').length === 1)
|
||||||
$('#gift-price').html(jsonData.gift_price);
|
$('#gift-price').html(jsonData.gift_price);
|
||||||
$('#opc_account-overlay').fadeOut('slow');
|
$('#opc_account-overlay, #opc_delivery_methods-overlay, #opc_payment_methods-overlay').fadeOut('slow');
|
||||||
$('#opc_delivery_methods-overlay').fadeOut('slow');
|
|
||||||
$('#opc_payment_methods-overlay').fadeOut('slow');
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
error: function(XMLHttpRequest, textStatus, errorThrown) {
|
error: function(XMLHttpRequest, textStatus, errorThrown) {
|
||||||
if (textStatus !== 'abort')
|
if (textStatus !== 'abort')
|
||||||
alert("TECHNICAL ERROR: unable to save adresses \n\nDetails:\nError thrown: " + XMLHttpRequest + "\n" + 'Text status: ' + textStatus);
|
alert("TECHNICAL ERROR: unable to save adresses \n\nDetails:\nError thrown: " + XMLHttpRequest + "\n" + 'Text status: ' + textStatus);
|
||||||
$('#opc_account-overlay').fadeOut('slow');
|
$('#opc_account-overlay, #opc_delivery_methods-overlay, #opc_payment_methods-overlay').fadeOut('slow');
|
||||||
$('#opc_delivery_methods-overlay').fadeOut('slow');
|
|
||||||
$('#opc_payment_methods-overlay').fadeOut('slow');
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -188,8 +187,7 @@ function updateCarrierSelectionAndGift()
|
|||||||
giftMessage = encodeURIComponent($('#gift_message').val());
|
giftMessage = encodeURIComponent($('#gift_message').val());
|
||||||
}
|
}
|
||||||
|
|
||||||
$('#opc_payment_methods-overlay').fadeIn('slow');
|
$('#opc_delivery_methods-overlay, #opc_payment_methods-overlay').fadeOut('slow');
|
||||||
$('#opc_delivery_methods-overlay').fadeIn('slow');
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: 'POST',
|
type: 'POST',
|
||||||
url: orderOpcUrl,
|
url: orderOpcUrl,
|
||||||
@@ -215,16 +213,14 @@ function updateCarrierSelectionAndGift()
|
|||||||
updateHookShoppingCart(jsonData.summary.HOOK_SHOPPING_CART);
|
updateHookShoppingCart(jsonData.summary.HOOK_SHOPPING_CART);
|
||||||
updateHookShoppingCartExtra(jsonData.summary.HOOK_SHOPPING_CART_EXTRA);
|
updateHookShoppingCartExtra(jsonData.summary.HOOK_SHOPPING_CART_EXTRA);
|
||||||
updateCarrierList(jsonData.carrier_data);
|
updateCarrierList(jsonData.carrier_data);
|
||||||
$('#opc_payment_methods-overlay').fadeOut('slow');
|
$('#opc_delivery_methods-overlay, #opc_payment_methods-overlay').fadeOut('slow');
|
||||||
$('#opc_delivery_methods-overlay').fadeOut('slow');
|
|
||||||
refreshDeliveryOptions();
|
refreshDeliveryOptions();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
error: function(XMLHttpRequest, textStatus, errorThrown) {
|
error: function(XMLHttpRequest, textStatus, errorThrown) {
|
||||||
if (textStatus !== 'abort')
|
if (textStatus !== 'abort')
|
||||||
alert("TECHNICAL ERROR: unable to save carrier \n\nDetails:\nError thrown: " + XMLHttpRequest + "\n" + 'Text status: ' + textStatus);
|
alert("TECHNICAL ERROR: unable to save carrier \n\nDetails:\nError thrown: " + XMLHttpRequest + "\n" + 'Text status: ' + textStatus);
|
||||||
$('#opc_payment_methods-overlay').fadeOut('slow');
|
$('#opc_delivery_methods-overlay, #opc_payment_methods-overlay').fadeOut('slow');
|
||||||
$('#opc_delivery_methods-overlay').fadeOut('slow');
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -235,8 +231,7 @@ function confirmFreeOrder()
|
|||||||
$('#opc_new_account-overlay').fadeIn('slow');
|
$('#opc_new_account-overlay').fadeIn('slow');
|
||||||
else
|
else
|
||||||
$('#opc_account-overlay').fadeIn('slow');
|
$('#opc_account-overlay').fadeIn('slow');
|
||||||
$('#opc_delivery_methods-overlay').fadeIn('slow');
|
$('#opc_delivery_methods-overlay, #opc_payment_methods-overlay').fadeOut('slow');
|
||||||
$('#opc_payment_methods-overlay').fadeIn('slow');
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: 'POST',
|
type: 'POST',
|
||||||
url: orderOpcUrl,
|
url: orderOpcUrl,
|
||||||
@@ -277,13 +272,15 @@ function saveAddress(type)
|
|||||||
params += 'city='+encodeURIComponent($('#city'+(type === 'invoice' ? '_invoice' : '')).val())+'&';
|
params += 'city='+encodeURIComponent($('#city'+(type === 'invoice' ? '_invoice' : '')).val())+'&';
|
||||||
params += 'id_country='+encodeURIComponent($('#id_country').val())+'&';
|
params += 'id_country='+encodeURIComponent($('#id_country').val())+'&';
|
||||||
if ($('#id_state'+(type === 'invoice' ? '_invoice' : '')).val())
|
if ($('#id_state'+(type === 'invoice' ? '_invoice' : '')).val())
|
||||||
{
|
params += 'id_state='+encodeURIComponent($('#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 += 'other='+encodeURIComponent($('#other'+(type === 'invoice' ? '_invoice' : '')).val())+'&';
|
||||||
params += 'phone='+encodeURIComponent($('#phone'+(type === 'invoice' ? '_invoice' : '')).val())+'&';
|
params += 'phone='+encodeURIComponent($('#phone'+(type === 'invoice' ? '_invoice' : '')).val())+'&';
|
||||||
params += 'phone_mobile='+encodeURIComponent($('#phone_mobile'+(type === 'invoice' ? '_invoice' : '')).val())+'&';
|
params += 'phone_mobile='+encodeURIComponent($('#phone_mobile'+(type === 'invoice' ? '_invoice' : '')).val())+'&';
|
||||||
params += 'alias='+encodeURIComponent($('#alias'+(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 &
|
// Clean the last &
|
||||||
params = params.substr(0, params.length-1);
|
params = params.substr(0, params.length-1);
|
||||||
|
|
||||||
@@ -311,11 +308,12 @@ function saveAddress(type)
|
|||||||
}
|
}
|
||||||
tmp += '</ol>';
|
tmp += '</ol>';
|
||||||
var errors = '<b>'+txtThereis+' '+i+' '+txtErrors+':</b><ol>'+tmp;
|
var errors = '<b>'+txtThereis+' '+i+' '+txtErrors+':</b><ol>'+tmp;
|
||||||
$('#opc_account_errors').html(errors).slideDown('slow');
|
$('#opc_account_errors').slideUp('fast', function(){
|
||||||
$.scrollTo('#opc_account_errors', 800);
|
$(this).html(errors).slideDown('slow', function(){
|
||||||
$('#opc_new_account-overlay').fadeOut('slow');
|
$.scrollTo('#opc_account_errors', 800);
|
||||||
$('#opc_delivery_methods-overlay').fadeOut('slow');
|
});
|
||||||
$('#opc_payment_methods-overlay').fadeOut('slow');
|
});
|
||||||
|
$('#opc_account-overlay, #opc_delivery_methods-overlay, #opc_payment_methods-overlay').fadeOut('slow');
|
||||||
result = false;
|
result = false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -329,9 +327,7 @@ function saveAddress(type)
|
|||||||
error: function(XMLHttpRequest, textStatus, errorThrown) {
|
error: function(XMLHttpRequest, textStatus, errorThrown) {
|
||||||
if (textStatus !== 'abort')
|
if (textStatus !== 'abort')
|
||||||
alert("TECHNICAL ERROR: unable to save adresses \n\nDetails:\nError thrown: " + XMLHttpRequest + "\n" + 'Text status: ' + textStatus);
|
alert("TECHNICAL ERROR: unable to save adresses \n\nDetails:\nError thrown: " + XMLHttpRequest + "\n" + 'Text status: ' + textStatus);
|
||||||
$('#opc_new_account-overlay').fadeOut('slow');
|
$('#opc_account-overlay, #opc_delivery_methods-overlay, #opc_payment_methods-overlay').fadeOut('slow');
|
||||||
$('#opc_delivery_methods-overlay').fadeOut('slow');
|
|
||||||
$('#opc_payment_methods-overlay').fadeOut('slow');
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -340,9 +336,7 @@ function saveAddress(type)
|
|||||||
|
|
||||||
function updateNewAccountToAddressBlock()
|
function updateNewAccountToAddressBlock()
|
||||||
{
|
{
|
||||||
$('#opc_new_account-overlay').fadeIn('slow');
|
$('#opc_account-overlay, #opc_delivery_methods-overlay, #opc_payment_methods-overlay').fadeOut('slow');;
|
||||||
$('#opc_delivery_methods-overlay').fadeIn('slow');
|
|
||||||
$('#opc_payment_methods-overlay').fadeIn('slow');
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: 'POST',
|
type: 'POST',
|
||||||
url: orderOpcUrl,
|
url: orderOpcUrl,
|
||||||
@@ -379,16 +373,14 @@ function updateNewAccountToAddressBlock()
|
|||||||
updatePaymentMethods(json);
|
updatePaymentMethods(json);
|
||||||
if ($('#gift-price').length === 1)
|
if ($('#gift-price').length === 1)
|
||||||
$('#gift-price').html(json.gift_price);
|
$('#gift-price').html(json.gift_price);
|
||||||
$('#opc_delivery_methods-overlay').fadeOut('slow');
|
$('#opc_delivery_methods-overlay, #opc_payment_methods-overlay').fadeOut('slow');
|
||||||
$('#opc_payment_methods-overlay').fadeOut('slow');
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
error: function(XMLHttpRequest, textStatus, errorThrown) {
|
error: function(XMLHttpRequest, textStatus, errorThrown) {
|
||||||
if (textStatus !== 'abort')
|
if (textStatus !== 'abort')
|
||||||
alert("TECHNICAL ERROR: unable to send login informations \n\nDetails:\nError thrown: " + XMLHttpRequest + "\n" + 'Text status: ' + textStatus);
|
alert("TECHNICAL ERROR: unable to send login informations \n\nDetails:\nError thrown: " + XMLHttpRequest + "\n" + 'Text status: ' + textStatus);
|
||||||
$('#opc_delivery_methods-overlay').fadeOut('slow');
|
$('#opc_delivery_methods-overlay, #opc_payment_methods-overlay').fadeOut('slow');
|
||||||
$('#opc_payment_methods-overlay').fadeOut('slow');
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -400,15 +392,13 @@ $(function() {
|
|||||||
if (guestCheckoutEnabled && !isLogged)
|
if (guestCheckoutEnabled && !isLogged)
|
||||||
{
|
{
|
||||||
$('#opc_account_choice').show();
|
$('#opc_account_choice').show();
|
||||||
$('#opc_account_form').hide();
|
$('#opc_account_form, #opc_invoice_address').hide();
|
||||||
$('#opc_invoice_address').hide();
|
|
||||||
|
|
||||||
$('#opc_createAccount').click(function() {
|
$('#opc_createAccount').click(function() {
|
||||||
$('.is_customer_param').show();
|
$('.is_customer_param').show();
|
||||||
$('#opc_account_form').slideDown('slow');
|
$('#opc_account_form').slideDown('slow');
|
||||||
$('#is_new_customer').val('1');
|
$('#is_new_customer').val('1');
|
||||||
$('#opc_account_choice').hide();
|
$('#opc_account_choice, #opc_invoice_address').hide();
|
||||||
$('#opc_invoice_address').hide();
|
|
||||||
updateState();
|
updateState();
|
||||||
updateNeedIDNumber();
|
updateNeedIDNumber();
|
||||||
updateZipCode();
|
updateZipCode();
|
||||||
@@ -417,8 +407,7 @@ $(function() {
|
|||||||
$('.is_customer_param').hide();
|
$('.is_customer_param').hide();
|
||||||
$('#opc_account_form').slideDown('slow');
|
$('#opc_account_form').slideDown('slow');
|
||||||
$('#is_new_customer').val('0');
|
$('#is_new_customer').val('0');
|
||||||
$('#opc_account_choice').hide();
|
$('#opc_account_choice, #opc_invoice_address').hide();
|
||||||
$('#opc_invoice_address').hide();
|
|
||||||
$('#new_account_title').html(txtInstantCheckout);
|
$('#new_account_title').html(txtInstantCheckout);
|
||||||
updateState();
|
updateState();
|
||||||
updateNeedIDNumber();
|
updateNeedIDNumber();
|
||||||
@@ -430,8 +419,7 @@ $(function() {
|
|||||||
$('.is_customer_param').hide();
|
$('.is_customer_param').hide();
|
||||||
$('#opc_account_form').show('slow');
|
$('#opc_account_form').show('slow');
|
||||||
$('#is_new_customer').val('0');
|
$('#is_new_customer').val('0');
|
||||||
$('#opc_account_choice').hide();
|
$('#opc_account_choice, #opc_invoice_address').hide();
|
||||||
$('#opc_invoice_address').hide();
|
|
||||||
$('#new_account_title').html(txtInstantCheckout);
|
$('#new_account_title').html(txtInstantCheckout);
|
||||||
updateState();
|
updateState();
|
||||||
updateNeedIDNumber();
|
updateNeedIDNumber();
|
||||||
@@ -441,8 +429,7 @@ $(function() {
|
|||||||
{
|
{
|
||||||
$('#opc_account_choice').hide();
|
$('#opc_account_choice').hide();
|
||||||
$('#is_new_customer').val('1');
|
$('#is_new_customer').val('1');
|
||||||
$('.is_customer_param').show();
|
$('.is_customer_param, #opc_account_form').show();
|
||||||
$('#opc_account_form').show();
|
|
||||||
$('#opc_invoice_address').hide();
|
$('#opc_invoice_address').hide();
|
||||||
updateState();
|
updateState();
|
||||||
updateNeedIDNumber();
|
updateNeedIDNumber();
|
||||||
@@ -510,13 +497,8 @@ $(function() {
|
|||||||
|
|
||||||
// VALIDATION / CREATION AJAX
|
// VALIDATION / CREATION AJAX
|
||||||
$('#submitAccount').click(function() {
|
$('#submitAccount').click(function() {
|
||||||
$('#opc_new_account-overlay').fadeIn('slow');
|
$('#opc_new_account-overlay, #opc_delivery_methods-overlay, #opc_payment_methods-overlay').fadeIn('slow')
|
||||||
$('#opc_delivery_methods-overlay').fadeIn('slow');
|
|
||||||
$('#opc_payment_methods-overlay').fadeIn('slow');
|
|
||||||
|
|
||||||
// RESET ERROR(S) MESSAGE(S)
|
|
||||||
$('#opc_account_errors').html('').slideUp('slow');
|
|
||||||
|
|
||||||
var callingFile = '';
|
var callingFile = '';
|
||||||
var params = '';
|
var params = '';
|
||||||
|
|
||||||
@@ -578,21 +560,31 @@ $(function() {
|
|||||||
}
|
}
|
||||||
tmp += '</ol>';
|
tmp += '</ol>';
|
||||||
var errors = '<b>'+txtThereis+' '+i+' '+txtErrors+':</b><ol>'+tmp;
|
var errors = '<b>'+txtThereis+' '+i+' '+txtErrors+':</b><ol>'+tmp;
|
||||||
$('#opc_account_errors').html(errors).slideDown('slow');
|
$('#opc_account_errors').slideUp('fast', function(){
|
||||||
$.scrollTo('#opc_account_errors', 800);
|
$(this).html(errors).slideDown('slow', function(){
|
||||||
|
$.scrollTo('#opc_account_errors', 800);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$('#opc_account_errors').slideUp('slow', function(){
|
||||||
|
$(this).html('');
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
isGuest = ($('#is_new_customer').val() === 1 ? 0 : 1);
|
isGuest = ($('#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)
|
if (jsonData.id_customer !== undefined && jsonData.id_customer !== 0 && jsonData.isSaved)
|
||||||
{
|
{
|
||||||
// update token
|
// update token
|
||||||
static_token = jsonData.token;
|
static_token = jsonData.token;
|
||||||
|
|
||||||
// update addresses id
|
|
||||||
$('#opc_id_address_delivery').val(jsonData.id_address_delivery);
|
|
||||||
$('#opc_id_address_invoice').val(jsonData.id_address_invoice);
|
|
||||||
|
|
||||||
// It's not a new customer
|
// It's not a new customer
|
||||||
if ($('#opc_id_customer').val() !== '0')
|
if ($('#opc_id_customer').val() !== '0')
|
||||||
{
|
{
|
||||||
@@ -623,16 +615,12 @@ $(function() {
|
|||||||
else
|
else
|
||||||
updateNewAccountToAddressBlock();
|
updateNewAccountToAddressBlock();
|
||||||
}
|
}
|
||||||
$('#opc_new_account-overlay').fadeOut('slow');
|
$('#opc_new_account-overlay, #opc_delivery_methods-overlay, #opc_payment_methods-overlay').fadeIn('slow');
|
||||||
$('#opc_delivery_methods-overlay').fadeOut('slow');
|
|
||||||
$('#opc_payment_methods-overlay').fadeOut('slow');
|
|
||||||
},
|
},
|
||||||
error: function(XMLHttpRequest, textStatus, errorThrown) {
|
error: function(XMLHttpRequest, textStatus, errorThrown) {
|
||||||
if (textStatus !== 'abort')
|
if (textStatus !== 'abort')
|
||||||
alert("TECHNICAL ERROR: unable to save account \n\nDetails:\nError thrown: " + XMLHttpRequest + "\n" + 'Text status: ' + textStatus);
|
alert("TECHNICAL ERROR: unable to save account \n\nDetails:\nError thrown: " + XMLHttpRequest + "\n" + 'Text status: ' + textStatus);
|
||||||
$('#opc_new_account-overlay').fadeOut('slow');
|
$('#opc_new_account-overlay, #opc_delivery_methods-overlay, #opc_payment_methods-overlay').fadeIn('slow')
|
||||||
$('#opc_delivery_methods-overlay').fadeOut('slow');
|
|
||||||
$('#opc_payment_methods-overlay').fadeOut('slow');
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return false;
|
return false;
|
||||||
@@ -807,11 +795,10 @@ function multishippingMode(it)
|
|||||||
$('#address_invoice').removeClass('item').addClass('alternate_item');
|
$('#address_invoice').removeClass('item').addClass('alternate_item');
|
||||||
$('#multishipping_mode_box').removeClass('on');
|
$('#multishipping_mode_box').removeClass('on');
|
||||||
$('.addressesAreEquals').show();
|
$('.addressesAreEquals').show();
|
||||||
if ($('.addressesAreEquals').find('input:checked').length) {
|
if ($('.addressesAreEquals').find('input:checked').length)
|
||||||
$('#address_invoice_form').hide();
|
$('#address_invoice_form').hide();
|
||||||
} else {
|
else
|
||||||
$('#address_invoice_form').show();
|
$('#address_invoice_form').show();
|
||||||
}
|
|
||||||
$('.address_add a').attr('href', addressUrl);
|
$('.address_add a').attr('href', addressUrl);
|
||||||
|
|
||||||
// Disable multi address shipping
|
// Disable multi address shipping
|
||||||
@@ -840,12 +827,11 @@ $(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.
|
// 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);
|
$('#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 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) {
|
if (typeof(multishipping_mode) !== 'undefined' && multishipping_mode)
|
||||||
|
{
|
||||||
$('#multishipping_mode_checkbox').click();
|
$('#multishipping_mode_checkbox').click();
|
||||||
$('.addressesAreEquals').hide();
|
$('.addressesAreEquals').hide().find('input').attr('checked', false);
|
||||||
$('.addressesAreEquals').find('input').attr('checked', false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (typeof(open_multishipping_fancybox) !== 'undefined' && open_multishipping_fancybox)
|
if (typeof(open_multishipping_fancybox) !== 'undefined' && open_multishipping_fancybox)
|
||||||
$('#link_multishipping_form').click();
|
$('#link_multishipping_form').click();
|
||||||
});
|
});
|
||||||
Reference in New Issue
Block a user