Skip to content

Commit

Permalink
Merge pull request #1282 from mailchimp/Issue1279-2.2
Browse files Browse the repository at this point in the history
closes #1279 for magento 2.2
  • Loading branch information
gonzaloebiz authored Aug 16, 2021
2 parents e707abd + 767a754 commit bd51787
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 9 deletions.
48 changes: 40 additions & 8 deletions Ui/Component/Errors/Grid/Column/Batch.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,46 @@ public function prepareDataSource(array $dataSource)
{
if (isset($dataSource['data']['items'])) {
foreach ($dataSource['data']['items'] as &$item) {
$item[$this->getData('name')]['batch_id'] = [
'href' => $this->urlBuilder->getUrl(
'mailchimp/errors/getresponse',
['id' => $item['id']]
),
'label' => $item['batch_id'],
'hidden' => false,
];
$edit = false;
switch($item['regtype']) {
case \Ebizmarts\MailChimp\Helper\Data::IS_CUSTOMER:
$label = 'Edit customer';
$url = 'customer/index/edit';
$id = 'id';
$edit = true;
break;
case \Ebizmarts\MailChimp\Helper\Data::IS_ORDER:
$label = 'Edit order';
$url = 'sales/order/view';
$id = 'order_id';
$edit = true;
break;
case \Ebizmarts\MailChimp\Helper\Data::IS_PRODUCT:
$label = 'Edit product';
$url = 'catalog/product/edit';
$id = 'id';
$edit = true;
break;
}
$item[$this->getData('name')] = [
'download' => [
'href' => $this->urlBuilder->getUrl(
'mailchimp/errors/getresponse',
['id' => $item['id']]
),
'label' => 'Download Response'
]
];
if ($edit) {
$item[$this->getData('name')]['edit'] =
[
'href' => $this->urlBuilder->getUrl(
$url,
[$id => $item['original_id']]
),
'label' => $label
];
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion view/adminhtml/ui_component/mailchimp_errors_grid.xml
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="indexField" xsi:type="string">id</item>
<item name="label" xsi:type="string" translate="true">Download Response</item>
<item name="label" xsi:type="string" translate="true">Action</item>
</item>
</argument>
</actionsColumn>
Expand Down

0 comments on commit bd51787

Please sign in to comment.