/** * */ public function calculateTotal() { $total = 0; foreach ($this->orders as $order) { $product = $order->getProduct(); $price = $product->getPrice(); if ($this->user->getCeten()) { $price = $product->getCetenPrice(); } $price *= $order->getCount(); $total += $price; } $this->total = $total; }