Skip to content

Commit fce3a27

Browse files
author
dpfaffenbauer
committed
fix for Shipping Rule "ShippingRule" -> pass price to getPriceModification method and implement getPrice method
1 parent 946bb0f commit fce3a27

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

lib/CoreShop/Model/Carrier/ShippingRule/Action/ShippingRule.php

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,23 @@ class ShippingRule extends AbstractAction
3434
*/
3535
public $shippingRule;
3636

37+
/**
38+
* get price for shipping
39+
*
40+
* @param Model\Carrier $carrier
41+
* @param Cart $cart
42+
* @param Model\User\Address $address
43+
*
44+
* @return float|boolean $price
45+
*/
46+
public function getPrice(Model\Carrier $carrier, Cart $cart, Model\User\Address $address)
47+
{
48+
$carrierShippingRule = CarrierShippingRule::getById($this->getShippingRule());
49+
50+
if ($carrierShippingRule instanceof CarrierShippingRule) {
51+
return $carrierShippingRule->getPrice($carrier, $cart, $address);
52+
}
53+
}
3754

3855
/**
3956
* get addition/discount for shipping
@@ -50,7 +67,7 @@ public function getPriceModification(Model\Carrier $carrier, Cart $cart, Model\U
5067
$carrierShippingRule = CarrierShippingRule::getById($this->getShippingRule());
5168

5269
if ($carrierShippingRule instanceof CarrierShippingRule) {
53-
return $carrierShippingRule->getPrice($carrier, $cart, $address);
70+
return $carrierShippingRule->getPriceModification($carrier, $cart, $address, $price);
5471
}
5572

5673
return 0;

0 commit comments

Comments
 (0)