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
}
}
?>

本文详细阐述了如何在配置文件中重写Mycaptcha模型类,并提供了代码示例。

被折叠的 条评论
为什么被折叠?



