Can any one suggest. how to place review form in the Items Ordered (sales/order/view/order_id) Magento 2
1 Answer
You need to extend the sales_order_view.xml file in your design/module and add a block with a review form like the one on the product details page (see catalog_product_view.xml layout).
For example, to customize the layout defined in <Magento_Sales_module_dir>/view/frontend/layout/sales_order_view.xml
, you need to add a layout file with the same name in your custom theme, such as: <theme_dir>/Magento_Sales/layout/sales_order_view.xml
. Then do your customizations on the layout xml.
Example:
<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<referenceBlock name="sales.order.view">
<block class="Magento\Review\Block\Product\Review"
name="reviews.tab" as="reviews"
template="Magento_Review::review.phtml"
ifconfig="catalog/review/active">
<block class="Magento\Review\Block\Form"
name="product.review.form" as="review_form"
ifconfig="catalog/review/active">
<container name="product.review.form.fields.before" as="form_fields_before"
label="Review Form Fields Before"/>
</block>
</block>
</referenceBlock>
</body>
</page>