Skip to content

Commit 60704e8

Browse files
authored
[fix] "Numeric value out of range" on mass delete
From Backend area the following error occurred on mass delete all products : "SQLSTATE[22003]: Numeric value out of range: 1690 BIGINT UNSIGNED value is out of range"
1 parent f3fb417 commit 60704e8

File tree

1 file changed

+4
-1
lines changed
  • app/code/Magento/Quote/Model/ResourceModel

1 file changed

+4
-1
lines changed

app/code/Magento/Quote/Model/ResourceModel/Quote.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,14 +242,17 @@ public function substractProductFromQuotes($product)
242242
}
243243
$connection = $this->getConnection();
244244
$subSelect = $connection->select();
245+
$conditionCheck = $connection->quoteIdentifier('q.items_count') . " > 0";
246+
$conditionTrue = $connection->quoteIdentifier('q.items_count') . ' - 1';
247+
$ifSql = "IF (" . $conditionCheck . "," . $conditionTrue . ", 0)";
245248

246249
$subSelect->from(
247250
false,
248251
[
249252
'items_qty' => new \Zend_Db_Expr(
250253
$connection->quoteIdentifier('q.items_qty') . ' - ' . $connection->quoteIdentifier('qi.qty')
251254
),
252-
'items_count' => new \Zend_Db_Expr($connection->quoteIdentifier('q.items_count') . ' - 1')
255+
'items_count' => new \Zend_Db_Expr($ifSql)
253256
]
254257
)->join(
255258
['qi' => $this->getTable('quote_item')],

0 commit comments

Comments
 (0)