Merge pull request #28 from prestarocket/order-opc

[*] FO : Clean order-opc.js
This commit is contained in:
François Gaillard
2012-11-23 10:08:32 -08:00
+19 -19
View File
@@ -40,13 +40,13 @@ function updateCarrierList(json)
function updatePaymentMethods(json) function updatePaymentMethods(json)
{ {
$('#HOOK_TOP_PAYMENT').html(json.HOOK_TOP_PAYMENT); $('#HOOK_TOP_PAYMENT').html(json.HOOK_TOP_PAYMENT);
$('#opc_payment_methods-content div#HOOK_PAYMENT').html(json.HOOK_PAYMENT); $('#opc_payment_methods-content #HOOK_PAYMENT').html(json.HOOK_PAYMENT);
} }
function updateAddressSelection() function updateAddressSelection()
{ {
var idAddress_delivery = ($('input#opc_id_address_delivery').length == 1 ? $('input#opc_id_address_delivery').val() : $('#id_address_delivery').val()); var idAddress_delivery = ($('#opc_id_address_delivery').length == 1 ? $('#opc_id_address_delivery').val() : $('#id_address_delivery').val());
var idAddress_invoice = ($('input#opc_id_address_invoice').length == 1 ? $('input#opc_id_address_invoice').val() : ($('input[type=checkbox]#addressesAreEquals:checked').length == 1 ? idAddress_delivery : ($('#id_address_invoice').length == 1 ? $('select#id_address_invoice').val() : idAddress_delivery))); 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_account-overlay').fadeIn('slow');
$('#opc_delivery_methods-overlay').fadeIn('slow'); $('#opc_delivery_methods-overlay').fadeIn('slow');
@@ -185,7 +185,7 @@ function updateCarrierSelectionAndGift()
if ($('input#gift:checked').length) if ($('input#gift:checked').length)
{ {
gift = 1; gift = 1;
giftMessage = encodeURIComponent($('textarea#gift_message').val()); giftMessage = encodeURIComponent($('#gift_message').val());
} }
$('#opc_payment_methods-overlay').fadeIn('slow'); $('#opc_payment_methods-overlay').fadeIn('slow');
@@ -517,7 +517,7 @@ $(function() {
// RESET ERROR(S) MESSAGE(S) // RESET ERROR(S) MESSAGE(S)
$('#opc_account_errors').html('').slideUp('slow'); $('#opc_account_errors').html('').slideUp('slow');
if ($('input#opc_id_customer').val() == 0) if ($('#opc_id_customer').val() == 0)
{ {
var callingFile = authenticationUrl; var callingFile = authenticationUrl;
var params = 'submitAccount=true&'; var params = 'submitAccount=true&';
@@ -587,18 +587,18 @@ $(function() {
static_token = jsonData.token; static_token = jsonData.token;
// update addresses id // update addresses id
$('input#opc_id_address_delivery').val(jsonData.id_address_delivery); $('#opc_id_address_delivery').val(jsonData.id_address_delivery);
$('input#opc_id_address_invoice').val(jsonData.id_address_invoice); $('#opc_id_address_invoice').val(jsonData.id_address_invoice);
// It's not a new customer // It's not a new customer
if ($('input#opc_id_customer').val() != '0') if ($('#opc_id_customer').val() != '0')
{ {
if (!saveAddress('delivery')) if (!saveAddress('delivery'))
return false; return false;
} }
// update id_customer // update id_customer
$('input#opc_id_customer').val(jsonData.id_customer); $('#opc_id_customer').val(jsonData.id_customer);
if ($('#invoice_address:checked').length != 0) if ($('#invoice_address:checked').length != 0)
{ {
@@ -607,7 +607,7 @@ $(function() {
} }
// update id_customer // update id_customer
$('input#opc_id_customer').val(jsonData.id_customer); $('#opc_id_customer').val(jsonData.id_customer);
// force to refresh carrier list // force to refresh carrier list
if (isGuest) if (isGuest)
@@ -683,26 +683,26 @@ function bindInputs()
}); });
// Recyclable checkbox // Recyclable checkbox
$('input#recyclable').click(function() { $('#recyclable').click(function() {
updateCarrierSelectionAndGift(); updateCarrierSelectionAndGift();
}); });
// Gift checkbox update // Gift checkbox update
$('input#gift').click(function() { $('#gift').click(function() {
if ($('input#gift').is(':checked')) if ($('#gift').is(':checked'))
$('p#gift_div').show(); $('#gift_div').show();
else else
$('p#gift_div').hide(); $('#gift_div').hide();
updateCarrierSelectionAndGift(); updateCarrierSelectionAndGift();
}); });
if ($('input#gift').is(':checked')) if ($('#gift').is(':checked'))
$('p#gift_div').show(); $('#gift_div').show();
else else
$('p#gift_div').hide(); $('#gift_div').hide();
// Gift message update // Gift message update
$('textarea#gift_message').change(function() { $('#gift_message').change(function() {
updateCarrierSelectionAndGift(); updateCarrierSelectionAndGift();
}); });