Unobtrusive AJAX Star Rating Bar for Zen Cart and OSCommerce

No GoodNeed ImprovementOKGoodExcellent (28 votes, average: 4.18 out of 5)
Loading ... Loading ...

Download

INSTALLATION:

1. Make a rating table for the ratings in your zen cart db.

CREATE TABLE `ratings` (
`id` varchar(25) NOT NULL,
`total_votes` int(11) NOT NULL default 0,
`total_value` int(11) NOT NULL default 0,
`used_ips` longtext,
PRIMARY KEY (`id`)
) TYPE=MyISAM AUTO_INCREMENT=3;

2. Edit your database info into _config-rating.php, then upload all files to your zen cart directory.

$dbhost = 'localhost';
$dbuser = 'me';
$dbpass = 'secret';
$dbname = 'zencart';
$tableName = 'ratings';
$rating_unitwidth = 30;

3. Add this line at the top of includes/templates/YOUR_TEMPLATE/templates/tpl_product_info_display.php

<?php require('/DIRECTORY_TO_ZEN_CART/_drawrating.php'); ?>

4. add one of the following lines to includes/templates/YOUR_TEMPLATE/templates/tpl_product_info_display.php

<?php echo rating_bar('8'); ?> - 10 stars (default), ID of 8
<?php echo rating_bar($products_model,'5'); ?> - 5 stars, ID of 8xxa
<?php echo rating_bar($products_model,'5','static'); ?> - 5 stars, ID of 9a, static (non votable)
<?php echo rating_bar($products_model,'10'); ?> - 10 stars, ID of 9b
<?php echo rating_bar($products_model,'8','static'); ?> - 8 stars, ID of 9c, static (non votable)

for example, after these two lines:
<p id="productDetailsList">
<?php

5, If you want to change how the rating bar is rendered, you will need to edit both _drawrating.php and stylerating.css files.

Use at your own risk.

Technorati :

Popularity: 3%

4 Comments »

  1. Essential Modules for Your OSCommerce and Zen Cart Ecommerce Web Site: Modules make your site different | my-whiteboard said,

    July 13, 2008 @ 4:55 pm

    [...] AjaxRating: Unobtrusive AJAX Star Rating Bar for Zen Cart. http://www.my-whiteboard.com/ecommerce/unobtrusive-ajax-star-rating-bar-for-zen-cart-and-oscommerce.html [...]

  2. Edward said,

    July 20, 2008 @ 11:40 pm

    I can not get this to work.

    I have installed everything correctly. Unfortunately the stars do not save.

    I checked my ratings table and the model number is there but the IP, or star ratings are not been added. I manually added a star rating and they showed on my product pages.

    So the only thing that does not work for me is the saving/inserting the IP, star ratings not been added.

    I checked for errors and there is a function.unserialize error on line 32 of db.php

    If anyone has any idea of how I can fix this? It would be very appreciated.

  3. chris said,

    May 14, 2009 @ 1:38 am

    Hi,

    Many thanks for the script :)
    I have just one question…..
    Does this work on individual products as i have noticed that the ratings carry over in other products?

    other than that its fine and well worth a donation for coffee/donuts…..or good ol beer if i can get this to work on each product.

    thanks
    c

  4. jarnail said,

    July 3, 2009 @ 6:59 am

    Hi

    I wanna implement this in oscommerce. how to do that?

    Thanks for help
    Jarnail

RSS feed for comments on this post · TrackBack URI

Leave a Comment

*
To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
Click to hear an audio file of the anti-spam word