File tree Expand file tree Collapse file tree 1 file changed +4
-1
lines changed
app/code/Magento/Quote/Model/ResourceModel Expand file tree Collapse file tree 1 file changed +4
-1
lines changed Original file line number Diff line number Diff line change @@ -242,14 +242,17 @@ public function substractProductFromQuotes($product)
242
242
}
243
243
$ connection = $ this ->getConnection ();
244
244
$ 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) " ;
245
248
246
249
$ subSelect ->from (
247
250
false ,
248
251
[
249
252
'items_qty ' => new \Zend_Db_Expr (
250
253
$ connection ->quoteIdentifier ('q.items_qty ' ) . ' - ' . $ connection ->quoteIdentifier ('qi.qty ' )
251
254
),
252
- 'items_count ' => new \Zend_Db_Expr ($ connection -> quoteIdentifier ( ' q.items_count ' ) . ' - 1 ' )
255
+ 'items_count ' => new \Zend_Db_Expr ($ ifSql )
253
256
]
254
257
)->join (
255
258
['qi ' => $ this ->getTable ('quote_item ' )],
You can’t perform that action at this time.
0 commit comments