public function getTotal() { $this->total = 0; if (!empty($this->rate)) { $this->total += $this->adult * $this->rate->adult + $this->child * $this->rate->child + $this->infant * $this->rate->infant; if (!empty($this->addons)) { foreach ($this->addons as $addon) { $this->total += $this->adult * $addon->price + $this->child * $addon->child_price; } } } return parent::getTotal(); }
public function getTotal() { $this->depart_price = $this->getPriceType('depart'); // debug($this->price_list); if ($this->price_list->week) { $rate = MathHelper::filterArrayObject($this->price_list->week, 'date', strtoupper($this->date['depart']->format('D'))); } if ($this->price_list->date) { $rate = MathHelper::filterArrayObject($this->price_list->date, 'date', $this->date['depart']->format('d-m')); } if ($rate) { $this->depart_price += $this->depart_price * $rate->params / 100; } if ($this->trips['return']) { $this->return_price = $this->getPriceType('return'); $rate = false; if ($this->price_list->week) { $rate = MathHelper::filterArrayObject($this->price_list->week, 'date', strtoupper($this->date['return']->format('D'))); } if ($this->price_list->date) { $rate = MathHelper::filterArrayObject($this->price_list->date, 'date', $this->date['return']->format('d-m')); } if ($rate) { $this->return_price += $this->return_price * $rate->params / 100; } } if (!empty($this->addons['depart'])) { foreach ($this->addons['depart'] as $addon) { $this->depart_addon_price += $this->adult * $addon->price + $this->child * $addon->child_price; } } if (!empty($this->addons['return'])) { foreach ($this->addons['return'] as $addon) { $this->return_addon_price += $this->adult * $addon->price + $this->child * $addon->child_price; } } $this->total = $this->depart_price + $this->return_price + $this->depart_addon_price + $this->return_addon_price; return parent::getTotal(); }