Skip to content

Commit cd8f6bf

Browse files
product back redirect navigate from customer view cart product
1 parent 89cf888 commit cd8f6bf

File tree

2 files changed

+28
-5
lines changed
  • app/code/Magento
    • Catalog/Block/Adminhtml/Product/Edit/Button
    • Customer/Block/Adminhtml/Edit/Tab

2 files changed

+28
-5
lines changed

app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Button/Back.php

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,32 @@
1111
class Back extends Generic
1212
{
1313
/**
14+
* Get Button Data
15+
*
1416
* @return array
1517
*/
1618
public function getButtonData()
1719
{
1820
return [
1921
'label' => __('Back'),
20-
'on_click' => sprintf("location.href = '%s';", $this->getUrl('*/*/')),
22+
'on_click' => sprintf("location.href = '%s';", $this->getBackUrl()),
2123
'class' => 'back',
2224
'sort_order' => 10
2325
];
2426
}
27+
/**
28+
* Get URL for back
29+
*
30+
* @return string
31+
*/
32+
private function getBackUrl()
33+
{
34+
if ($this->context->getRequestParam('customerId')) {
35+
return $this->getUrl(
36+
'customer/index/edit',
37+
['id' => $this->context->getRequestParam('customerId')]
38+
);
39+
}
40+
return $this->getUrl('*/*/');
41+
}
2542
}

app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/Cart.php

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ public function __construct(
7575
}
7676

7777
/**
78-
* {@inheritdoc}
78+
* @inheritdoc
7979
*/
8080
protected function _construct()
8181
{
@@ -119,7 +119,7 @@ protected function _prepareCollection()
119119
}
120120

121121
/**
122-
* {@inheritdoc}
122+
* @inheritdoc
123123
*/
124124
protected function _prepareColumns()
125125
{
@@ -201,7 +201,7 @@ public function getCustomerId()
201201
}
202202

203203
/**
204-
* {@inheritdoc}
204+
* @inheritdoc
205205
*/
206206
public function getGridUrl()
207207
{
@@ -224,7 +224,13 @@ public function getGridParentHtml()
224224
*/
225225
public function getRowUrl($row)
226226
{
227-
return $this->getUrl('catalog/product/edit', ['id' => $row->getProductId()]);
227+
return $this->getUrl(
228+
'catalog/product/edit',
229+
[
230+
'id' => $row->getProductId(),
231+
'customerId' => $this->getCustomerId()
232+
]
233+
);
228234
}
229235

230236
/**

0 commit comments

Comments
 (0)