1

I searched a lot to find solution for this problem and seems that many of them are searching for a solution. Finally I did it with a simple workaround it will be helpful to someone.I don't know whether there is a perfect solution.

Thank you

1 Answer 1

1

Add below code in your phtml file

<div id="review-mpdal" style="display: none"> 
            <?php echo $block->getLayout()->createBlock("Magento\Review\Block\Form")->setTemplate("Magento_Review::form.phtml")->toHtml(); ?> 
</div>

<script type="text/javascript">
    require(['jquery','Magento_Ui/js/modal/modal'],function($, modal) {
        'use strict';
        var options = {
            'type': 'popup',
            'title': '',
            'modalClass': 'review_form_modal',
            'responsive': true,
            'innerScroll': true,
            'buttons': [{
                text: $.mage.__('Back'),
                class: 'back_button_class',
                click: function () {
                    this.closeModal();
                    // any javascript coode
                }
            }]
        };

        var popup = modal(options, $('#review-mpdal'));
        $(".add").on('click',function(){
            $("#review-mpdal").modal("openModal");
        });

       });
    });
</script>
1
  • in what phtml file? Commented May 2, 2023 at 6:40

Your Answer

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

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