Unobtrusive AJAX Star Rating Bar for Zen Cart and OSCommerce
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.
Tags: Ecommerce, Unobtrusive AJAX Star Rating Bar Zen Cart OSCommerce
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 [...]
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.
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
jarnail said,
July 3, 2009 @ 6:59 am
Hi
I wanna implement this in oscommerce. how to do that?
Thanks for help
Jarnail
Anthony said,
March 29, 2010 @ 12:24 am
It’s not working for me either, not getting inserted into the database properly. I can click on the ratings but it just doesn’t do anything!!!
eclectica said,
February 23, 2011 @ 6:53 pm
For others having the issue of one rating carrying into all products, this is what solved it for me.
Replace
with
I am running zencart v1.3.9h.
eclectica said,
February 23, 2011 @ 6:56 pm
Oops lets try this again…without the php tags..
For others having the issue of one rating carrying into all products, this is what solved it for me.
Replace
($products_model,\’5\’)
in the example code
with
((int)$_GET[\'products_id\'],\’5\’)
I am running zencart v1.3.9h
Lloyd said,
July 16, 2011 @ 1:01 am
Sorry but i cant get this to work, this code:
– stops my product page fro loading, i maybe inserting in the wrong place in the file!!
I already have an index.php file, if i upload the one in this addon, the front page of the site loads nothing but instructions on how to install, what do i do with the index.php file
Im on zen 1.3.9h
Any advise would be great
Thank you