yogesh224 Posted June 7, 2017 Share Posted June 7, 2017 (edited) Hello Team, I am importing products csv in prestashop admin. I get following error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '`ps_product' at line 1 TRUNCATE TABLE `ps_product Server and version info: Prestashop Version: 1.4.8.2 PHP Version: 5.6.30 MySQL Version: 5.6.35 Is it server related issue. Any idea? Regards Vijay Edited June 7, 2017 by yogesh224 (see edit history) Link to comment Share on other sites More sharing options...
yogesh224 Posted June 9, 2017 Author Share Posted June 9, 2017 Any clues on this? Is it related to mysql server version or some issue with csv file? Regards Vijay Link to comment Share on other sites More sharing options...
DataKick Posted June 9, 2017 Share Posted June 9, 2017 This is invalid sql, it's missing closing quote. It should be TRUNCATE TABLE `ps_product` This sql is prepared by AdminImportController. So you have either modified controllers/admin/AdminImportController.php file and introduced this error, or installed some override that contains the bug. 1) check List of changed fiels in Advanced Parameters > Configuration information to see if AdminImportController is modified. If it's modified, override this file with original contet 2) If core file is not modified, then disable overrides, clear cache and see if the issue is still present. If it's fixed, then you need to find which module installed the override and either get rid of it, or fix it. Link to comment Share on other sites More sharing options...
yogesh224 Posted June 9, 2017 Author Share Posted June 9, 2017 Thanks Datakick, Since this is an older version of prestashop (1.4.8.2), I could locate a file admin/tabs/AdminImport.php. I am pasting few lines of that file here. ========== case $this->entities[$this->l('Products')]: Db::getInstance()->Execute('TRUNCATE TABLE `'._DB_PREFIX_.'product'); Db::getInstance()->Execute('TRUNCATE TABLE `'._DB_PREFIX_.'feature_product'); Db::getInstance()->Execute('TRUNCATE TABLE `'._DB_PREFIX_.'feature_product'); Db::getInstance()->Execute('TRUNCATE TABLE `'._DB_PREFIX_.'product_lang'); Db::getInstance()->Execute('TRUNCATE TABLE `'._DB_PREFIX_.'category_product'); Db::getInstance()->Execute('TRUNCATE TABLE `'._DB_PREFIX_.'product_tag'); Db::getInstance()->Execute('TRUNCATE TABLE `'._DB_PREFIX_.'image'); Db::getInstance()->Execute('TRUNCATE TABLE `'._DB_PREFIX_.'image_lang'); Db::getInstance()->Execute('TRUNCATE TABLE `'._DB_PREFIX_.'specific_price'); Db::getInstance()->Execute('TRUNCATE TABLE `'._DB_PREFIX_.'specific_price_priority'); =========== Though there is no cache, I could not locate the overrides setting in this version. Fyi, this was working fine on our old server, but we recently migrated to slighter upgraded version( PHP Version: 5.6.30,MySQL Version: 5.6.35) and this issue came up. Do I need to change any code in that file? Regards Vijay Link to comment Share on other sites More sharing options...
DataKick Posted June 9, 2017 Share Posted June 9, 2017 you need to edit this file and add closing qoute ` to all truncate table lines (or remove opening one) example: Db::getInstance()->Execute('TRUNCATE TABLE `'._DB_PREFIX_.'product`'); or remove opening quote Db::getInstance()->Execute('TRUNCATE TABLE '._DB_PREFIX_.'product'); 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