Modifying Review Ratings

Posted in: Newsmag
Post count: 15

I want to create a child theme which will allow the NewsMag Product Ratings to be entered in wp-admin on a points scale of 0 to 20 but displayed on the post page as a star rating between 0 and 5. The reason for this is that I want to be able to export the ratings data to another application which supports ratings on a scale of 0 to 20. I can’t see any easy way of doing this. td_set_reviews.php can’t be modified from a child theme because it is used from within td_templates_settings.php which is included from functions.php using require_once. So effectively the ratings functionality is not pluggable.

Is there any way around this?

Post count: 6600

Hi,

You’re right, you can’t edit it using child theme however you can change it into the main theme if you really need it and modify theme’s review system and considering that the booster functions file is a core file it will be updated frequently so you would have to also constantly change it each update even if you use a child theme.

Thanks

Post count: 17

Hi, just some thoughts (kinda busy this week…),

– Is it suitable for you to have a direct conversion from 0-5 in 0.5 steps to 0-20? (0=>0, 0.5=>2, 1=>4,1.5=>6….) In this case you could only review even values on the 0-20 scale.

Then, you could add save_post action in your child theme and check whether a review exists, do the conversion, and store the result in a convenient way as a post_meta.
Please note td review meta is an array so if you want to extract the values from the database, you would have to do it with a php script or similar but, if you store your own meta value, then this value can already be a number, and this will be easier.

to summarize:

add_action ('save_post','test_save_post',10,3);
function test_save_post ($post_id, $post, $update )
{
if (isset ($_POST['td_review']) && isset ($_POST['td_review']['p_review_stars']) &&
count ($_POST['td_review']['p_review_stars'])){
$my_value = $_POST['td_review']['p_review_stars'][0]['rate']*4;
update_post_meta ($post_id,'my_review',$my_value);// got even 0-20 numbers in 'my_review' meta. select post_id,meta_value from wp_postmeta where meta_key = 'my_review'
}
}

If you check your meta table, you will see a new meta attached to the post with your review.

– No way, I need the odd numbers from 0 to 20. There are several alternatives here, some involving php code and other javascript code but it gets more difficult than previous approach. To avoid waste both your and my time, if you are interested, reply to this post and I will give you some hints.

regards

Post count: 15

Thanks for the replies Lucian and mpindado.

One approach I am considering is building my own admin section for review ratings. There is other functionality I need such as restricting the theme to only display ratings as star ratings and having a predefined set of rating categories. When the post is saved, I will save my ratings out of 20 in a custom meta field and also save the ratings data to the td_review meta. This should work for my purposes although obviously it is not ideal and means extra work for me.

Post count: 6600

Hi,

Unfortunately for that you would need custom work and we’re not available for any type of custom work at them moment as we work hard on development, fixes and support. Sorry!
We suggest you get someone to help you implement this or hire a freelancer to do it for you. You can get one from site’s like: http://studio.envato.com/

Thanks for the message!

Post count: 15

Thanks Lucian.

Is it possible to change the placement of the review ratings? Right now they always appear at the bottom of the page in the footer.

Post count: 7909

Hi,

You can move the reviews code and place it where you want to appear for (each) post template that you use – http://screencast.com/t/q43Xpbe1

Thanks!

Post count: 15

Thanks Alin!

Viewing 8 posts - 1 through 8 (of 8 total)
The forum ‘Newsmag’ is closed to new topics and replies.