Skip to content

Commit

Permalink
develop in master gemergt
Browse files Browse the repository at this point in the history
  • Loading branch information
mbe1987 committed Sep 20, 2021
2 parents 9ce5184 + 63fb2cd commit b928c54
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 8 deletions.
4 changes: 4 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
# Changelog
## 1.5.1
* same weight calculation for local and international delivery
* weight calculation fix: use package weight only if calculate weight is active

## 1.5.0
* New product: Warenpost International
* specify endorsement for parcel send via Paket International
Expand Down
2 changes: 1 addition & 1 deletion project.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"pathToModule": "copy_this/modules/mo/mo_dhl",
"prefix": "mo_",
"suffix": "",
"version": "1.5.0",
"version": "1.5.1",
"compatibility": {
"minimumVersion": "6.0",
"maximumVersion": null,
Expand Down
13 changes: 7 additions & 6 deletions src/modules/mo/mo_dhl/Adapter/BaseShipmentBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,13 @@ protected function calculateWeight(Order $order): float
$config = Registry::getConfig();
$weight = 0.0;
foreach ($order->getOrderArticles() as $orderArticle) {
$articleWeight = $this->getArticleWeight($orderArticle, $config, $this->isInternational($order));
$articleWeight = $this->getArticleWeight($orderArticle, $config);
$weight += $articleWeight * $orderArticle->getFieldData('oxamount');
}
$weight *= 1 + (float)$config->getShopConfVar('mo_dhl__packing_weight_in_percent') / 100.0;
$weight += (float)$config->getShopConfVar('mo_dhl__packing_weight_absolute');
if ($config->getShopConfVar('mo_dhl__calculate_weight')) {
$weight *= 1 + (float)$config->getShopConfVar('mo_dhl__packing_weight_in_percent') / 100.0;
$weight += (float)$config->getShopConfVar('mo_dhl__packing_weight_absolute');
}
return max(self::MO_DHL__MIN_WEIGHT_FOR_ORDER, $weight);
}

Expand Down Expand Up @@ -143,16 +145,15 @@ protected function getParticipation(Order $order)
/**
* @param OrderArticle $orderArticle
* @param \OxidEsales\Eshop\Core\Config $config
* @param bool $isInternationalShipment
* @return float|mixed
*/
protected function getArticleWeight(OrderArticle $orderArticle, \OxidEsales\Eshop\Core\Config $config, bool $isInternationalShipment)
protected function getArticleWeight(OrderArticle $orderArticle, \OxidEsales\Eshop\Core\Config $config)
{
/** @var OrderArticle $orderArticle */
$articleWeight = $config->getShopConfVar('mo_dhl__calculate_weight')
? (float)$orderArticle->getFieldData('oxweight')
: (float)$config->getShopConfVar('mo_dhl__default_weight');
if ($isInternationalShipment && $articleWeight < self::MO_DHL__MIN_WEIGHT_FOR_ORDERITEMS) {
if ($articleWeight < self::MO_DHL__MIN_WEIGHT_FOR_ORDERITEMS) {
$articleWeight = max(self::MO_DHL__MIN_WEIGHT_FOR_ORDERITEMS, (float)$config->getShopConfVar('mo_dhl__default_weight'));
}
return $articleWeight;
Expand Down
2 changes: 1 addition & 1 deletion src/modules/mo/mo_dhl/metadata.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
'en' => '<p>Enable features providing Post & Paket Delivery to your OXID shop.</p>' . '<p><a href="https://projects.mediaopt.de/projects/mopt-postp-ua/wiki" target="_blank">Handbook</a></p>',
],
'thumbnail' => 'logo.png',
'version' => '1.5.0',
'version' => '1.5.1',
'author' => '<a href="http://www.mediaopt.de" target="_blank">mediaopt.</a>',
'url' => 'http://www.mediaopt.de',
'email' => '[email protected]',
Expand Down

0 comments on commit b928c54

Please sign in to comment.