@@ -183,7 +183,8 @@ protected function parseSelections($rowData, $entityId)
183
183
);
184
184
$ selections = explode (
185
185
Product::PSEUDO_MULTI_LINE_SEPARATOR ,
186
- str_replace ('? ' , '? ' , $ rowData ['bundle_values ' ])
186
+ $ rowData ['bundle_values ' ]
187
+ //str_replace('?', '?', $rowData['bundle_values'])
187
188
);
188
189
foreach ($ selections as $ selection ) {
189
190
$ values = explode ($ this ->_entityModel ->getMultipleValueSeparator (), $ selection );
@@ -199,11 +200,7 @@ protected function parseSelections($rowData, $entityId)
199
200
$ this ->_cachedOptions [$ entityId ][$ option ['name ' ]]['selections ' ] = [];
200
201
}
201
202
$ this ->_cachedOptions [$ entityId ][$ option ['name ' ]]['selections ' ][] = $ option ;
202
- $ this ->_cachedOptionSelectQuery [] =
203
- $ this ->connection ->quoteInto (
204
- '(parent_id = ' . (int )$ entityId . ' AND title = ?) ' ,
205
- $ option ['name ' ]
206
- );
203
+ $ this ->_cachedOptionSelectQuery [] = 'parent_id = ' . (int )$ entityId . ' AND title = ' . $ option ['name ' ];
207
204
}
208
205
}
209
206
return $ selections ;
@@ -474,18 +471,25 @@ protected function transformBundleCustomAttributes($rowData)
474
471
*/
475
472
protected function populateExistingOptions ()
476
473
{
477
- $ existingOptions = $ this ->connection ->fetchAssoc (
478
- $ this ->connection ->select ()->from (
479
- ['bo ' => $ this ->_resource ->getTableName ('catalog_product_bundle_option ' )],
480
- ['option_id ' , 'parent_id ' , 'required ' , 'position ' , 'type ' ]
481
- )->joinLeft (
482
- ['bov ' => $ this ->_resource ->getTableName ('catalog_product_bundle_option_value ' )],
483
- 'bo.option_id = bov.option_id ' ,
484
- ['value_id ' , 'title ' ]
485
- )->where (
486
- implode (' OR ' , $ this ->_cachedOptionSelectQuery )
487
- )
474
+ $ select = $ this ->connection ->select ()->from (
475
+ ['bo ' => $ this ->_resource ->getTableName ('catalog_product_bundle_option ' )],
476
+ ['option_id ' , 'parent_id ' , 'required ' , 'position ' , 'type ' ]
477
+ )->joinLeft (
478
+ ['bov ' => $ this ->_resource ->getTableName ('catalog_product_bundle_option_value ' )],
479
+ 'bo.option_id = bov.option_id ' ,
480
+ ['value_id ' , 'title ' ]
488
481
);
482
+ $ orWhere = false ;
483
+ foreach ($ this ->_cachedOptionSelectQuery as $ item ) {
484
+ $ expItem = explode ('= ' ,$ item );
485
+ if ($ orWhere ) {
486
+ $ select ->orWhere ($ expItem [0 ].' = ' .$ expItem [1 ].' = ? ' , $ expItem [2 ]);
487
+ } else {
488
+ $ select ->where ($ expItem [0 ].' = ' .$ expItem [1 ].' = ? ' , $ expItem [2 ]);
489
+ $ orWhere = true ;
490
+ }
491
+ }
492
+ $ existingOptions = $ this ->connection ->fetchAssoc ($ select );
489
493
foreach ($ existingOptions as $ optionId => $ option ) {
490
494
$ this ->_cachedOptions [$ option ['parent_id ' ]][$ option ['title ' ]]['option_id ' ] = $ optionId ;
491
495
foreach ($ option as $ key => $ value ) {
0 commit comments