Skip to content

Commit

Permalink
Release v3.2.20 (#93)
Browse files Browse the repository at this point in the history
* initial opc compatibility

* fixed carrier parameter on ajax call

* whitespace removed

* DGS-322 getErrLog on null fix

* total paid fix

* opc compatibility improvements

* opc improvements and added some styles

* Adding auto indexes

* Automatic license addition applying

* styling and layout for checkout

* Automatic license addition applying

* onepagecheckout ps module compatibility fixes

* comment edited

* fixed onepagecheckout ps dropdown

* Automatic license addition applying

* changed hardcoded value

* css changes to change input order

* version bump and changelog added

* changelog updated

---------

Co-authored-by: GytisZum <[email protected]>
Co-authored-by: Justas Vaitkus <[email protected]>
Co-authored-by: justelis22 <[email protected]>
Co-authored-by: justelis22 <[email protected]>
  • Loading branch information
5 people authored Aug 2, 2024
1 parent 329e02d commit 0b24c1a
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 17 deletions.
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -167,4 +167,6 @@
- Numeric post code improvements

## [3.2.20]
- One page checkout compatibility improvements
- One page checkout compatibility improvements
- Multiple payment transaction and total price fix
- Carriers error handling improvements
8 changes: 4 additions & 4 deletions dpdbaltics.php
Original file line number Diff line number Diff line change
Expand Up @@ -1123,7 +1123,7 @@ public function printLabel($idShipment)

if ($parcelPrintResponse->getStatus() === Config::API_SUCCESS_STATUS) {
$this->updateOrderCarrier($idShipment);
return;
return $parcelPrintResponse;
}

return $parcelPrintResponse;
Expand All @@ -1140,7 +1140,7 @@ public function printMultipleLabels($shipmentIds)
foreach ($shipmentIds as $shipmentId) {
$this->updateOrderCarrier($shipmentId);
}
return;
return $parcelPrintResponse;
}

return $parcelPrintResponse;
Expand Down Expand Up @@ -1381,7 +1381,7 @@ private function handleLabelPrintService()
return;
}

if (!empty($parcelPrintResponse->getErrLog())) {
if (isset($parcelPrintResponse) && !empty($parcelPrintResponse->getErrLog())) {
Context::getContext()->controller->errors[] = $parcelPrintResponse->getErrLog();
}

Expand All @@ -1406,7 +1406,7 @@ private function handleLabelPrintService()
return;
}

if (!empty($parcelPrintResponse->getErrLog())) {
if (isset($parcelPrintResponse) && !empty($parcelPrintResponse->getErrLog())) {
Context::getContext()->controller->errors[] = $parcelPrintResponse->getErrLog();
}

Expand Down
6 changes: 2 additions & 4 deletions src/Service/ShipmentService.php
Original file line number Diff line number Diff line change
Expand Up @@ -221,16 +221,14 @@ public function createShipmentFromOrder(Order $order)
private function createNonDistributedShipment(Order $order, $idProduct, $isTestMode)
{
$products = $order->getProducts();
$parcelPrice = 0;
$parcelPrice = $order->getTotalPaid();
$parcelWeight = 0;
$orderShippingCost = $order->total_shipping_tax_incl ?: 0;

foreach ($products as $product) {
$parcelPrice += $this->calculateProductsPrice($product);
$parcelWeight += $product['weight'] * $product['product_quantity'];
}

$parcelPrice = $this->calculateParcelPriceWithOrderDiscount($order, $parcelPrice);
$parcelPrice += $orderShippingCost;
$shipment = $this->createShipment($order, $idProduct, $isTestMode, 1, $parcelWeight, $parcelPrice);

if (!$shipment->id) {
Expand Down
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 0b24c1a

Please sign in to comment.