Skip to content

Commit 1886e26

Browse files
committed
Fix fatal errors with deleteOptionsAndSelections
1 parent 9b977b0 commit 1886e26

File tree

1 file changed

+9
-5
lines changed
  • app/code/Magento/BundleImportExport/Model/Import/Product/Type

1 file changed

+9
-5
lines changed

app/code/Magento/BundleImportExport/Model/Import/Product/Type/Bundle.php

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -629,8 +629,13 @@ protected function _initAttributes()
629629
*/
630630
protected function deleteOptionsAndSelections($productIds)
631631
{
632+
if (empty($productIds)) {
633+
return $this;
634+
}
635+
632636
$optionTable = $this->_resource->getTableName('catalog_product_bundle_option');
633637
$optionValueTable = $this->_resource->getTableName('catalog_product_bundle_option_value');
638+
$selectionTable = $this->_resource->getTableName('catalog_product_bundle_selection');
634639
$valuesIds = $this->connection->fetchAssoc($this->connection->select()->from(
635640
['bov' => $optionValueTable],
636641
['value_id']
@@ -643,17 +648,16 @@ protected function deleteOptionsAndSelections($productIds)
643648
$productIds
644649
));
645650
$this->connection->delete(
646-
$optionTable,
651+
$optionValueTable,
647652
$this->connection->quoteInto('value_id IN (?)', array_keys($valuesIds))
648653
);
649-
$productIdsInWhere = $this->connection->quoteInto('parent_id IN (?)', $productIds);
650654
$this->connection->delete(
651655
$optionTable,
652-
$this->connection->quoteInto('parent_id IN (?)', $productIdsInWhere)
656+
$this->connection->quoteInto('parent_id IN (?)', $productIds)
653657
);
654658
$this->connection->delete(
655-
$optionTable,
656-
$this->connection->quoteInto('parent_product_id IN (?)', $productIdsInWhere)
659+
$selectionTable,
660+
$this->connection->quoteInto('parent_product_id IN (?)', $productIds)
657661
);
658662
return $this;
659663
}

0 commit comments

Comments
 (0)