Unobtrusive AJAX Star Rating Bar for Zen Cart and OSCommerce

No GoodNeed ImprovementOKGoodExcellent (9 votes, average: 4.56 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: 2%

2 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.

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