Skip to content

Commit

Permalink
Fixed performance issue with stock query
Browse files Browse the repository at this point in the history
  • Loading branch information
jaapjansma committed Mar 28, 2023
1 parent 313310d commit d9f4a5b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"description":"Isotope Stock.",
"type": "contao-bundle",
"license":"AGPL-3.0-or-later",
"version": "1.0.15",
"version": "1.0.16",
"require": {
"contao/core-bundle": "^4.9",
"isotope/isotope-core": "^2.6",
Expand Down
6 changes: 3 additions & 3 deletions src/Helper/ProductHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -141,9 +141,9 @@ public static function loadStockInfoForProducts(array $product_ids) {
`tl_isotope_stock_account`.`type`,
`tl_isotope_stock_booking`.`product_id`
FROM `tl_isotope_stock_booking_line`
LEFT JOIN `tl_isotope_stock_booking` ON `tl_isotope_stock_booking`.`id` = `tl_isotope_stock_booking_line`.`pid`
LEFT JOIN `tl_isotope_stock_period` ON `tl_isotope_stock_period`.`id` = `tl_isotope_stock_booking`.`period_id` AND `tl_isotope_stock_period`.`active` = '1'
LEFT JOIN `tl_isotope_stock_account` ON `tl_isotope_stock_account`.`id` = `tl_isotope_stock_booking_line`.`account`
INNER JOIN `tl_isotope_stock_booking` ON `tl_isotope_stock_booking`.`id` = `tl_isotope_stock_booking_line`.`pid`
INNER JOIN `tl_isotope_stock_period` ON `tl_isotope_stock_period`.`id` = `tl_isotope_stock_booking`.`period_id` AND `tl_isotope_stock_period`.`active` = '1'
INNER JOIN `tl_isotope_stock_account` ON `tl_isotope_stock_account`.`id` = `tl_isotope_stock_booking_line`.`account`
WHERE `tl_isotope_stock_booking`.`product_id` IN(".implode(",", $pids).") OR `tl_isotope_stock_booking`.`product_id` IS NULL
GROUP BY `tl_isotope_stock_booking_line`.`account`, `tl_isotope_stock_booking`.`product_id`
ORDER BY `tl_isotope_stock_booking`.`product_id`
Expand Down

0 comments on commit d9f4a5b

Please sign in to comment.