5

I have custom module page which has products on a slider.

When I click on slider product according to that product I want to show a Review - Rating Form on custom page which can be filled once by customer who logged-In.

Here is the page where I want to show review form : enter image description here

When I click on test product review form should be visible on a block.

Below form should be visible according to Product : enter image description here

Updated code (I tried this in my xml):

<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="1column" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
    <update handle="review_product_form_component"/>
    <referenceContainer name="content">
            <block class="<vendor>\Review\Block\Order\Products" name="thinkideas_review_products" template="<vendor>_Review::reviewproducts.phtml">
                <block class="Magento\Review\Block\Product\Review" name="reviews.order.test" as="reviews_testorder" template="Magento_Review::review.phtml" >

                    <block class="Magento\Review\Block\Form" name="product.review.form.test" as="review_form_order"/>
                    </block>
            </block>
    </referenceContainer>       
</body>

Any suggestion would be appreciated.

0

Add this code to layout XML of your custom module :

<referenceContainer name="content">
        <block class="Magento\Cookie\Block\RequireCookie" name="require-cookie" template="Magento_Cookie::require_cookie.phtml">
            <arguments>
                <argument name="triggers" xsi:type="array">
                    <item name="submitReviewButton" xsi:type="string">.review .action.submit</item>
                </argument>
            </arguments>
        </block>
            <block class="<vendor>\<module_name>\Block\Order\Products" name="review_products" template="<Vendor>_<Module>::reviewproducts.phtml">
                <block class="Magento\Review\Block\Product\Review" name="reviews.tab" as="reviews" template="Magento_Review::review.phtml" group="detailed_info">
                    <block class="Magento\Review\Block\Form" name="product.review.form" as="review_form">
                        <container name="product.review.form.fields.before" as="form_fields_before" label="Review Form Fields Before"/>
                    </block>
                </block>
            </block>
</referenceContainer>

Then append review phtml code to your phtml which you want to use as form.

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.