1

Hi I tried to add captcha to subscribe.phtml Here is my xml file.

    <default>
    <reference name="newsletter">
            <block type="captcha/captcha" name="captcha">
                <reference name="head">
                    <action method="addJs">
                        <file>mage/captcha.js</file>
                    </action>
                </reference>
                <action method="setFormId">
                    <formId>newsletter_subscribe</formId>
                </action>
                <action method="setImgWidth">
                    <width>230</width>
                </action>
                <action method="setImgHeight">
                    <width>50</width>
                </action>
            </block>
    </reference>
</default>
1
 <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>contacts</formId></action>
                <action method="setImgWidth"><width>230</width></action>
                <action method="setImgHeight"><width>50</width></action>
            </block>
        </block>

now paste this code for captcha

<?php echo $this->getChildHtml('form.additional.info'); ?>
  • Captcha is working only bellow events : controller_action_predispatch_customer_account_loginPost controller_action_predispatch_customer_account_forgotpasswordpost controller_action_predispatch_customer_account_createpost controller_action_predispatch_adminhtml_index_forgotpassword admin_user_authenticate_before controller_action_predispatch_checkout_onepage_saveBilling customer_customer_authenticated admin_session_user_login_success – Abdul Dec 3 '15 at 7:05
  • and need to enable in admin side – Abdul Dec 3 '15 at 7:06
0

in file '\\template\newsletter\subscribe.phtml' there is a form, you can add captcha and before submission of form you can proceed after validation.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.