CHttpException

The requested product does not exist.

/home/rose/public_html/rosedelta.com/public_html/protected/controllers/ProductController.php(722)

710      * If the data model is not found, an HTTP exception will be raised.
711      * @param integer the primary key value. Defaults to null, meaning using the 'id' GET variable
712      */
713     public function loadProduct($id=null)
714     {
715         if($this->_product===null)
716         {   $user = User::model()->with('account')->findByPk(Yii::app()->user->getId());
717             $groupid = Yii::app()->params['categoryRepIds'][$user->account->group_id] ?? 0;
718 
719             if($id!==null || isset($_GET['id']))
720                 $this->_product=Product::model()->findBySql("SELECT products.*, sale_prices.price AS saleprice FROM products LEFT OUTER JOIN sale_prices ON products.id=sale_prices.product_id AND (customer_id=" . $user->account->group_id . (($groupid!=null)?" OR customer_id=".$groupid:"") . ") AND (NOW() BETWEEN startdate AND enddate) WHERE products.active=1 AND products.id = " . ( $id!==null ? $id : $_GET['id']) . " ORDER BY sale_prices.price DESC LIMIT 1");
721             if($this->_product===null)
722                 throw new CHttpException(500,'The requested product does not exist.');
723         }
724         return $this->_product;
725     }
726     
727     private function category_facet($current_cat = 0) {
728         $string = "";
729         $num = 0;
730 
731         $categories = Category::model()->findAllBySql('SELECT * FROM categories WHERE id IN (SELECT parent_id FROM categories WHERE id=' . $current_cat . ')');
732         if (count($categories) > 0) {
733             foreach ($categories as $category) {
734                 list($num, $append) = $this->category_facet($category->id);

Stack Trace

#0
+
 /home/rose/public_html/rosedelta.com/public_html/protected/controllers/ProductController.php(134): ProductController->loadProduct()
129     /**
130      * Shows a particular product.
131      */
132     public function actionShow()
133     {
134         $product = $this->loadProduct();
135         $user = User::model()->with('account')->findByPk(Yii::app()->user->getId());
136         $groupid = Yii::app()->params['categoryRepIds'][$user->account->group_id] ?? 0;
137         $favourites = array();
138         
139         $favourites = Favourite::model()->findAll('customer_id=' . $user->userid . ' AND product_id=' . $product->id);
#13
+
 /home/rose/public_html/rosedelta.com/public_html/index.php(11): CApplication->run()
06 
07 defined('YII_TRACE_LEVEL') or define('YII_TRACE_LEVEL',3);
08 
09 
10 require_once($yii);
11 Yii::createWebApplication($config)->run();
12 ?>
2024-03-19 07:36:14 Apache/2.4.6 (CentOS) OpenSSL/1.0.2k-fips PHP/7.1.33 Yii Framework/1.1.19