贴心
                全国7×24小时客服热线
            安全
                病毒杀除率高于99%
            稳定
                网站可用性高于99.9%
            实力
                服务68家上市企业及集团公司
            
  点击数:16482015-07-15 11:09:24 来源: 外贸网站建设,深圳外贸网站建设,深圳网站建设,外贸商城网站制作-亿恩科技
相信很多使用Magento的朋友都有这个问题,VCPHP网站模板的另外一个站。产品评论已经过万,虽然大部分都是垃圾.这些Spam浪费我的时间,浪费我的精力,还让我的magento越来越慢,所以决定消灭他们.
好了,我们现在来解决这个问题。其实解决这个问题很简单。也有多种处理办法:
1.采用验证码,Magento connect中有给Magento review增加验证码的插件。记得有一个免费和一个收费的。
2.自己通过修改代码拒绝review spam。目前MagentoChina就是这么做的,直接让Magento判断游客提交的review中,是否带有http这个关键词。如果有,则报错。修改起来很简单,下面是代码:
代码位置在:app/code/core/Mage/Review/Model/Review.php
然后把这个文件Copy到:app/code/local/Mage/Review/Model/Review.php
然后在validate()这个方法中增加:
| 
						 
								if (stristr($this->getDetail(), 'http')) {
							 
							
								$errors[] = $helper->__('Pls Don\'t Spam');
							 
							
								}
							 
						 | 
				
最后整个方法看起来像这样:
| 
						 
								public function validate()
							 
							
								{
							 
							
								$errors = array();
							 
							
								$helper = Mage::helper('customer');
							 
							
								if (!Zend_Validate::is($this->getTitle(), 'NotEmpty')) {
							 
							
								$errors[] = $helper->__('Review summary can\'t be empty');
							 
							
								}
							 
							
								if (!Zend_Validate::is($this->getNickname(), 'NotEmpty')) {
							 
							
								$errors[] = $helper->__('Nickname can\'t be empty');
							 
							
								}
							 
							
								if (!Zend_Validate::is($this->getDetail(), 'NotEmpty')) {
							 
							
								$errors[] = $helper->__('Review can\'t be empty');
							 
							
								}
							 
							
								if (stristr($this->getDetail(), 'http')) {
							 
							
								$errors[] = $helper->__('Pls Don\'t Spam');
							 
							
								}
							 
							
								if (empty($errors)) {
							 
							
								return true;
							 
							
								}
							 
							
								return $errors;
							 
						 | 
				
亿恩科技手机站
        
关注亿恩科技微信