// Context in modules + Shop::sql* methods

This commit is contained in:
rMalie
2011-07-19 09:23:10 +00:00
parent 6551a3ece7
commit ff81f71449
25 changed files with 127 additions and 263 deletions
@@ -123,14 +123,14 @@ class StatsBestCategories extends ModuleGrid
// If a shop is selected, get all children categories for the shop
$categories = array();
if ($this->shopID || $this->shopGroupID)
if ($this->context->shop->getContextType() != Shop::CONTEXT_ALL)
{
$sql = 'SELECT c.nleft, c.nright
FROM '._DB_PREFIX_.'category c
WHERE c.id_category IN (
SELECT s.id_category
FROM '._DB_PREFIX_.'shop s
WHERE s.id_shop IN ('.(($this->shopID) ? $this->shopID : 'SELECT id_shop FROM '._DB_PREFIX_.'shop WHERE id_group_shop = '.$this->shopGroupID).')
WHERE s.id_shop IN ('.implode(', ', Shop::getListOfID($this->context)).')
)';
if ($result = Db::getInstance()->executeS($sql))
{