diff --git a/templates/frontOffice/default/product.javascript-initialization.html b/templates/frontOffice/default/product.javascript-initialization.html index 1f2449d..9b33632 100644 --- a/templates/frontOffice/default/product.javascript-initialization.html +++ b/templates/frontOffice/default/product.javascript-initialization.html @@ -2,42 +2,42 @@ (function ($, undefined) { $(document).ready(function () { - var $section = $('#product-stock-alert'), - $pseId = $('#pse-id'), - $alertPseId = $('#stock-alert-id'), - $pseSelector = $('select.pse-option'), - $cartSubmit = $('#pse-submit'), - $notify = $('#product-stock-notify') + var section = $('#product-stock-alert'), + pseId = $('#pse-id'), + alertPseId = $('#stock-alert-id'), + pseSelector = $('select.pse-option'), + cartSubmit = $('#pse-submit'), + notify = $('#product-stock-notify') ; /* Check if add to cart is disabled or not */ var checkStock = function checkStock() { - if ($cartSubmit.prop("disabled")) { - $section.removeClass('hidden'); + if (cartSubmit.prop("disabled")) { + section.removeClass('hidden'); } else { - $section.addClass('hidden'); + section.addClass('hidden'); } }; - var saveStockAlert = function saveStockAlert($form) { + var saveStockAlert = function saveStockAlert(form) { - $alertPseId.val($pseId.val()); + alertPseId.val(pseId.val()); $.ajax({ - url: $form.attr('action'), - type: $form.attr('method'), - data: $form.serializeArray(), + url: form.attr('action'), + type: form.attr('method'), + data: form.serializeArray(), dataType: 'json' }).done(function(data, textStatus, jqXHR){ - $notify.removeClass('hidden alert-success alert-warning'); + notify.removeClass('hidden alert-success alert-warning'); if (data.success) { - $notify + notify .addClass('alert-success') .html(data.message) ; $('#stock-alert-email').val(""); } else { - $notify + notify .addClass('alert-warning') .html(data.message) ; @@ -48,12 +48,12 @@ }; - $pseSelector.on('change', function(ev) { + pseSelector.on('change', function(ev) { checkStock(); }); - $section.on('submit', 'form', function(ev) { - event.preventDefault(); + section.on('submit', 'form', function(ev) { + ev.preventDefault(); saveStockAlert($(this)); }); @@ -63,4 +63,4 @@ }); })(jQuery); - \ No newline at end of file +