Skip to content

Commit 917dccc

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

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

app/code/Magento/ImportExport/Model/ResourceModel/Export/AttributeGridCollection.php

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,7 @@ public function getSize(): int
4646
public function addFieldToFilter($field, $condition)
4747
{
4848
if (isset($condition['like'])) {
49-
$value = trim((string)$condition['like'], "'%");
50-
$value = str_replace('\\','',$value);
49+
$value = $this->unescapeLikeValue((string)$condition['like']);
5150
$this->addFilter($field, $value);
5251
}
5352

@@ -106,4 +105,20 @@ private function sortCollectionByAttributeCode()
106105

107106
return $this;
108107
}
108+
109+
/**
110+
* Unescape 'like' value from condition
111+
*
112+
* @param string $likeValue
113+
* @return string
114+
*/
115+
private function unescapeLikeValue(string $likeValue): string
116+
{
117+
$replaceFrom = ['\\\\', '\_', '\%'];
118+
$replaceTo = ['\\', '_', '%'];
119+
$value = trim($likeValue, "'%");
120+
$value = str_replace($replaceFrom, $replaceTo, $value);
121+
122+
return $value;
123+
}
109124
}

0 commit comments

Comments
 (0)