Jump to content
thirty bees forum
  • 0

"You have an error in your SQL syntax" when trying to enable Features


the.rampage.rado

Question

You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ')) GROUP BY fv.id_feature, IFNULL(fv.custom, 0)' at line 3

in file controllers/admin/AdminFeaturesController.php at line 745
 
SELECT id_feature, IFNULL(fv.custom, 0) as is_custom, COUNT(fv.id_feature_value) as count_values
FROM `ps_feature_value` fv
WHERE (fv.id_feature IN ())
GROUP BY fv.id_feature, IFNULL(fv.custom, 0)

 

 $ids = array_map('intval', array_column($this->_list, 'id_feature'));
728:            $extra = [];
729:            foreach ($ids as $id) {
730:                $extra[$id] = [
731:                    'value' => 0,
732:                    'custom' => 0,
733:                    'products' => 0,
734:                ];
735:            }
736:
737:            $conn = Db::getInstance(_PS_USE_SQL_SLAVE_);
738:
739:            // count feature values
740:            $valuesQuery = new DbQuery();
741:            $valuesQuery->select('id_feature, IFNULL(fv.custom, 0) as is_custom, COUNT(fv.id_feature_value) as count_values');
742:            $valuesQuery->from('feature_value', 'fv');
743:            $valuesQuery->where('fv.id_feature IN ('. implode(',', $ids).')');
744:            $valuesQuery->groupBy('fv.id_feature, IFNULL(fv.custom, 0)');
745:            $res = $conn->executeS($valuesQuery);
746:            if (is_array($res)) {
747:                foreach ($res as $row) {
748:                    $id = (int)$row['id_feature'];
749:                    if ($row['is_custom']) {
750:                        $extra[$id]['custom'] = (int)$row['count_values'];
751:                    } else {
752:                        $extra[$id]['value'] = (int)$row['count_values'];
753:                    }
754:                }
755:            }

 

What is causing this issue?

I'm on almost latest bleeding edge and I have features in other 2 shops with this version. I didn't need them in this one until now.

Cheers!

Link to comment
Share on other sites

4 answers to this question

Recommended Posts

  • 0

try to change:

$valuesQuery->select('id_feature, IFNULL(fv.custom, 0) as is_custom, COUNT(fv.id_feature_value) as count_values');

to:

$valuesQuery->select('fv.id_feature, IFNULL(fv.custom, 0) as is_custom, COUNT(fv.id_feature_value) as count_values');

 

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...