Skip to content

Commit afce3c9

Browse files
ENGCOM-4822: [Backport] wrong url redirect when edit product review from product view page #22430
- Merge Pull Request #22430 from ravi-chandra3197/magento2:patch-product-review-customer-redirect-2.2 - Merged commits: 1. 62fd9d2
2 parents ba3e643 + 62fd9d2 commit afce3c9

File tree

2 files changed

+20
-4
lines changed
  • app/code/Magento/Review

2 files changed

+20
-4
lines changed

app/code/Magento/Review/Block/Adminhtml/Edit/Form.php

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,17 +75,25 @@ protected function _prepareForm()
7575
$review = $this->_coreRegistry->registry('review_data');
7676
$product = $this->_productFactory->create()->load($review->getEntityPkValue());
7777

78+
$formActionParams =[
79+
'id' => $this->getRequest()->getParam('id'),
80+
'ret' => $this->_coreRegistry->registry('ret')
81+
];
82+
if ($this->getRequest()->getParam('productId')) {
83+
$formActionParams['productId'] = $this->getRequest()->getParam('productId');
84+
}
85+
if ($this->getRequest()->getParam('customerId')) {
86+
$formActionParams['customerId'] = $this->getRequest()->getParam('customerId');
87+
}
88+
7889
/** @var \Magento\Framework\Data\Form $form */
7990
$form = $this->_formFactory->create(
8091
[
8192
'data' => [
8293
'id' => 'edit_form',
8394
'action' => $this->getUrl(
8495
'review/*/save',
85-
[
86-
'id' => $this->getRequest()->getParam('id'),
87-
'ret' => $this->_coreRegistry->registry('ret')
88-
]
96+
$formActionParams
8997
),
9098
'method' => 'post',
9199
],

app/code/Magento/Review/Controller/Adminhtml/Product/Save.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,14 @@ public function execute()
7272
} else {
7373
$resultRedirect->setPath('*/*/');
7474
}
75+
$productId = $this->getRequest()->getParam('productId');
76+
if ($productId) {
77+
$resultRedirect->setPath("catalog/product/edit/id/$productId");
78+
}
79+
$customerId = (int)$this->getRequest()->getParam('customerId');
80+
if ($customerId) {
81+
$resultRedirect->setPath("customer/index/edit/id/$customerId");
82+
}
7583
return $resultRedirect;
7684
}
7785
$resultRedirect->setPath('review/*/');

0 commit comments

Comments
 (0)