`
kirenenko04
  • 浏览: 150991 次
  • 性别: Icon_minigender_2
  • 来自: 上海
社区版块
存档分类
最新评论

Customize magento native captcha appearance. Change amount of lines and dots

 
阅读更多

1.rewrite core model in config.xml

<models>
	  <mycaptcha>
		<class>Bysoft_Mycaptcha_Model</class>
		<resourceModel>mycaptcha_mysql4</resourceModel>
	  </mycaptcha>
	  <captcha>
	  	<rewrite>
	  		<zend>Bysoft_Mycaptcha_Model_Zend</zend>
	  	</rewrite>
	  </captcha>
</models>

 2. rewrite model class

<?php 
class Bysoft_Mycaptcha_Model_Zend extends Mage_Captcha_Model_Zend {
	/**
	 * Zend captcha constructor
	 *
	 * @param array $params
	 */
	public function __construct($params)
	{
		if (!isset($params['formId'])) {
			throw new Exception('formId is mandatory');
		}
		$this->_formId = $params['formId'];
		$this->setExpiration($this->getTimeout());
		$this->setDotNoiseLevel(10);     // Added code
		$this->setLineNoiseLevel(0);     // Added code
		
	}
}
?>

 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics