Open paul-stolk-webdiensten opened 2 years ago
The following patch can be used to quick-fix this:
https://github.com/tig-nl/gls-magento2/issues/28
===================================================================
diff --git a/vendor/tig/gls-magento2/Model/ResourceModel/Carrier/GLS.php b/vendor/tig/gls-magento2/Model/ResourceModel/Carrier/GLS.php
--- a/vendor/tig/gls-magento2/Model/ResourceModel/Carrier/GLS.php
+++ b/vendor/tig/gls-magento2/Model/ResourceModel/Carrier/GLS.php (date 1638787288081)
@@ -149,7 +149,7 @@
$rateQuery->prepareSelect($select);
$bindings = $rateQuery->getBindings();
- $bindings[':condition_value'] = $request->getPackageWeight();
+ $bindings[':condition_value'] = $bindings[':condition_value'] = $this->getConditionValue($request->getAllItems());
// If quote is lost these values are empty, causing table rates to return the wrong shipping rate.
if ($bindings[':condition_name'] == null && $bindings[':condition_value'] == 0.0) {
Add it to Composer:
"patches": {
"tig/gls-magento2": {
"ISSUE-28: Condition value is always package weight and never subtotal": "patches/composer/GLS-28-incorrect-condition-value.patch"
}
}
Hi @paul-stolk-webdiensten,
Thank you for submitting this fix, we will investigate this further and make adjustments where needed. My colleague looked at your fix and said the following, a small adjustment you can make is:
$bindings[':condition_value'] = $bindings[':condition_value'] = $this->getConditionValue($request->getAllItems());
Change it to
$bindings[':condition_value'] = $this->getConditionValue($request->getAllItems());
Thank you again for bringing this to our attention we will investigate the issue!
Have a great day, Jeffrey
Same issue on Mage 2.4.3-p1. Fix worked wonders, thanks!
Hi @vandijkstef,
Thank you for your confirmation!
Have a great day, Jeffrey
To Reproduce Steps to reproduce the behavior:
Expected result The shipping costs is 0
Actual result The shipping costs is 3.95
Workaround Change \TIG\GLS\Model\ResourceModel\Carrier\bindings, line 152: Old:
$bindings[':condition_value'] = $request->getPackageWeight();
New:$bindings[':condition_value'] = $this->getConditionValue($request->getAllItems());
Note: Because of the following line:
if ($bindings[':condition_name'] == null && $bindings[':condition_value'] == 0.0)
It does seem to work when no weight is set for the product.Screenshots Shipping rates:
Settings: