Eccube\Entity\Order::getTotalPrice PHP Метод

getTotalPrice() публичный Метод

合計金額を計算
public getTotalPrice ( ) : string
Результат string
    public function getTotalPrice()
    {
        return $this->getSubtotal() + $this->getCharge() + $this->getDeliveryFeeTotal() - $this->getDiscount();
    }

Usage Example

Пример #1
0
 /**
  * 合計金額を計算
  *
  * @param Order $Order
  * @return Order
  */
 public function calculatePrice(Order $Order)
 {
     $total = $Order->getTotalPrice();
     if ($total < 0) {
         // 合計金額がマイナスの場合、0を設定し、discountは値引きされた額のみセット
         $total = 0;
     }
     $Order->setTotal($total);
     $Order->setPaymentTotal($total);
     return $Order;
 }