Skip to content

Commit b405e1d

Browse files
ENGCOM-4822: [Backport] wrong url redirect when edit product review from product view page #22430
2 parents 6c9b2a2 + 5920eef commit b405e1d

File tree

2 files changed

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

2 files changed

+22
-4
lines changed

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

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
* See COPYING.txt for license details.
55
*/
66

7+
78
/**
89
* Adminhtml Review Edit Form
910
*/
@@ -69,23 +70,32 @@ public function __construct(
6970
*
7071
* @return $this
7172
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
73+
* @SuppressWarnings(PHPMD.RequestAwareBlockMethod)
7274
*/
7375
protected function _prepareForm()
7476
{
7577
$review = $this->_coreRegistry->registry('review_data');
7678
$product = $this->_productFactory->create()->load($review->getEntityPkValue());
7779

80+
$formActionParams =[
81+
'id' => $this->getRequest()->getParam('id'),
82+
'ret' => $this->_coreRegistry->registry('ret')
83+
];
84+
if ($this->getRequest()->getParam('productId')) {
85+
$formActionParams['productId'] = $this->getRequest()->getParam('productId');
86+
}
87+
if ($this->getRequest()->getParam('customerId')) {
88+
$formActionParams['customerId'] = $this->getRequest()->getParam('customerId');
89+
}
90+
7891
/** @var \Magento\Framework\Data\Form $form */
7992
$form = $this->_formFactory->create(
8093
[
8194
'data' => [
8295
'id' => 'edit_form',
8396
'action' => $this->getUrl(
8497
'review/*/save',
85-
[
86-
'id' => $this->getRequest()->getParam('id'),
87-
'ret' => $this->_coreRegistry->registry('ret')
88-
]
98+
$formActionParams
8999
),
90100
'method' => 'post',
91101
],

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)