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