public function getByProduct($product_id)
    {
        $result = null;
        $this->hook->attach('rating.get.before', $product_id, $result, $this);

        if (isset($result)) {
            return $result;
        }

        $sql = 'SELECT rating, votes FROM rating WHERE product_id=?';
        $result = $this->db->fetch($sql, array($product_id));

        $this->hook->attach('rating.get.after', $product_id, $result, $this);
        return $result;
    }
public function getByProduct($product_id)
    {
        $result = null;
        $this->hook->attach('rating.get.before', $product_id, $result, $this);

        if (isset($result)) {
            return $result;
        }

        $sql = 'SELECT rating, votes FROM rating WHERE product_id=?';
        $result = $this->db->fetch($sql, array($product_id));

        $this->hook->attach('rating.get.after', $product_id, $result, $this);
        return $result;
    }
public function getByProduct ( $ product_id ) { $ result = null ; $ this -> hook -> attach ( 'rating.get.before' , $ product_id , $ result , $ this ) ; if ( isset ( $ result ) ) { return $ result ; } $ sql = 'SELECT rating, votes FROM rating WHERE product_id=?' ; $ result = $ this -> db -> fetch ( $ sql , array ( $ product_id ) ) ; $ this -> hook -> attach ( 'rating.get.after' , $ product_id , $ result , $ this ) ; return $ result ; }
Returns an array of rating data for a given product
@param integer $product_id
@return array
Returns an array of rating data for a given product