Skip to content

Commit

Permalink
magento#24468: Export Coupon Code Grid redirect to DashBoard when cre…
Browse files Browse the repository at this point in the history
…ate New Cart Price Rule

Fixed redirect -> not to dashboard but to edit page
Export disabled if rule is new (has no id)
  • Loading branch information
sofia committed Sep 15, 2019
1 parent 5ee35e5 commit 587f6e1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,12 @@ protected function _prepareColumns()
['header' => __('Times Used'), 'index' => 'times_used', 'width' => '50', 'type' => 'number']
);

$this->addExportType('*/*/exportCouponsCsv', __('CSV'));
$this->addExportType('*/*/exportCouponsXml', __('Excel XML'));
$priceRule = $this->_coreRegistry->registry(\Magento\SalesRule\Model\RegistryConstants::CURRENT_SALES_RULE);

if($priceRule->getId()) {
$this->addExportType('*/*/exportCouponsCsv', __('CSV'));
$this->addExportType('*/*/exportCouponsXml', __('Excel XML'));
}
return parent::_prepareColumns();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public function execute()
)->getCsvFile();
return $this->_fileFactory->create($fileName, $content, DirectoryList::VAR_DIR);
} else {
$this->_redirect('sales_rule/*/detail', ['_current' => true]);
$this->_redirect('sales_rule/*/edit', ['_current' => true]);
return;
}
}
Expand Down

0 comments on commit 587f6e1

Please sign in to comment.