public function getHasVisibleProducts() { if ($this->child_count == 0) { return false; } // Query products in this category. $query = Yii::app()->db->createCommand()->select()->from('xlsws_product')->where('web=1')->join('xlsws_product_category_assn pca', 'pca.product_id = id AND pca.category_id = :id', array(':id' => $this->id))->limit(1); // If this config item is set, then we take into account the product inventory level. if (Yii::app()->params['INVENTORY_OUT_ALLOW_ADD'] == Product::InventoryMakeDisappear) { $productInventoryField = Product::GetInventoryField(); $query->andWhere(array('OR', 'inventoried != 1', $productInventoryField . ' > 0')); } $blnDisplayableProductExists = $query->queryRow(); if ($blnDisplayableProductExists) { return true; } else { return false; } }