PHP Error

Trying to get property of non-object

/home/trungdq/domains/trungdiep.com/public_html/protected/controllers/SiteController.php(302)

290         }
291         else 
292         {
293             $this->redirect(Yii::app()->homeUrl);
294         }
295     }
296     
297     public function actionProduct($id, $name)
298     {
299         session_start();
300         $model = Product::model()->findByPk($id);
301 
302         $this->cat_id = $model->cat_id;
303         
304         //navigation bar
305         if (!empty($model->type)) {
306             $type = $model->type;
307             if (!empty($type->cat)) {
308                 $cat = $type->cat;
309                 $this->navigation_bar = $this->navigation_bar . '<i class="fa fa-angle-double-right"></i>' . CHtml::link($cat->name, Yii::app()->urlManager->createUrl('site/ListProduct', array('id' => $cat->id, 'name' => $cat->url)));
310             }
311 
312             if (!empty($type->type)) {
313                 $ptype = $type->type;
314                 $this->navigation_bar = $this->navigation_bar . '<i class="fa fa-angle-double-right"></i>' . CHtml::link($ptype->name, Yii::app()->urlManager->createUrl('site/ListProductByType', array('id' => $ptype->id, 'name' => $ptype->url)));

Stack Trace

#9
+
 /home/trungdq/domains/trungdiep.com/public_html/index.php(13): CApplication->run()
08 defined('YII_DEBUG') or define('YII_DEBUG',true);
09 // specify how many levels of call stack should be shown in each log message
10 defined('YII_TRACE_LEVEL') or define('YII_TRACE_LEVEL',3);
11 
12 require_once($yii);
13 Yii::createWebApplication($config)->run();
2024-03-19 16:40:28 Apache/2 Yii Framework/1.1.7