Skip to content

Commit bbefda2

Browse files
authored
ENGCOM-4147: Fixed #13319 , Incorrect method return value in \Magento\Shipping\Model\Carrier\AbstractCarrier::getTotalNumOfBoxes() #20898
2 parents 427bf13 + 48ea21d commit bbefda2

File tree

1 file changed

+14
-7
lines changed

1 file changed

+14
-7
lines changed

app/code/Magento/Shipping/Model/Carrier/AbstractCarrier.php

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,8 @@ public function getConfigFlag($field)
160160
}
161161

162162
/**
163-
* Do request to shipment
163+
* Do request to shipment.
164+
*
164165
* Implementation must be in overridden method
165166
*
166167
* @param Request $request
@@ -173,7 +174,8 @@ public function requestToShipment($request)
173174
}
174175

175176
/**
176-
* Do return of shipment
177+
* Do return of shipment.
178+
*
177179
* Implementation must be in overridden method
178180
*
179181
* @param Request $request
@@ -275,6 +277,8 @@ public function getDeliveryConfirmationTypes(\Magento\Framework\DataObject $para
275277
}
276278

277279
/**
280+
* Validate request for available ship countries.
281+
*
278282
* @param \Magento\Framework\DataObject $request
279283
* @return $this|bool|false|\Magento\Framework\Model\AbstractModel
280284
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
@@ -400,6 +404,8 @@ public function getSortOrder()
400404
}
401405

402406
/**
407+
* Allows free shipping when all product items have free shipping.
408+
*
403409
* @param \Magento\Quote\Model\Quote\Address\RateRequest $request
404410
* @return void
405411
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
@@ -531,10 +537,10 @@ protected function _getPerorderPrice($cost, $handlingType, $handlingFee)
531537
}
532538

533539
/**
534-
* Sets the number of boxes for shipping
540+
* Gets the average weight of each box available for shipping
535541
*
536-
* @param int $weight in some measure
537-
* @return int
542+
* @param float $weight in some measure
543+
* @return float
538544
*/
539545
public function getTotalNumOfBoxes($weight)
540546
{
@@ -545,7 +551,7 @@ public function getTotalNumOfBoxes($weight)
545551
$maxPackageWeight = $this->getConfigData('max_package_weight');
546552
if ($weight > $maxPackageWeight && $maxPackageWeight != 0) {
547553
$this->_numBoxes = ceil($weight / $maxPackageWeight);
548-
$weight = $weight / $this->_numBoxes;
554+
$weight = (float)$weight / $this->_numBoxes;
549555
}
550556

551557
return $weight;
@@ -671,7 +677,8 @@ protected function filterDebugData($data)
671677
}
672678

673679
/**
674-
* Recursive replace sensitive xml nodes values by specified mask
680+
* Recursive replace sensitive xml nodes values by specified mask.
681+
*
675682
* @param \SimpleXMLElement $xml
676683
* @return void
677684
*/

0 commit comments

Comments
 (0)