Skip to content

Commit

Permalink
fixed carrier parameter on ajax call
Browse files Browse the repository at this point in the history
  • Loading branch information
GytisZum committed Mar 28, 2024
1 parent 83f437f commit 8e16f8c
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions views/js/front/pudo-search.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,11 @@ $(document).ready(function () {
$(document).on('keyup', 'input[name="dpd-street"]', function () {
var city = $('select[name="dpd-city"]').val();
var street = $('input[name="dpd-street"]').val();
updateParcelBlock(city, street);
var selectedCarrier = $('select[name="dpd-city"]').closest('.dpd-pudo-container');

var idCarrier = selectedCarrier.attr('data-id');

updateParcelBlock(city, street, idCarrier);
});

if ($('.dpd-checkout-pickup-container').is(':visible')) {
Expand Down Expand Up @@ -75,12 +79,7 @@ $( document ).ajaxComplete(function( event, request, settings ) {
});

function updateStreetSelect(city) {

var $this = $(this);
var $pudoId = $this.data('id');
var $container = $this.closest('.dpd-pudo-container');
var $submitInput = $container.find('input[name="dpd-pudo-id"]');
var $idReference = $container.data('id');
var $container = $(this).closest('.dpd-pudo-container');

$.ajax(dpdHookAjaxUrl, {
type: 'POST',
Expand Down Expand Up @@ -152,13 +151,15 @@ function saveSelectedStreet(city, street) {
});
}

function updateParcelBlock(city, street) {
function updateParcelBlock(city, street, idCarrier) {

$.ajax(dpdHookAjaxUrl, {
type: 'POST',
data: {
'ajax': 1,
'city': city,
'street': street,
'id_carrier': idCarrier,
'action': 'updateParcelBlock',
'token': typeof prestashop !== 'undefined' ? prestashop.static_token : ''
},
Expand Down

0 comments on commit 8e16f8c

Please sign in to comment.