Skip to content

Commit

Permalink
make query multistore compatible
Browse files Browse the repository at this point in the history
  • Loading branch information
matthieu-rolland committed Oct 5, 2022
1 parent 310da3c commit c12ce08
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions classes/module/Module.php
Original file line number Diff line number Diff line change
Expand Up @@ -1698,9 +1698,14 @@ public static function getModulesInstalled($position = 0)
*/
public static function getModulesInstalledAndEnabled()
{
$sql = 'SELECT m.* FROM `' . _DB_PREFIX_ . 'module` m WHERE `active` = 1';
$id_shops = Shop::getContextListShopID();

return Db::getInstance()->executeS($sql);
$select = 'SELECT m.`id_module`, m.`name`, m.`version`';
$from = ' FROM `' . _DB_PREFIX_ . 'module` m';
$from .= ' INNER JOIN `' . _DB_PREFIX_ . 'module_shop` ms ON ms.`id_module` = m.`id_module`';
$from .= ' AND ms.`id_shop` IN (' . (implode(',', array_map('intval', $id_shops))) . ')';

return Db::getInstance()->executeS($select . $from);
}

/**
Expand Down

0 comments on commit c12ce08

Please sign in to comment.