diff --git a/Ui/Component/Errors/Grid/Column/Batch.php b/Ui/Component/Errors/Grid/Column/Batch.php index 2a9a2824..e5c51ea3 100644 --- a/Ui/Component/Errors/Grid/Column/Batch.php +++ b/Ui/Component/Errors/Grid/Column/Batch.php @@ -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 + ]; + } } } diff --git a/view/adminhtml/ui_component/mailchimp_errors_grid.xml b/view/adminhtml/ui_component/mailchimp_errors_grid.xml index 7cff0448..9679b0c9 100644 --- a/view/adminhtml/ui_component/mailchimp_errors_grid.xml +++ b/view/adminhtml/ui_component/mailchimp_errors_grid.xml @@ -117,7 +117,7 @@ id - Download Response + Action