PHP notice

Trying to get property of non-object

/home/gia707e2/public_html/protected/controllers/CartController.php(27)

15         $this->render('index');
16     }
17 
18     public function actionAddToCart($strid){
19         $arr_id =explode('-', $strid);
20         $sid= end($arr_id);
21         $id = substr($sid,1);
22         $product = TblProduct::model()->findByPk($id);
23 
24         if(!isset(Yii::app()->session['cart'])){
25             $cart = array();
26             $item_cart=array(
27                 'product_id'=>$product->id,
28                 'iQuantity'=>1,
29                 'price' => $product->price_km,
30                 'product_name'=> $product->product_name,
31                 'image' => $product->thumbnails
32             );
33             if(isset($_GET['soluong'])){
34                 $item_cart['iQuantity'] = $_GET['soluong'];
35             }
36             $cart[]=$item_cart;
37             Yii::app()->session['cart']= $cart;
38         }else{
39             $cart = Yii::app()->session['cart'];

Stack Trace

#9
+
 /home/gia707e2/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-28 13:33:09 LiteSpeed Yii Framework/1.1.14