cartGoods = $cartGoods; $this->extraCharges = $extraCharges; parent::__construct($weight); } public function getKey() { return $this->extraCharges->getCode(); } /** * @return float|int|mixed * @throws \app\common\exceptions\AppException */ public function getPrice() { if ($this->cartGoods->isChecked()) { return $this->cartGoods->getPriceBefore($this->getKey()) + $this->extraCharges->getAmount(); } else { return $this->cartGoods->getPriceBefore($this->getKey()); } //return $this->cartGoods->getPriceBefore($this->getKey()) + $this->extraCharges->getAmount(); } }