コード例 #1
0
 protected function findModel($id)
 {
     if (($model = ShippingType::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
コード例 #2
0
ファイル: ShippingCost.php プロジェクト: pistol88/yii2-order
 public function addShippingCost($event)
 {
     if ($orderShippingType = yii::$app->session->get('orderShippingType')) {
         if ($orderShippingType > 0) {
             $shippingType = ShippingType::findOne($orderShippingType);
             if ($shippingType && $shippingType->cost > 0 && (int) $shippingType->free_cost_from <= 0 | $shippingType->free_cost_from > $event->cost) {
                 $event->cost = $event->cost + $shippingType->cost;
             }
         }
     }
     return $this;
 }