Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Page 1 of 2
Restrict Product Reviews to Registered Users
 
bmcinnis
Jr. Member
 
Total Posts:  6
Joined:  2008-07-28
Columbus, Oh
 

Is it possible to restrict product reviews to registered users only.  If a user clicks to write a review and hasn’t logged in or registered they would be taken to the login/registration page.  Once registered or logged in they would be taken back to the product detail page to submit a review.

 
Magento Community Magento Community
Magento Community
Magento Community
 
adimagento
Guru
 
Avatar
Total Posts:  626
Joined:  2007-08-29
Los Angeles, CA
 

This functionality is not available with Magento out of the box.

 
Magento Community Magento Community
Magento Community
Magento Community
 
BobMane
Sr. Member
 
Total Posts:  108
Joined:  2008-07-30
 

how about to completely turn off reviews-system wide?

 
Magento Community Magento Community
Magento Community
Magento Community
 
ccromp
Jr. Member
 
Total Posts:  18
Joined:  2008-10-07
 

In the custom template:
app/design/frontend/default/custom/template/review/form.phtml

I added the following check to see if the user is logged in:

<?php if ($this->helper('customer/data')->isLoggedIn()) { ?>

So if the user isn’t logged in, when they click to add a review, they are prompted to login first.  Here is the full modified code for that page:

<div class="page-head">
    <
h3><?php echo $this->__('Write Your Own Review'?></h3>
</
div>
<?php if ($this->helper('customer/data')->isLoggedIn()) { ?>
<h4><?php echo $this->__("You're reviewing: %s"$this->htmlEscape($this->getProductInfo()->getName())) ?></h4>
<
form action="<?php echo $this->getAction() ?>" method="post" id="review-form">
<
fieldset>
    
<?php if( $this->getRatings() && $this->getRatings()->getSize()): ?>
    
<div class="product-review-box">
    <
strong><?php echo $this->__('How do you rate this product?'?><span class="required">*</span></strong><br />
    <
span id="input-message-box"></span>
    <
table class="data-table" id="product-review-table" cellspacing="0">
        <
thead>
            <
tr>
                <
th>&nbsp;</th>
                <
th><?php echo $this->__('1 star'?></th>
                <
th><?php echo $this->__('2 stars'?></th>
                <
th><?php echo $this->__('3 stars'?></th>
                <
th><?php echo $this->__('4 stars'?></th>
                <
th><?php echo $this->__('5 stars'?></th>
            </
tr>
        </
thead>
        <
tbody>
        
<?php $_oddIterator 1?>
        <?php 
foreach ($this->getRatings() as $_rating): ?>
            
<tr class="odd<?php if($_oddIterator == $this->getRatings()->getSize()): $_oddIterator = 0; ?> last<?php endif; ?>">
                <
td class="label"><?php echo $_rating->getRatingCode() ?></td>
            
<?php $_iterator 1?>
            <?php 
foreach ($_rating->getOptions() as $_option): ?>
                
<!--<td <?php if($_iterator == 5): ?>class="last"<?php endif; ?> style="width:60px;"><input type="radio" <?php if($_iterator == 5): $_iterator=0?>class="validate-one-required-by-name"<?php endif; ?> name="ratings[<?php echo $_rating->getId() ?>]" id="<?php echo $_rating->getRatingCode() ?>_<?php echo $_option->getValue() ?>" value="<?php echo $_option->getId() ?>"/></td>-->
                <
td<?php if($_iterator == 5): ?> class="last"<?php endif; ?> style="width:60px;"><input type="radio" name="ratings[<?php echo $_rating->getId() ?>]" id="<?php echo $_rating->getRatingCode() ?>_<?php echo $_option->getValue() ?>" value="<?php echo $_option->getId() ?>" /></td>
            
<?php $_iterator++ ?>
            <?php 
endforeach; ?>
            
</tr>
        
<?php $_oddIterator ++; ?>
        <?php 
endforeach; ?>
        
</tbody>
    </
table>
    <
input type="hidden" name="validate_rating" class="validate-rating" value="" />
    <
script type="text/javascript">decorateTable('product-review-table')</script>
    
</div>
    
<?php endif; ?>
        <?php 
// do not remove div - some problem whith validator in IE ?>
        
<div>
        <
label for="nickname_field"><?php echo $this->__('Nickname'?><span class="required">*</span></label><br />
        <
input class="input-text required-entry" name="nickname" id="nickname_field" style="width: 450px;" type="text" value="<?php echo $this->htmlEscape($data->getNickname()) ?>" />
        </
div>

        <
div>
        <
label for="summary_field"><?php echo $this->__('Summary of Your Review'?><span class="required">*</span></label><br />
        <
input name="title" class="input-text  required-entry" id="summary_field" style="width: 450px;" type="text" value="<?php echo $this->htmlEscape($data->getTitle()) ?>" />
        </
div>

        <
div>
        <
label for="review_field"><?php echo $this->__('Review'?><span class="required">*</span></label><br />
        <
textarea class="required-entry" name="detail" id="review_field" cols="53" rows="10" style="width: 450px;"><?php echo $this->htmlEscape($data->getDetail()) ?></textarea>
        </
div>

    <
div class="button-set">
        <
button class="form-button right" type="submit"><span><?php echo $this->__('Submit Review'?></span></button>
    </
div>
</
fieldset>
</
form>
<
script type="text/javascript">
//<![CDATA[
    
var dataForm = new VarienForm('review-form');

    
Validation.addAllThese(
    
[
           [
'validate-rating''<?php echo $this->__('Please select one of each of the ratings above') ?>', function(v{
                
var trs = $('product-review-table').getElementsBySelector('tr');
                var 
inputs;
                var 
error 1;

                for( var 
j=0trs.lengthj++ ) {
                    
var tr trs[j];
                    if( 
{
                        inputs 
tr.getElementsBySelector('input');

                        for( 
i in inputs {
                            
if( inputs[i].checked == true {
                                error 
0;
                            
}
                        }

                        
if( error == {
                            
return false;
                        
else {
                            error 
1;
                        
}
                    }
                }
                
return true;
            
}]
    ]
    
);
//]]>
</script>
<?php }else{ ?>
<p>Sorryyou must be logged in to write a review.</p>
<
p><strong><a href="/customer/account/login/">Log In Now</a></strong></p>
<?php } ?>
 
Magento Community Magento Community
Magento Community
Magento Community
 
Hugoto
Member
 
Avatar
Total Posts:  33
Joined:  2008-08-11
 

ok, thank you, that works fine, but now the question is How to redirect the user to the product detail page after the login?

 
Magento Community Magento Community
Magento Community
Magento Community
 
Alexandre Queiróz
Member
 
Avatar
Total Posts:  43
Joined:  2008-02-27
Brazil
 

Hi!

Does anybody found a solution to redirect the user to the product detail page after the login???

Alexandre

 
Magento Community Magento Community
Magento Community
Magento Community
 
BobMane
Sr. Member
 
Total Posts:  108
Joined:  2008-07-30
 

how to turn off all reviews?

 
Magento Community Magento Community
Magento Community
Magento Community
 
nasha
Sr. Member
 
Avatar
Total Posts:  138
Joined:  2009-04-15
 

Go to system->configuration->advance->set mage_review = No

 
Magento Community Magento Community
Magento Community
Magento Community
 
KML
Jr. Member
 
Total Posts:  25
Joined:  2009-09-02
 
Alexandre Queiróz - 31 October 2008 12:17 PM

Hi!

Does anybody found a solution to redirect the user to the product detail page after the login???

Alexandre

I know this topic is old but I have solution to this problem: (I run 1.3.2.4)
The file that has to be modified it the form.phtml file located in: app/design/frontend/default/yourtemplate/review/form.phtml

<?
if ((boolean) $this->helper('customer')->isLoggedIn() )
        

        ?>
            
<form action="<?php echo $this->getAction() ?>" method="post" id="review-form" class="review_form">
                <
fieldset class="add-review">
                <
br />
                    <
h4><?php echo $this->__('Write Your Own Review'?></h4>
                    <
h4 class="product-name"><?php echo $this->__("You're reviewing:"); ?> <span><?php echo $this->htmlEscape($this->getProductInfo()->getName()) ?></span></h4>
                    
<?php if( $this->getRatings() && $this->getRatings()->getSize()): ?>
                        
<h5><?php echo $this->__('How do you rate this product?'?> <span class="required">*</span></h5>
                        <
span id="input-message-box"></span>
                        <
table class="data-table" id="product-review-table">
                            <
col />
                            <
col width="1" />
                            <
col width="1" />
                            <
col width="1" />
                            <
col width="1" />
                            <
col width="1" />
                            <
col width="1" />
                            <
col width="1" />
                            <
col width="1" />
                            <
col width="1" />
                            <
col width="1" />
                            <
thead>
                                <
tr>
                                    <
th>&nbsp;</th>
                                    <
th><span class="nobr"><?php echo $this->__('1 grape'?></span></th>
                                    <
th><span class="nobr"><?php echo $this->__('2 grapes'?></span></th>
                                    <
th><span class="nobr"><?php echo $this->__('3 grapes'?></span></th>
                                    <
th><span class="nobr"><?php echo $this->__('4 grapes'?></span></th>
                                    <
th><span class="nobr"><?php echo $this->__('5 grapes'?></span></th>
                                    <
th><span class="nobr"><?php echo $this->__('6 grapes'?></span></th>
                                    <
th><span class="nobr"><?php echo $this->__('7 grapes'?></span></th>
                                    <
th><span class="nobr"><?php echo $this->__('8 grapes'?></span></th>
                                    <
th><span class="nobr"><?php echo $this->__('9 grapes'?></span></th>
                                    <
th><span class="nobr"><?php echo $this->__('10 grapes'?></span></th>
                                </
tr>
                            </
thead>
                            <
tbody>
                            
<?php foreach ($this->getRatings() as $_rating): ?>
                                
<tr>
                                    <
td class="label"><?php echo $_rating->getRatingCode() ?></td>
                                
<?php foreach ($_rating->getOptions() as $_option): ?>
                                    
<td class="value"><input type="radio" name="ratings[<?php echo $_rating->getId() ?>]" id="<?php echo $_rating->getRatingCode() ?>_<?php echo $_option->getValue() ?>" value="<?php echo $_option->getId() ?>" class="radio" /></td>
                                
<?php endforeach; ?>
                                
</tr>
                            
<?php endforeach; ?>
                            
</tbody>
                        </
table>
                        <
input type="hidden" name="validate_rating" class="validate-rating" value="" />
                        <
script type="text/javascript">decorateTable('product-review-table')</script>
                    <?php 
endif; ?>
                    
<ul class="form-list">
                        <
li>
                            <
label for="nickname_field"><?php echo $this->__('Nickname'?> <span class="required">*</span></label><br />
                            <
input type="hidden" name="nickname" id="nickname_field" class="input-text required-entry" value="<?php echo $this->htmlEscape($data->getNickname()) ?>" />
                        </
li>
                        <
li>
                            <
label for="summary_field"><?php echo $this->__('Summary of Your Review'?> <span class="required">*</span></label><br />
                            <
input type="text" name="title" id="summary_field" class="input-text required-entry" value="<?php echo $this->htmlEscape($data->getTitle()) ?>" />
                        </
li>
                        <
li>
                            <
label for="review_field"><?php echo $this->__('Review'?> <span class="required">*</span></label><br />
                            <
textarea name="detail" id="review_field" cols="5" rows="3" class="required-entry"><?php echo $this->htmlEscape($data->getDetail()) ?></textarea>
                        </
li>
                    </
ul>
                    
<?php  // recaptcha
                    
if( !(Mage::getStoreConfig("fontis_recaptcha/recaptcha/when_loggedin")  && (Mage::getSingleton('customer/session')->isLoggedIn())) )
                    
{
                        
if (Mage::getStoreConfig("fontis_recaptcha/recaptcha/review"))
                            echo 
$this->getChildHtml('recaptcha_box');
                    
}
                ?>
                    
<div class="buttons-set">
                        <
button type="submit" class="button"><span><?php echo $this->__('Submit Review'?></span></button>
                    </
div>
                </
fieldset>
        </
form>
        
        
        
<?
        
        }
        
        
else //customer is NOT logged in
            

            
                ?>
                
<br />
                <
br />
                <
div style="border:1px solid #501d5d;padding:10px; margin-bottom:20px;">
                    
<? ;
                    echo 
$this->__('To prevent SPAM we ask our customers to login before posting a review. Thank you for your understanding!'); ?>
                    
<br />
                    
Please <a href="<?php echo $this->helper('customer')->getLoginUrl() ?>">Sign In</ato post review 
                
</div>
                
        
<?    } 
?>

<script type="text/javascript">
//<![CDATA[
    
var dataForm = new VarienForm('review-form');
    
Validation.addAllThese(
    
[
           [
'validate-rating''<?php echo $this->__('Please select one of each of the ratings above') ?>', function(v{
                
var trs = $('product-review-table').getElementsBySelector('tr');
                var 
inputs;
                var 
error 1;

                for( var 
j=0trs.lengthj++ ) {
                    
var tr trs[j];
                    if( 
{
                        inputs 
tr.getElementsBySelector('input');

                        for( 
i in inputs {
                            
if( inputs[i].checked == true {
                                error 
0;
                            
}
                        }

                        
if( error == {
                            
return false;
                        
else {
                            error 
1;
                        
}
                    }
                }
                
return true;
            
}]
    ]
    
);
//]]>
</script>

What is important here is what follows ELSE clause. You have there link to Sign-In that will take you back to product review page.
(You may find some CAPTCHA Code in my example, and 10 point based review system. Just ignore it.)

Good luck

 
Magento Community Magento Community
Magento Community
Magento Community
 
Stefano T
Jr. Member
 
Total Posts:  7
Joined:  2009-05-05
 

Where is the solution that should bring you back to product?

thanks

 
Magento Community Magento Community
Magento Community
Magento Community
 
KML
Jr. Member
 
Total Posts:  25
Joined:  2009-09-02
 

[double post - admin please delete this one, thanks]

others - look below for solution to question above

 
Magento Community Magento Community
Magento Community
Magento Community
 
KML
Jr. Member
 
Total Posts:  25
Joined:  2009-09-02
 

^^^^^^^ to the poster above ^^^^^

this will take your customers back to the product they want to review (this PHP code will create appropriate link with REFERRER)

Please <a href="<?php echo $this->helper('customer')->getLoginUrl() ?>">Sign In</ato post review

the rest of the code is in my post above.
Remember that f you just use this one line it will not work, you also need the other part of IF/ELSE clause in order for this to work

In short what it does is:
1. restricts not logged in customer from posting review
2. provides link to log in (including referrer) that will take you back to product review page after you logged in

hope it helps
KML

 
Magento Community Magento Community
Magento Community
Magento Community
 
MagePsycho
Mentor
 
Avatar
Total Posts:  1702
Joined:  2009-06-23
 
Alexandre Queiróz - 31 October 2008 12:17 PM

Hi!

Does anybody found a solution to redirect the user to the product detail page after the login???

Alexandre

You can try this extension for the purpose:
http://www.magentocommerce.com/magento-connect/MagentoPycho/extension/3763/custom_login_redirect

 
Magento Community Magento Community
Magento Community
Magento Community
 
Jake Rudkin
Jr. Member
 
Total Posts:  8
Joined:  2010-03-25
 

Hi KML, i have used what ccromp previously posted and that works fine for the redirect to the login page but i want the customer redirecting back to the product they were trying to review, I’ve copied and pasted what you previously posted but the review form has grapes instead of start and the layout is different, and its not redirecting them to the product they wanted to review, i must be missing something, can you specify what code i actually need and where to place it in the file? thank you for your help
Jake

 
Magento Community Magento Community
Magento Community
Magento Community
 
KML
Jr. Member
 
Total Posts:  25
Joined:  2009-09-02
 

Jake-R-W the grape part is something custom for my customer. You should keep your default code (stars) in the IF statement. I was just trying to show the logic.

If you are not redirected back to the product page, after logging in make sure that in the backend you disable the option to redirect customers to DASHBOARD after logging in. Otherwise They will be redirected to their Dashboard. You can find this option in - System->Configuration->Customer Configuration->(bottom pf page)->Redirect Customer to Account Dashboard after Logging in->SET to NO.

If everything is implemented correctly it should ask customers to log in (it will not show the review form until they log in). After they log in they will be taken back to the product page.
This is solution for 1.3.2.4. I have no idea if it works for other versions.

Let me know if you need more help!

 
Magento Community Magento Community
Magento Community
Magento Community
 
dellamathew
Jr. Member
 
Total Posts:  1
Joined:  2012-02-28
 

help me please. i am a newbie in magento.. I created a magento 1.5 store. I want to know how a registered user can add details of their product from front end. ie they must add the details of the product that they want to sell or the requirements of their expected product. There are different categories. The product should be shown in the category area that the user selected while he was adding the product. Plz replyyy.

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top
Page 1 of 2