ECSHOP The default program is when the user login, the product evaluation is not able to anonymously evaluation.
Some stores set up only login reviews, but customers don't want to show their account names. This is where it comes in handy.
1 Replace the Add_comment method with the following code at the bottom of the comment.php
/** * Add comment content * * @access public * @param object $cmt * @return Void */function add_comment ($CMT) { /* comment requires approval */ $ status = 1- $GLOBALS [' _cfg '] [' Comment_check ']; $user _id = Empty ($_session[' user_id ')? 0: $_session[' user_id ']; $email = empty ($cmt->email)? $_SESSION[ ' Email ': Trim ($cmt->email); $user _name = empty ($cmt->username)? $_ session[' user_name ': Trim ($cmt->username); $email = htmlspecialchars ($email); $user _name = htmlspecialchars ($user _name); //file_put_contents (' Test.txt ', $CMT->nimingis); $nimingis = $CMT->nimingis; if ($nimingis) {  , $user _id=0; $user _name= str_mid_replace ($_session[' user_name ']); } /* Save comments */ $sql = "INSERT into" $GLOBALS [' ECs ']->table (' comment '). "(Comment_type, Id_value, email, user_name, Content, Comment_rank, Add_time, ip_address, status, parent_id, user_id) VALUES " . "('" . $CMT->type. "', '" . $CMT->id. "', ' $email ', ' $user _name ', ' . $CMT->content. "', '". $CMT->rank. "',". Gmtime (). "," ". Real_ip ()." ', ' $status ', ' 0 ', ' $user _id ') "; $result = $GLOBALS [' DB ']->query ($sql); clear_cache_files (' Comments_list.lbi '); /*if ($status > 0) &nbSp { add_feed ($GLOBALS [' DB ']->insert_id (), comment_goods); }*/ return $result;} //string intercept function str_mid_replace ($string) { if (! $string | |!isset ($string [1]) return $string; $len = strlen ($string); $starNum = floor ($len /2); $noStarNum = $len - $starNum; $leftNum = ceil ($noStarNum /2); $rightNum = $noStarNum - $leftNum; $result = substr ($string, 0, $leftNum); $result .= str_repeat (' * ', $starNum); $result .= substr ($string, $len-$rightNum); return $Result;} |
2. Increased in the Submitcomment method in Comments.lbi
1 |
Cmt.nimingis = frm.elements[' Nimingis '].checked; |
3. Add in HTML code
<!--{if $smarty .session.user_name}--> <tr> <td width= "Up" align= "right" > Anonymous:</td> <TD width= "631" >{$lang. Anonymous}<input type= "checkbox" Name= "Nimingis" value= "" ></td> </tr> ; <!--{/if}--> |
Allow ecshop users to log in to evaluate for optional anonymous evaluation