deduction = $deduction; parent::__construct($orderFreight, $weight); } public function getKey() { return $this->deduction->getCode().'Deduction'; } public function getAmount() { return $this->deduction->getAmount()->getMoney(); } /** * @return mixed * @throws \app\common\exceptions\AppException */ function getPrice() { if ($this->deduction->getOrderDeduction()->isChecked() && $this->deduction->isEnableDeductFreight()) { // dump($this->getKey(), $this->orderFreight->getPriceBefore($this->getKey()), $this->getAmount()); $a = max($this->orderFreight->getPriceBefore($this->getKey()) - $this->getAmount(), 0); // dump($a, $this->getKey(),$this->orderFreight->priceCache, $this->orderFreight->getOrder()->priceCache); return $a; } else { return $this->orderFreight->getPriceBefore($this->getKey()); } } }