コード例 #1
0
 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;
 }
コード例 #2
0
 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;
 }