GROUP BY korrigiert
This commit is contained in:
		| @@ -41,31 +41,31 @@ class RateItFrontend extends \Hybrid | ||||
| 	 * @var string | ||||
| 	 */ | ||||
| 	protected $strPk = 'id'; | ||||
| 	 | ||||
|  | ||||
| 	/** | ||||
| 	 * Typ | ||||
| 	 * @var string | ||||
| 	 */ | ||||
| 	protected $strType = 'hearts';	 | ||||
| 	 | ||||
| 	protected $strType = 'hearts'; | ||||
|  | ||||
| 	/** | ||||
| 	 * Template | ||||
| 	 * @var string | ||||
| 	 */ | ||||
| 	protected $strTemplate = 'rateit_default';	 | ||||
| 	 | ||||
| 	protected $strTemplate = 'rateit_default'; | ||||
|  | ||||
| 	/** | ||||
| 	 * Anzahl der Herzen/Sterne | ||||
| 	 * @var int | ||||
| 	 */ | ||||
| 	protected $intStars = 5; | ||||
| 	 | ||||
|  | ||||
| 	/** | ||||
| 	 * Textposition | ||||
| 	 * @var string | ||||
| 	 */ | ||||
| 	protected $strTextPosition = 'after'; | ||||
| 	 | ||||
|  | ||||
| 	/** | ||||
| 	 * Initialize the controller | ||||
| 	 */ | ||||
| @@ -77,10 +77,10 @@ class RateItFrontend extends \Hybrid | ||||
| 			elseif ($objElement instanceof \Model\Collection) { | ||||
| 				$this->strTable = $objElement->current()->getTable(); | ||||
| 			} | ||||
| 			 | ||||
|  | ||||
| 			$this->strKey = $this->strPk; | ||||
| 		} | ||||
| 			 | ||||
|  | ||||
| 		$stars = intval($GLOBALS['TL_CONFIG']['rating_count']); | ||||
| 		if ($stars > 0) { | ||||
| 			$this->intStars = $stars; | ||||
| @@ -110,7 +110,7 @@ class RateItFrontend extends \Hybrid | ||||
| 	 */ | ||||
| 	protected function compile() { | ||||
| 	} | ||||
| 	 | ||||
|  | ||||
| 	public function getStarMessage($rating) { | ||||
| 		$this->loadLanguageFile('default'); | ||||
| 		$stars = $this->percentToStars($rating['rating']); | ||||
| @@ -136,12 +136,12 @@ class RateItFrontend extends \Hybrid | ||||
| 	public function loadRating($rkey, $typ) { | ||||
| 		$SQL_GET_RATINGS = "SELECT i.rkey AS rkey, | ||||
| 			i.title AS title, | ||||
| 			IFNULL(AVG(r.rating),0) AS rating,  | ||||
| 			IFNULL(AVG(r.rating),0) AS rating, | ||||
| 			COUNT( r.rating ) AS totalRatings | ||||
| 			FROM tl_rateit_items i | ||||
| 			LEFT OUTER JOIN tl_rateit_ratings r | ||||
| 			ON ( i.id = r.pid ) WHERE i.rkey = ? and typ=? and active='1' | ||||
| 			GROUP BY i.rkey;"; | ||||
| 			GROUP BY i.rkey, i.title;"; | ||||
| 		$result = $this->Database->prepare($SQL_GET_RATINGS) | ||||
| 							->execute($rkey, $typ) | ||||
| 							->fetchAssoc(); | ||||
| @@ -154,4 +154,4 @@ class RateItFrontend extends \Hybrid | ||||
| 	} | ||||
| } | ||||
|  | ||||
| ?> | ||||
| ?> | ||||
|   | ||||
		Reference in New Issue
	
	Block a user