Jump to content

Unknown column 'image_shop.id_product' in 'on clause'


tallinn

Recommended Posts

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:

 

 

Should I simply add this column?

Edited by tallinn (see edit history)
Link to comment
Share on other sites

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

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

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...