I have created a custom template for the product page based on the attribute value.
in my template i used below code to display the review section.
<?php echo $block->getLayout()->createBlock("Magento\Catalog\Block\Product\View")->setTemplate("Magento_Catalog::product/view/review.phtml")->toHtml(); ?>
with this code, i can see the link 'Be the first to review the product'.
But after clicking the link, the review form tab is not expanding. Can anyone help me on this please?
sometimes in console i get this error,
Uncaught Error: no such method 'activate' for tabs widget instance
Please check this n share your ideas.
Thanks in Advance!!
-
you tried this code --- magento.stackexchange.com/a/195130/85907Mohit Patel– Mohit Patel2020年06月05日 19:31:08 +00:00Commented Jun 5, 2020 at 19:31
-
Yes @mohit, but no luckJafar Pinjar– Jafar Pinjar2020年06月06日 04:11:53 +00:00Commented Jun 6, 2020 at 4:11
-
After code you run all command with clear var/cache and var/view_process???Mohit Patel– Mohit Patel2020年06月06日 04:16:22 +00:00Commented Jun 6, 2020 at 4:16
-
Hi, why didn't you moved/edited the already existing review template(which contains the "Be the first to review the product/rating stars") ?Alex Constantinescu– Alex Constantinescu2020年06月06日 12:41:13 +00:00Commented Jun 6, 2020 at 12:41
-
I have a requirement to load separate product page based the product attribute, loaded the separate template for it.Jafar Pinjar– Jafar Pinjar2020年06月06日 14:45:14 +00:00Commented Jun 6, 2020 at 14:45
1 Answer 1
Add this code to layout XML of your extension :
<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\EXTENSION\Block\Order\Products" name="review_products" template="VENDOR_EXTENSION::proreview.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>
Now add your review.phtml code in to your phtml so it will work.
Happy coding.
-
hi @Mayur, can you explain briefly. its not working in default detail page alsoJafar Pinjar– Jafar Pinjar2020年07月06日 09:14:44 +00:00Commented Jul 6, 2020 at 9:14
Explore related questions
See similar questions with these tags.