小编Kha*_*lil的帖子

Magento:将验证码添加到自定义联系表单

我在 Magento 网站上创建了一个新的自定义联系表单,我试图在它的末尾添加验证码。

我已经添加到 app/code/core/Mage/Captcha/etc/config.xml

                <customcontacts>
                    <label>Custom Contact Form</label>
                </customcontacts>
Run Code Online (Sandbox Code Playgroud)

我添加到 app/design/frontend/base/default/layout/captcha.xml

    <customcontacts>
    <reference name="customcontacts">
        <block type="core/text_list" name="form.additional.info">
            <block type="captcha/captcha" name="captcha">
                <reference name="head">
                    <action method="addJs"><file>mage/captcha.js</file></action>
                </reference>
                <action method="setFormId"><formId>customcontacts</formId></action>
                <action method="setImgWidth"><width>230</width></action>
                <action method="setImgHeight"><width>50</width></action>
            </block>
        </block>
    </reference>
</customcontacts>
Run Code Online (Sandbox Code Playgroud)

我在表单中添加了以下代码:

<script type="text/javascript">
//<![CDATA[
$('form-validate-captcha').captcha.refresh($('catpcha-reload'));
//]]>
Run Code Online (Sandbox Code Playgroud)

我添加了这个代码来显示验证码:

<div><?php echo $this->getChildHtml('captcha'); ?></div>
Run Code Online (Sandbox Code Playgroud)

然后我在“配置”>“客户配置”>“验证码”中启用了验证码,然后选择“自定义联系表单”,然后选择“显示模式”为“始终”。

但是我仍然没有在我的自定义表单中获得验证码。

我希望我很清楚

谢谢

customization captcha magento contact-form

5
推荐指数
1
解决办法
1万
查看次数

将jquery代码移动到外部文件不起作用

我试图将jquery代码从内部html文件移动到外部文件并将其链接到html文件的头部,该网站在html内部工作,但是当我将代码移动到外部文件时,链接无法正常工作.

HTML头代码:

<head>
    <link rel="stylesheet" href="/newsite/style.css" title="new" type="text/css" media="screen" charset="utf-8">
    <script type="text/javascript" src="./newsite/js/scripting.js"></script>
    <script src="http://code.jquery.com/jquery-latest.js"></script>
</head>
Run Code Online (Sandbox Code Playgroud)

html javascript jquery

-2
推荐指数
1
解决办法
1万
查看次数