Skip to content

Commit

Permalink
Merge pull request #128 from Invertus/DGS-298/carrier-parameter-fix
Browse files Browse the repository at this point in the history
DGS-298/Carrier parameter fix
  • Loading branch information
GytisZum authored Jul 11, 2024
2 parents dac1632 + d824164 commit 74847d5
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 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,14 @@ 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 74847d5

Please sign in to comment.