function getUnitPrice($recalculate = false) { $unitPrice = 0; if ($this->priceHasBeenFixed($recalculate) && !$recalculate) { $unitPrice = parent::getUnitPrice($recalculate); } elseif ($product = $this->Product()) { if (!isset(self::$calculated_buyable_price[$this->ID]) || $recalculate) { self::$calculated_buyable_price[$this->ID] = $product->getCalculatedPrice(); } $unitPrice = self::$calculated_buyable_price[$this->ID]; } else { $unitPrice = 0; } $updatedUnitPrice = $this->extend('updateUnitPrice', $unitPrice); if ($updatedUnitPrice !== null && is_array($updatedUnitPrice) && count($updatedUnitPrice)) { $unitPrice = $updatedUnitPrice[0]; } return $unitPrice; }
function getUnitPrice($recalculate = false) { $unitprice = 0; if ($this->priceHasBeenFixed() && !$recalculate) { return parent::getUnitPrice($recalculate); } elseif ($product = $this->Product()) { $unitprice = $product->getCalculatedPrice(); $this->extend('updateUnitPrice', $unitprice); } return $unitprice; }