File tree Expand file tree Collapse file tree 1 file changed +24
-0
lines changed
lib/internal/Magento/Framework/Api/SearchCriteria/CollectionProcessor Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -85,6 +85,8 @@ private function addFilterGroupToCollection(
8585 }
8686 }
8787
88+ $ this ->checkFromTo ($ fields , $ conditions );
89+
8890 if ($ fields ) {
8991 $ collection ->addFieldToFilter ($ fields , $ conditions );
9092 }
@@ -125,4 +127,26 @@ private function getFieldMapping($field)
125127 {
126128 return $ this ->fieldMapping [$ field ] ?? $ field ;
127129 }
130+
131+ /**
132+ * Check filtergoup for type from & to
133+ *
134+ * @param string[] $fields
135+ * @param array<string[]> $conditions
136+ * @return void
137+ */
138+ private function checkFromTo (&$ fields , &$ conditions )
139+ {
140+ $ _fields = array_unique ($ fields );
141+ $ _conditions = [];
142+ foreach ($ conditions as $ condition ) {
143+ $ _conditions [array_key_first ($ condition )] = array_first ($ condition );
144+ }
145+ if ((count ($ _fields ) == 1 ) && (count ($ _conditions ) == 2 )
146+ && isset ($ _conditions ['from ' ]) && isset ($ _conditions ['to ' ])
147+ ) {
148+ $ fields = $ _fields ;
149+ $ conditions = [$ _conditions ];
150+ }
151+ }
128152}
You can’t perform that action at this time.
0 commit comments