X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Dev Questions (https://forum.x-cart.com/forumdisplay.php?f=20)
-   -   voting with based on xxx votes?!? (https://forum.x-cart.com/showthread.php?t=1766)

mickna 03-06-2003 10:21 AM

voting with based on xxx votes?!?
 
Hi there!

I asked myself if there is a nice way to put a txt beside the voting-stars with something like "based on xxx votes"?!

A five-star-rating is nothing, if there is only one voting ;)


Cheers,
Mickna

mickna 03-07-2003 12:54 AM

Done!

I think this should work:

Have to hack customer/vote.php. Insert the line
$smarty->assign ("vote_total", $vote_result["total"]);

Code:

.....
.....
$vote_max_cows = floor ($vote_result["rating"]);
        $vote_little_cow = round (($vote_result["rating"]-$vote_max_cows) * 4);
        $vote_free_cows = 5 - $vote_max_cows - (($vote_little_cow==0) ? 0 : 1);
        $smarty->assign ("vote_max_cows", $vote_max_cows);
        $smarty->assign ("vote_little_cow", $vote_little_cow);
        $smarty->assign ("vote_free_cows", $vote_free_cows);
###################variable for votingtotals 
        $smarty->assign ("vote_total", $vote_result["total"]);
###################end
.....
.....


Next open /modules/Customer_Reviews/vote.tpl and insert:
{$lng.lbl_votetotal_1} {$vote_total} {$lng.lbl_votetotal_2}
after the stars:

Code:


.....
.....
{section name=free_cows loop=$vote_free_cows}
[img]{$ImagesDir}/star_0.gif[/img]
{/section}


 {$lng.lbl_votetotal_1} {$vote_total} {$lng.lbl_votetotal_2}

</TD></TR>
{/if}
....
....


Well and then open the language in the admin-section and add two new fields:

Code:

lbl_votetotal_1 | Based on | Based on
lbl_votetotal_1 | reviews | reviews


Think this is right :)

Cheers,
mickna

NuAlpha 01-18-2004 06:11 PM

In vote.tpl you could alternatively add the following to determine plurality of review(s).
Code:

{$lng.lbl_votetotal_1} {$vote_total} {if $vote_total > 1} {$lng.lbl_votetotal_2|cat:"s"}{else}{$lng.lbl_votetotal_2}{/if}.

Probably wouldn't work so great with languages other than English, so you if you go this route you may just want to create two seperate language variables, 'review' and 'reviews' which would end up something like...
Code:

{$lng.lbl_votetotal_1} {$vote_total} {if $vote_total > 1} {$lng.lbl_votetotal_2}{else}{$lng.lbl_votetotal_2_plural}{/if}.

Heh...well anyway, there's my two cents. :lol:

ghhoz 01-04-2005 08:57 PM

Great mod contribution for any cart, thanks for sharing with us all.


All times are GMT -8. The time now is 06:03 AM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.