Error

Call to a member function getPrice() on null

/var/www/www.everlife.hu/public_html/rapidws/controllers/RwsSiteController.php(14)

02 
03 Yii::import('rcms.controllers.RcmsSiteController');
04 
05 class RwsSiteController extends RcmsSiteController
06 {
07 
08     public function actionToCart($id, $amount = 1)
09     {
10         $cart = Yii::app()->cart;
11         $cart->addProduct($id, $amount);
12         $product = Product::model()->active()->findByPk($id);
13         $_SESSION['addtocart'] = [
14             'price' => $product->getPrice(),
15             'name' => $product->name,
16             'id' => $id
17         ];
18         header('X-Robots-Tag: noindex');
19         $this->redirect(RcmsUtil::linkTo(Yii::app()->pages->getPageIdByType($cart->pageType)));
20     }
21 
22     public function actionInterested($id)
23     {
24         $product = Product::model()->active()->findByPk($id);
25         $_SESSION['interestedprod'] = $product->name;
26         $this->redirect(RcmsUtil::linkTo(38));

Stack Trace

#9
+
 /var/www/www.everlife.hu/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 18:12:17 Apache Yii Framework/1.1.17