-
Notifications
You must be signed in to change notification settings - Fork 9.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #405 from akonosov/epam-4
[EPAM] Import/Export sprint #4
- Loading branch information
Showing
73 changed files
with
6,546 additions
and
634 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
app/code/Magento/AdvancedPricingImportExport/Controller/Adminhtml/Export/GetFilter.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
<?php | ||
/** | ||
* Copyright © 2015 Magento. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
namespace Magento\AdvancedPricingImportExport\Controller\Adminhtml\Export; | ||
|
||
use Magento\ImportExport\Controller\Adminhtml\Export as ExportController; | ||
use Magento\Framework\Controller\ResultFactory; | ||
use Magento\AdvancedPricingImportExport\Model\Export\AdvancedPricing as ExportAdvancedPricing; | ||
use Magento\Catalog\Model\Product as CatalogProduct; | ||
|
||
class GetFilter extends ExportController | ||
{ | ||
/** | ||
* Get grid-filter of entity attributes action. | ||
* | ||
* @return \Magento\Framework\Controller\ResultInterface | ||
*/ | ||
public function execute() | ||
{ | ||
$data = $this->getRequest()->getParams(); | ||
if ($this->getRequest()->isXmlHttpRequest() && $data) { | ||
try { | ||
if ($data['entity'] == ExportAdvancedPricing::ENTITY_ADVANCED_PRICING) { | ||
$data['entity'] = CatalogProduct::ENTITY; | ||
} | ||
/** @var \Magento\Framework\View\Result\Layout $resultLayout */ | ||
$resultLayout = $this->resultFactory->create(ResultFactory::TYPE_LAYOUT); | ||
/** @var $attrFilterBlock \Magento\ImportExport\Block\Adminhtml\Export\Filter */ | ||
$attrFilterBlock = $resultLayout->getLayout()->getBlock('export.filter'); | ||
/** @var $export \Magento\ImportExport\Model\Export */ | ||
$export = $this->_objectManager->create('Magento\ImportExport\Model\Export'); | ||
$export->setData($data); | ||
$export->filterAttributeCollection( | ||
$attrFilterBlock->prepareCollection($export->getEntityAttributeCollection()) | ||
); | ||
return $resultLayout; | ||
} catch (\Exception $e) { | ||
$this->messageManager->addError($e->getMessage()); | ||
} | ||
} else { | ||
$this->messageManager->addError(__('Please correct the data sent.')); | ||
} | ||
/** @var \Magento\Backend\Model\View\Result\Redirect $resultRedirect */ | ||
$resultRedirect = $this->resultFactory->create(ResultFactory::TYPE_REDIRECT); | ||
$resultRedirect->setPath('adminhtml/*/index'); | ||
return $resultRedirect; | ||
} | ||
} |
Oops, something went wrong.