Skip to content

Commit

Permalink
Fix fatal errors with deleteOptionsAndSelections
Browse files Browse the repository at this point in the history
  • Loading branch information
kassner committed Mar 26, 2017
1 parent 9b977b0 commit 1886e26
Showing 1 changed file with 9 additions and 5 deletions.
Expand Up @@ -629,8 +629,13 @@ protected function _initAttributes()
*/
protected function deleteOptionsAndSelections($productIds)
{
if (empty($productIds)) {
return $this;
}

$optionTable = $this->_resource->getTableName('catalog_product_bundle_option');
$optionValueTable = $this->_resource->getTableName('catalog_product_bundle_option_value');
$selectionTable = $this->_resource->getTableName('catalog_product_bundle_selection');
$valuesIds = $this->connection->fetchAssoc($this->connection->select()->from(
['bov' => $optionValueTable],
['value_id']
Expand All @@ -643,17 +648,16 @@ protected function deleteOptionsAndSelections($productIds)
$productIds
));
$this->connection->delete(
$optionTable,
$optionValueTable,
$this->connection->quoteInto('value_id IN (?)', array_keys($valuesIds))
);
$productIdsInWhere = $this->connection->quoteInto('parent_id IN (?)', $productIds);
$this->connection->delete(
$optionTable,
$this->connection->quoteInto('parent_id IN (?)', $productIdsInWhere)
$this->connection->quoteInto('parent_id IN (?)', $productIds)
);
$this->connection->delete(
$optionTable,
$this->connection->quoteInto('parent_product_id IN (?)', $productIdsInWhere)
$selectionTable,
$this->connection->quoteInto('parent_product_id IN (?)', $productIds)
);
return $this;
}
Expand Down

0 comments on commit 1886e26

Please sign in to comment.