Skip to content

Commit

Permalink
Merge pull request #96 from dpdconnect/1.3.4
Browse files Browse the repository at this point in the history
1.3.4
  • Loading branch information
dpdplugin authored Jun 19, 2024
2 parents 92c9f0b + c89bae0 commit 5f60d44
Showing 1 changed file with 26 additions and 18 deletions.
44 changes: 26 additions & 18 deletions view/frontend/web/js/view/checkout/shipping/parcelshop.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,10 @@ define([
});

var parcelshop = sessionStorage.getItem('selectedParcelshop');
if (parcelshop) {
if (parcelshop && JSON.parse(parcelshop).isoAlpha2 === quote.shippingAddress().countryId) {
this.selectParcelShop(JSON.parse(parcelshop));
} else {
sessionStorage.removeItem('selectedParcelshop');
this.showMap();
}
}
Expand Down Expand Up @@ -129,23 +130,30 @@ define([
sessionStorage.setItem('selectedParcelshop', JSON.stringify(parcelshop));
window.dpdShippingAddress = parcelshop;

var options = {
method: 'POST',
showLoader: true,
url: window.checkoutConfig.dpd_parcelshop_save_url,
data: parcelshop
};

$.ajax(options).done((response) => {
$('#dpd-connect-selected-container').html(response);

$('#dpd_company').html(parcelshop.company);
$('#dpd_street').html(parcelshop.street + ' ' + parcelshop.houseNo);
$('#dpd_zipcode_and_city').html(parcelshop.zipCode + ' ' + parcelshop.city);
$('#dpd_country').html(parcelshop.isoAlpha2);
$('.dpd-shipping-information').show();
$('#dpd-connect-selected-container').show();
});
if (parcelshop.isoAlpha2 === quote.shippingAddress().countryId) {
var options = {
method: 'POST',
showLoader: true,
url: window.checkoutConfig.dpd_parcelshop_save_url,
data: parcelshop
};

$.ajax(options).done((response) => {
$('#dpd-connect-selected-container').html(response);

$('#dpd_company').html(parcelshop.company);
$('#dpd_street').html(parcelshop.street + ' ' + parcelshop.houseNo);
$('#dpd_zipcode_and_city').html(parcelshop.zipCode + ' ' + parcelshop.city);
$('#dpd_country').html(parcelshop.isoAlpha2);
$('.dpd-shipping-information').show();
$('#dpd-connect-selected-container').show();
});
} else {
sessionStorage.removeItem('selectedParcelshop');
$('#dpd-connect-map-container').html($.mage.__('Country of selected parcel shop is not equal to selected country. Please enter a valid address and try again.'));
$('#dpd-connect-map-container').show();
this.showMap();
}
}
});
});

0 comments on commit 5f60d44

Please sign in to comment.