Zigmunds Posted July 30, 2020 Share Posted July 30, 2020 Hello dear PrestaShop friends and developers, I have Prestashop 1.7.6.7 version and get an issue in back office on Monitoring page. Bad SQL query Unknown column 'sa.active' in 'where clause' ... And I don't see products without pictures anymore on Monitoring page. I din't find any solution on Google. Could you please provide me with help, how to resolve this issue? Thank you very much! Link to comment Share on other sites More sharing options...
Naveed Ahamed Posted September 19, 2020 Share Posted September 19, 2020 Hi, right now I'm facing the same issue and I dont know which non native modules to override or disable. Would really appreciate if anyone could help me out? Link to comment Share on other sites More sharing options...
iSung Posted March 6, 2021 Share Posted March 6, 2021 sup? Link to comment Share on other sites More sharing options...
MG Markets Posted July 17, 2021 Share Posted July 17, 2021 Insert in classes / controller / AdminController.php at line 898 this code snippet: if(!empty($filters['trackingproducts_without_photoFilter_active'])){ $alias = 'a'; } This should be like this: if (isset($value[1]) && !empty($value[1])) { if (!Validate::isDate($value[1])) { $this->errors[] = $this->trans('The \'To\' date format is invalid (YYYY-MM-DD)', array(), 'Admin.Notifications.Error'); } else { $sql_filter .= ' AND '.pSQL($key).' <= \''.pSQL(Tools::dateTo($value[1])).'\''; } } } else { $sql_filter .= ' AND '; $check_key = ($key == $this->identifier || $key == '`'.$this->identifier.'`'); $alias = ($definition && !empty($definition['fields'][$filter]['shop'])) ? 'sa' : 'a'; ---> if(!empty($filters['trackingproducts_without_photoFilter_active'])){ $alias = 'a'; } <--- inserted if ($type == 'int' || $type == 'bool') { $sql_filter .= (($check_key || $key == '`active`') ? $alias.'.' : '').pSQL($key).' = '.(int)$value.' '; } elseif ($type == 'decimal') { $sql_filter .= ($check_key ? $alias.'.' : '').pSQL($key).' = '.(float)$value.' '; } elseif ($type == 'select') { $sql_filter .= ($check_key ? $alias.'.' : '').pSQL($key).' = \''.pSQL($value).'\' '; } elseif ($type == 'price') { $value = (float)str_replace(',', '.', $value); $sql_filter .= ($check_key ? $alias.'.' : '').pSQL($key).' = '.pSQL(trim($value)).' '; } else { $sql_filter .= ($check_key ? $alias.'.' : '').pSQL($key).' LIKE \'%'.pSQL(trim($value)).'%\' '; } I found this solution on https://github.com/PrestaShop/PrestaShop/issues/14923 I inserted it directly but it is better to put it in the override so it would not be overwritten when a update is made. Link to comment Share on other sites More sharing options...
SmartDataSoft Posted July 19, 2021 Share Posted July 19, 2021 Hello, In AdminMyworldProducts controller. you show product and you try to handle the sorting of the product. In your sorting query you use sa.active for filter , you an check your table name is alias with sa in the query or you have different alias. This occur some time when we copy paste the query from other place If you paste the code of your AdminMyworldProducts code then we can check and give you a right answer Thank you Link to comment Share on other sites More sharing options...
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