tallinn Posted August 29, 2016 Share Posted August 29, 2016 (edited) Hi. When trying to load my local shop I get this error: [PrestaShopDatabaseException] Unknown column 'image_shop.id_product' in 'on clause' And at line 791 in file classes/db/Db.php if ($webservice_call && $errno) { $dbg = debug_backtrace(); WebserviceRequest::getInstance()->setError(500, '[SQL Error] '.$this->getMsgError().'. From '.(isset($dbg[3]['class']) ? $dbg[3]['class'] : '').'->'.$dbg[3]['function'].'() Query was : '.$sql, 97); } elseif (_PS_DEBUG_SQL_ && $errno && !defined('PS_INSTALLATION_IN_PROGRESS')) { if ($sql) { throw new PrestaShopDatabaseException($this->getMsgError().'<br /><br /><pre>'.$sql.'</pre>'); } throw new PrestaShopDatabaseException($this->getMsgError()); } } I had an error before this that I solved. The previous error was simply because I had not set a theme. Then I set the theme and this error started showing up. Image_shop table does not have this column id_product in my database. My PrestaShop version is 1.6.1.6. EDIT: Here is more info from the error: DbCore->displayError - [line 425 - classes/db/Db.php] - [1 Arguments] DbCore->query - [line 643 - classes/db/Db.php] - [1 Arguments] DbCore->executeS - [line 2343 - classes/Product.php] - [1 Arguments] ProductCore::getNewProducts - [line 102 - modules/blocknewproducts/blocknewproducts.php] - [3 Arguments] BlockNewProducts->getNewProducts - [line 144 - modules/blocknewproducts/blocknewproducts.php] BlockNewProducts->hookdisplayHomeTab - [line 587 - classes/Hook.php] - [1 Arguments] HookCore::coreCallHook - [line 542 - classes/Hook.php] - [3 Arguments] HookCore::exec - [line 41 - controllers/front/IndexController.php] - [1 Arguments] IndexControllerCore->initContent - [line 189 - classes/controller/Controller.php] ControllerCore->run - [line 367 - classes/Dispatcher.php] DispatcherCore->dispatch - [line 28 - index.php] Should I simply add this column? Edited August 29, 2016 by tallinn (see edit history) Link to comment Share on other sites More sharing options...
rocky Posted September 1, 2016 Share Posted September 1, 2016 Yes, you should add the column. Here's what the table looks like on my PrestaShop v1.6.1.6 test site: Link to comment Share on other sites More sharing options...
tallinn Posted September 1, 2016 Author Share Posted September 1, 2016 Alright thanks. Is there any explanation as to why it does not contain this column in the first place? Link to comment Share on other sites More sharing options...
rocky Posted September 1, 2016 Share Posted September 1, 2016 I can't be sure what happened, since I don't know what you've done to your website. If you've upgraded from a previous version of PrestaShop, it could be a bug in the upgrade process. Link to comment Share on other sites More sharing options...
tallinn Posted September 1, 2016 Author Share Posted September 1, 2016 Ahh yes. That must be it. I imported data from an old version of PrestaShop to this database. I guess this column was not present in the older version. Now another question pops up. If I simply add the column it will not have a meaningful value. What should I do about that? Link to comment Share on other sites More sharing options...
rocky Posted September 1, 2016 Share Posted September 1, 2016 You could use a query like the following: INSERT INTO `ps_image_shop` (`id_product`, `id_image`, `id_shop`, `cover`, `hover`) SELECT `id_product`, `id_image`, 1, `cover`, `hover` FROM `ps_image` This will copy the ps_image data over to the ps_image_shop table, assuming you're not using multistore and your shop ID is 1. If you're using multistore, you'll need to run the query again for each of your shop IDs. Link to comment Share on other sites More sharing options...
tallinn Posted September 1, 2016 Author Share Posted September 1, 2016 Alright. Thanks. I will try this later today. 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