Merge pull request #4781 from rahulshukla-webkul/4779

Issue #4779 fixed
This commit is contained in:
Jitendra Singh 2021-04-08 14:50:58 +05:30 committed by GitHub
commit c434c62ebd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 0 deletions

View File

@ -865,6 +865,7 @@ class ProductRepository extends Repository
->selectRaw('SUM(' . DB::getTablePrefix() . 'product_inventories.qty)')
->from('product_flat')
->leftJoin('product_inventories', 'product_inventories.product_id', '=', 'product_flat.product_id')
->join('product_flat as variants', 'product_flat.id', '=', DB::raw('COALESCE(' . DB::getTablePrefix() . 'variants.parent_id, ' . DB::getTablePrefix() . 'variants.id)'))
->whereRaw(DB::getTablePrefix() . 'product_flat.parent_id = variants.id');
}, '>', 0);
});