示例#1
0
文件: Model.php 项目: v3u3i87/run_cli
 /**
  * 获取当前查询条件表总数
  */
 public function getTotal()
 {
     $sql = 'SELECT COUNT(*) as conut ' . $this->mergeSql('from');
     return $this->_db->getTotal($sql);
 }
 /**
  * 合計、値引きを再計算し、dtb_orderデータに登録する
  *
  * @param unknown $Order
  * @param unknown $Coupon
  */
 public function recalcOrder(&$Order, &$Coupon)
 {
     $discount = 0;
     $total = $Order->getTotal();
     // ------------------------------------------
     // クーポンコードが存在する場合
     // カートに入っている商品の値引き額を設定する
     // ------------------------------------------
     if (!is_null($Coupon)) {
         // 対象商品の存在確認.
         // 割引対象商品が存在する場合は値引き額を取得する
         if ($this->existsCouponProduct($Coupon, $Order)) {
             // 割引対象商品がある場合は値引き額を計算する
             if ($Coupon->getDiscountType() == 1) {
                 $discount = $Coupon->getDiscountPrice();
             } else {
                 // 課税区分の取得
                 $taxService = $this->app['eccube.service.tax_rule'];
                 $TaxRule = $this->app['eccube.repository.tax_rule']->getByRule();
                 // 小数点以下は四捨五入
                 $discount = $taxService->calcTax($Order->getTotal(), $Coupon->getDiscountRate(), $TaxRule->getCalcRule()->getId(), $TaxRule->getTaxAdjust());
             }
             // 合計金額の再計算
             $total = $Order->getTotal() - $discount;
             $total = $total < 0 ? 0 : $total;
         }
     }
     // DB登録
     $Order->setDiscount($discount);
     $Order->setTotal($total);
     $Order->setPaymentTotal($total);
     $this->app['orm.em']->flush();
 }
示例#3
0
文件: Query.php 项目: v3u3i87/upadd
 /**
  * 获取当前查询条件表总数
  */
 protected function getTotal()
 {
     $this->joint_field('COUNT(*) AS `conut` ');
     $this->_db->_sql = 'SELECT ' . $this->mergeSqlLogic() . ';';
     return $this->_db->getTotal();
 }