Commit fd94eafa authored by Thorsten Buss's avatar Thorsten Buss

FIX: totalItemsOnlyConditions() in CurrencyCart and a wrong class in a closure

parent 6b9035e3
......@@ -340,7 +340,7 @@ class Cart implements Jsonable, \JsonSerializable, Arrayable{
$conditions = new Conditions($this->session->get($this->sessionKeyCartConditions));
if ($withItemConditions) {
$this->items()->each(function (Item $item) use (&$conditions) {
$item->conditions->each(function (AdditionalFee $condition) use (&$conditions) {
$item->conditions->each(function (Condition $condition) use (&$conditions) {
$conditions->push($condition);
});
});
......
......@@ -139,8 +139,8 @@ class Condition extends Collection {
/**
* apply condition
*
* @param $totalOrSubTotalOrPrice
* @param $conditionValue
* @param int $totalOrSubTotalOrPrice
* @param int $conditionValue
* @return int
*/
protected function apply($totalOrSubTotalOrPrice, $conditionValue) {
......@@ -168,8 +168,8 @@ class Condition extends Collection {
/**
* apply condition with the given quantity
*
* @param $totalOrSubTotalOrPrice
* @param $conditionValue
* @param int $totalOrSubTotalOrPrice
* @param int $conditionValue
* @return int
*/
protected function applyWithQuantity($totalOrSubTotalOrPrice, $conditionValue, $quantity=1) {
......
......@@ -78,7 +78,11 @@ class CurrencyCart extends Cart {
* @return Money
*/
public function totalItemsOnlyConditions($type = null) {
return new Money(parent::totalItemsOnlyConditions($type), $this->currency);
$sum = $this->items()->sum(function (Item $item) use ($type) {
return $item->priceSumOnlyConditions($type)->amount();
});
return new Money($sum, $this->currency);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment