Hi everyone. My site started giving me 500 error when I click on some, not all categories. Basically Best Sellers, price-drop and new products do work properly. But all the ones i created give me a 500 error. Any help or hint is appreciated.
Here is the actual error:
Decoded exception
Column 'active' in where clause is ambiguous
in fileclasses/Category.phpat line1727
SQL
SELECT c.*, cl.id_lang, cl.name, cl.description, cl.link_rewrite, cl.meta_title, cl.meta_keywords, cl.meta_description
FROM `tb_category` c
INNER JOIN tb_category_shop category_shop
ON (category_shop.id_category = c.id_category AND category_shop.id_shop = 1)
LEFT JOIN `tb_category_lang` cl ON (c.`id_category` = cl.`id_category` AND `id_lang` = 1 AND cl.id_shop = 1 )
LEFT JOIN `tb_category_group` cg ON (cg.`id_category` = c.`id_category`)
WHERE `id_parent` = 3
AND `active` = 1
AND cg.`id_group` =1
GROUP BY c.`id_category`
ORDER BY `level_depth` ASC, category_shop.`position` ASC
Source file: classes/Category.php
1708: public function getSubCategories($idLang, $active = true)
1709: {
1710: $sqlGroupsWhere = '';
1711: $sqlGroupsJoin = '';
1712: if (Group::isFeatureActive()) {
1713: $sqlGroupsJoin = 'LEFT JOIN `'._DB_PREFIX_.'category_group` cg ON (cg.`id_category` = c.`id_category`)';
1714: $groups = FrontController::getCurrentCustomerGroups();
1715: $sqlGroupsWhere = 'AND cg.`id_group` '.(count($groups) ? 'IN ('.implode(',', $groups).')' : '='.(int) Group::getCurrent()->id);
1716: }
1717:1718: $result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS(
1719: '
1720: SELECT c.*, cl.id_lang, cl.name, cl.description, cl.link_rewrite, cl.meta_title, cl.meta_keywords, cl.meta_description
1721: FROM `'._DB_PREFIX_.'category` c
1722: '.Shop::addSqlAssociation('category', 'c').'
1723: LEFT JOIN `'._DB_PREFIX_.'category_lang` cl ON (c.`id_category` = cl.`id_category` AND `id_lang` = '.(int) $idLang.' '.Shop::addSqlRestrictionOnLang('cl').')
1724: '.$sqlGroupsJoin.'
1725: WHERE `id_parent` = '.(int) $this->id.'
1726: '.($active ? 'AND `active` = 1' : '').'
1727: '.$sqlGroupsWhere.'
1728: GROUP BY c.`id_category`
1729: ORDER BY `level_depth` ASC, category_shop.`position` ASC'
1730: );
1731:1732: foreach ($result as &$row) {
1733: $row['id_image'] = (file_exists(_PS_CAT_IMG_DIR_.(int) $row['id_category'].'.jpg') || file_exists(_PS_CAT_IMG_DIR_.(int) $row['id_category'].'_thumb.jpg')) ? (int) $row['id_category'] : Language::getIsoById($idLang).'-default';
1734: $row['legend'] = 'no picture';
1735: }
1736:1737: return $result;
Question
movieseals
Hi everyone. My site started giving me 500 error when I click on some, not all categories. Basically Best Sellers, price-drop and new products do work properly. But all the ones i created give me a 500 error. Any help or hint is appreciated.
Here is the actual error:
Column 'active' in where clause is ambiguous
SQL
Source file: classes/Category.php
4 answers to this question
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now