Skip to content

Instantly share code, notes, and snippets.

@Viktorminator
Created October 1, 2012 17:27
Show Gist options
  • Save Viktorminator/3813182 to your computer and use it in GitHub Desktop.
Save Viktorminator/3813182 to your computer and use it in GitHub Desktop.
MODX Revolution Star Rating top star elements
<?php
$snippetPath = $modx->getOption('core_path').'components/star_rating/';
$modx->addPackage('star_rating',$snippetPath.'model/');
$c = $modx->newQuery('starRating');
$c->sortby('vote_total','DESC');
$c->sortby('vote_count','DESC');
$c->limit('100');
$c->prepare();
$c->stmt->execute();
$res = $c->stmt->fetchAll(PDO::FETCH_ASSOC);
foreach ($res as $v) {
$output.= $v['starRating_id'].",";
};
$output = substr($output,0,-1);
return $output;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment