protected function findModel($id) { if (($model = ShippingType::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }
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; }