Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange
    Tweeted twitter.com/StackMagento/status/918627301570502656
2 improved formatting
source | link

I am trying to add Captcha inside product review form. For that i add

<referenceContainer name="form.additional.info">
            <block class="Magento\Captcha\Block\Captcha" name="captcha" after="-" cacheable="false">
                <action method="setFormId">
                    <argument name="formId" xsi:type="string">user_login</argument>
                </action>
                <action method="setImgWidth">
                    <argument name="width" xsi:type="string">230</argument>
                </action>
                <action method="setImgHeight">
                    <argument name="width" xsi:type="string">50</argument>
                </action>
            </block>
        </referenceContainer>
        <referenceBlock name="head.components">
            <block class="Magento\Framework\View\Element\Js\Components" name="captcha_page_head_components" template="Magento_Captcha::js/components.phtml"/>
        </referenceBlock>

in <referenceContainer name="form.additional.info"> <block class="Magento\Captcha\Block\Captcha" name="captcha" after="-" cacheable="false"> <action method="setFormId"> <argument name="formId" xsi:type="string">user_login</argument> </action> <action method="setImgWidth"> <argument name="width" xsi:type="string">230</argument> </action> <action method="setImgHeight"> <argument name="width" xsi:type="string">50</argument> </action> <theme/block> <Magento_Review/referenceContainer> <referenceBlock name="head.components"> <block class="Magento\Framework\View\Element\Js\Components" name="captcha_page_head_components" template="Magento_Captcha::jslayout/componentscatalog_product_view.phtml"/> </referenceBlock>xml

in theme/Magento_Review/layout/catalog_product_view.xml file. and after that i am calling it in /theme/Magento_review/template/form.phtml/theme/Magento_review/template/form.phtml file like

<?php echo $block->getLayout()->getBlock('form.additional.info')->toHtml(); ?>. But after that no captcha is showing in the review form. Please help me to do it. Thanks

I am trying to add Captcha inside product review form. For that i add

<referenceContainer name="form.additional.info"> <block class="Magento\Captcha\Block\Captcha" name="captcha" after="-" cacheable="false"> <action method="setFormId"> <argument name="formId" xsi:type="string">user_login</argument> </action> <action method="setImgWidth"> <argument name="width" xsi:type="string">230</argument> </action> <action method="setImgHeight"> <argument name="width" xsi:type="string">50</argument> </action> </block> </referenceContainer> <referenceBlock name="head.components"> <block class="Magento\Framework\View\Element\Js\Components" name="captcha_page_head_components" template="Magento_Captcha::js/components.phtml"/> </referenceBlock>

in theme/Magento_Review/layout/catalog_product_view.xml file. and after that i am calling it in /theme/Magento_review/template/form.phtml file like

<?php echo $block->getLayout()->getBlock('form.additional.info')->toHtml(); ?>. But after that no captcha is showing in the review form. Please help me to do it. Thanks

I am trying to add Captcha inside product review form. For that i add

<referenceContainer name="form.additional.info">
            <block class="Magento\Captcha\Block\Captcha" name="captcha" after="-" cacheable="false">
                <action method="setFormId">
                    <argument name="formId" xsi:type="string">user_login</argument>
                </action>
                <action method="setImgWidth">
                    <argument name="width" xsi:type="string">230</argument>
                </action>
                <action method="setImgHeight">
                    <argument name="width" xsi:type="string">50</argument>
                </action>
            </block>
        </referenceContainer>
        <referenceBlock name="head.components">
            <block class="Magento\Framework\View\Element\Js\Components" name="captcha_page_head_components" template="Magento_Captcha::js/components.phtml"/>
        </referenceBlock>

in theme/Magento_Review/layout/catalog_product_view.xml file. and after that i am calling it in /theme/Magento_review/template/form.phtml file like

<?php echo $block->getLayout()->getBlock('form.additional.info')->toHtml(); ?> But after that no captcha is showing in the review form. Please help me to do it. Thanks

1
source | link

How to add captcha in product review form in magento2?

I am trying to add Captcha inside product review form. For that i add

<referenceContainer name="form.additional.info"> <block class="Magento\Captcha\Block\Captcha" name="captcha" after="-" cacheable="false"> <action method="setFormId"> <argument name="formId" xsi:type="string">user_login</argument> </action> <action method="setImgWidth"> <argument name="width" xsi:type="string">230</argument> </action> <action method="setImgHeight"> <argument name="width" xsi:type="string">50</argument> </action> </block> </referenceContainer> <referenceBlock name="head.components"> <block class="Magento\Framework\View\Element\Js\Components" name="captcha_page_head_components" template="Magento_Captcha::js/components.phtml"/> </referenceBlock>

in theme/Magento_Review/layout/catalog_product_view.xml file. and after that i am calling it in /theme/Magento_review/template/form.phtml file like

<?php echo $block->getLayout()->getBlock('form.additional.info')->toHtml(); ?>. But after that no captcha is showing in the review form. Please help me to do it. Thanks