Skip to content

Commit 5b1eabd

Browse files
committed
MC-33499: Grid Filter not working for Scheduled Export when selected any kind of Entity Type
1 parent f55f411 commit 5b1eabd

File tree

1 file changed

+21
-1
lines changed
  • app/code/Magento/AdvancedPricingImportExport/Controller/Adminhtml/Export

1 file changed

+21
-1
lines changed

app/code/Magento/AdvancedPricingImportExport/Controller/Adminhtml/Export/GetFilter.php

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,28 @@ public function execute()
3434
/** @var $export \Magento\ImportExport\Model\Export */
3535
$export = $this->_objectManager->create(\Magento\ImportExport\Model\Export::class);
3636
$export->setData($data);
37+
$filter = (isset($data['filter']) && $data['filter']) ? $data['filter'] : null;
38+
$collection = $export->getEntityAttributeCollection();
39+
if (!is_null($filter)) {
40+
$filters = array_reduce(
41+
explode('&', base64_decode($filter)),
42+
function ($filter, $item) {
43+
list($key, $value) = explode('=', $item, 2);
44+
$filter[$key] = $value;
45+
return $filter;
46+
},
47+
[]
48+
);
49+
foreach ($filters as $field => $value) {
50+
foreach ($collection as $attribute) {
51+
if (stripos($attribute->getData($field), $value) === false) {
52+
$collection->removeItemByKey($attribute->getId());
53+
}
54+
}
55+
}
56+
}
3757
$export->filterAttributeCollection(
38-
$attrFilterBlock->prepareCollection($export->getEntityAttributeCollection())
58+
$attrFilterBlock->prepareCollection($collection)
3959
);
4060
return $resultLayout;
4161
} catch (\Exception $e) {

0 commit comments

Comments
 (0)