diff --git a/classes/CMS.php b/classes/CMS.php index a8df4d8b0..a1764ae03 100644 --- a/classes/CMS.php +++ b/classes/CMS.php @@ -100,10 +100,12 @@ class CMSCore extends ObjectModel SELECT c.id_cms, cl.link_rewrite, cl.meta_title FROM '._DB_PREFIX_.'cms c LEFT JOIN '._DB_PREFIX_.'cms_lang cl ON (c.id_cms = cl.id_cms AND cl.id_lang = '.(int)($id_lang).') + '.Context::getContext()->shop->addSqlAssociation('cms', 'c').' WHERE 1 '.(($selection !== null) ? ' AND c.id_cms IN ('.implode(',', array_map('intval', $selection)).')' : ''). ($active ? ' AND c.`active` = 1 ' : ''). - 'ORDER BY c.`position`'); + 'GROUP BY c.id_cms + ORDER BY c.`position`'); $links = array(); if ($result) @@ -124,8 +126,10 @@ class CMSCore extends ObjectModel SELECT c.id_cms, l.meta_title FROM '._DB_PREFIX_.'cms c JOIN '._DB_PREFIX_.'cms_lang l ON (c.id_cms = l.id_cms) + '.Context::getContext()->shop->addSqlAssociation('cms', 'c').' '.(($id_block) ? 'JOIN '._DB_PREFIX_.'block_cms b ON (c.id_cms = b.id_cms)' : '').' WHERE l.id_lang = '.(int)($id_lang).(($id_block) ? ' AND b.id_block = '.(int)($id_block) : '').($active ? ' AND c.`active` = 1 ' : '').' + GROUP BY c.id_cms ORDER BY c.`position`'); }