/** * Load StoreProduct model by url * @param $url * @return StoreProduct * @throws CHttpException */ protected function _loadModel($url) { $this->model = StoreProduct::model()->active()->withUrl($url)->find(); if (!$this->model) { throw new CHttpException(404, Yii::t('StoreModule.core', 'Продукт не найден.')); } $this->model->saveCounters(array('views_count' => 1)); return $this->model; }