Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls

Restrict Voting and Reviews to Registered Customers Only

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions
 
Thread Tools Search this Thread
  #1  
Old 09-24-2005, 06:16 PM
 
salsabeel salsabeel is offline
 

Senior Member
  
Join Date: Jan 2004
Posts: 132
 

Default Restrict Voting and Reviews to Registered Customers Only

From what I could find, X-Cart lets you select under Modules Options the ability to allow only registered customers to Write Reviews, but even when you set this it still allows unregistered customers to set a Ranking. I needed to make it to where only registered customers can both write reviews and set rankings because otherwise anonymous users could set rankings and possibly ruin product ratings, defeating the whole purpose of the feature. Also I wanted to make it to where unregistered customers would still be able to view the rankings and reviews that were made by registered customers.

Firstly, make sure you have Customer Reviews turned on under Modules. Also turn on Allow viewing reviews, Allow voting, and Allow adding reviews under Modules Options.

Secondly, edit the file: /modules/Customer_Reviews/vote_reviews.tpl

Code:
{* $Id: vote_reviews.tpl,v 1.3.2.2 2005/08/10 11:00:42 mclap Exp $ *} {if $config.Modules.customer_voting eq "Y" || ($config.Modules.customer_reviews eq "Y" && ($reviews ne "" || $config.Modules.writing_reviews eq "A" || ($login ne "" && $config.Modules.writing_reviews eq "R")))} {capture name=dialog} <TABLE width="100%" border="0" cellpadding="0" cellspacing="0"> {if $config.Modules.customer_voting eq "Y"} {include file="modules/Customer_Reviews/vote.tpl"} <TR><TD colspan="2"> </TD></TR> {/if} {if $config.Modules.customer_reviews eq "Y"} {include file="modules/Customer_Reviews/reviews.tpl"} {/if} </TABLE> {/capture} {include file="dialog.tpl" content=$smarty.capture.dialog title=$lng.lbl_customers_rating extra="width=100%"} {/if}

Copy and paste the following code to replace the previous code:

Code:
{* $Id: vote_reviews.tpl,v 1.3.2.2 2005/08/10 11:00:42 mclap Exp $ *} {if $login ne "" && $config.Modules.writing_reviews eq "R"} {capture name=dialog} <TABLE width="100%" border="0" cellpadding="0" cellspacing="0"> {if $config.Modules.customer_voting eq "Y"} {include file="modules/Customer_Reviews/vote.tpl"} <TR><TD colspan="2"> </TD></TR> {/if} {if $config.Modules.customer_reviews eq "Y"} {include file="modules/Customer_Reviews/reviews.tpl"} {/if} </TABLE> {/capture} {include file="dialog.tpl" content=$smarty.capture.dialog title=$lng.lbl_customers_rating extra="width=100%"} {else} {capture name=dialog} <TABLE width="100%" border="0" cellpadding="0" cellspacing="0"> <TR><TD colspan="2"> <FONT class="ProductDetailsTitle">{$lng.lbl_customers_rating}</FONT> </TD></TR> <TR><TD class="Line" height="1" colspan="2">[img]{$ImagesDir}/spacer.gif[/img]</TD></TR> {if $vote_max_cows ne ""} <TR> <TD> {$lng.lbl_customers_rating}</TD> <TD> {section name=full_cows loop=$vote_max_cows} [img]{$ImagesDir}/star_4.gif[/img] {/section} {if $vote_little_cow ne "0"} [img]{$ImagesDir}/star_{$vote_little_cow}.gif[/img] {/if} {section name=free_cows loop=$vote_free_cows} [img]{$ImagesDir}/star_0.gif[/img] {/section} </TD></TR>{/if} <TR><TD colspan="2"> <FONT class="ProductDetailsTitle">{$lng.lbl_customer_reviews}</FONT> </TD></TR> <TR><TD class="Line" height="1" colspan="2">[img]{$ImagesDir}/spacer.gif[/img]</TD></TR> {section name=r_i loop=$reviews} <TR> <TD colspan="2"> {$lng.lbl_author}: {$reviews[r_i].email|default:$lng.lbl_unknown} {$reviews[r_i].message|replace:"\n":" "} </TD></TR> {/section} </TABLE> {/capture} {include file="dialog.tpl" content=$smarty.capture.dialog title=$lng.lbl_customers_rating extra="width=100%"} {/if}

There may be a shorter way to do this but this is my first customization for X-Cart that I have posted and I am still new to Smarty. From my tests it works for me perfect, but please let me know if it doesn't work for you.
__________________
X-Cart Platinum 4.6.5
Reply With Quote
  #2  
Old 10-11-2005, 12:47 PM
  kpayne's Avatar 
kpayne kpayne is offline
 

X-Adept
  
Join Date: Dec 2002
Location: Firetanksoftware.com
Posts: 469
 

Default

Thanks for this!
__________________
X-cart Featured Products Manager from http://www.firetanksoftware.com - Put your products where you want, how you want.
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 04:44 AM.

   

 
X-Cart forums © 2001-2020