2

I want to display review form in pop-up window.

  • I copied Form.php file from vendor/module-review/Block/Form.php to app/Company/Review/Block/Form.php
  • Added below code in app/design/frontend/Company/developer/Magento_Review/templates/product/view/list.phtml

echo $this->getLayout()->createBlock("Bhs\Review\Block\Form")->setTemplate("Magento_Review::form.phtml")->toHtml(); ?>

This open a review form in pop-up but reviewing are not saving. What I should do so reviews save in database.

1
  • I have completed this issues and will post answer to display review in pop-up.
    – Jarnail S
    Feb 15, 2017 at 3:51

1 Answer 1

2

Review-form can be displayed as follow:

I have moved the review listing to bottom of the page and moved review-form to above the review listing.

Code added in catalog_product_view.xml:

    <!-- moved the review-listing to bottom of main content -->
<move element="reviews.tab" destination="main.content" after="-"/>  

<!-- moved the form to bottom of main content,above the review listing -->
<move element="product.review.form" destination="main.content" before="reviews.tab"/>

Add Pop-up Code in above the form.phtml file. You can simple add any pop-up code in above the form.phtml.

Thats it and it simple display your review form in POP UP. Hope it will help someone. Post in comment if anyone need to display review-form in pop-up or show/hide on same page.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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