FutureLED Posted March 27, 2019 Share Posted March 27, 2019 Hi, I could use some help, when I amend or try to create products it doesn't save, I turned on error reporting and it gave me [PrestaShopDatabaseException] Unknown column 'cp.id_compare' in 'where clause' SELECT DISTINCT `id_product` FROM `ps_compare` c LEFT JOIN `ps_compare_product` cp ON (cp.`id_compare` = c.`id_compare`) WHERE cp.`id_compare` = 0 at line 646 in file classes/db/Db.php 641. WebserviceRequest::getInstance()->setError(500, '[SQL Error] '.$this->getMsgError().'. From '.(isset($dbg[3]['class']) ? $dbg[3]['class'] : '').'->'.$dbg[3]['function'].'() Query was : '.$sql, 97); 642. } 643. elseif (_PS_DEBUG_SQL_ && $errno && !defined('PS_INSTALLATION_IN_PROGRESS')) 644. { 645. if ($sql) 646. throw new PrestaShopDatabaseException($this->getMsgError().'<br /><br /><pre>'.$sql.'</pre>'); 647. throw new PrestaShopDatabaseException($this->getMsgError()); 648. } 649. } 650. 651. /** DbCore->displayError - [line 340 - classes/db/Db.php] - [1 Arguments] DbCore->query - [line 516 - classes/db/Db.php] - [1 Arguments] DbCore->executeS - [line 60 - classes/CompareProduct.php] - [1 Arguments] CompareProductCore::getCompareProducts - [line 112 - controllers/front/CategoryController.php] - [1 Arguments] CategoryControllerCore->initContent - [line 180 - classes/controller/Controller.php] ControllerCore->run - [line 373 - classes/Dispatcher.php] DispatcherCore->dispatch - [line 28 - index.php] Link to comment Share on other sites More sharing options...
NemoPS Posted March 28, 2019 Share Posted March 28, 2019 Looks like the database table is broken, you need to add id_compare as an INT (10) to ps_compare. Also, make sure it's set as primary key together with id_product Link to comment Share on other sites More sharing options...
FutureLED Posted March 28, 2019 Author Share Posted March 28, 2019 1 minute ago, NemoPS said: Looks like the database table is broken, you need to add id_compare as an INT (10) to ps_compare. Also, make sure it's set as primary key together with id_product Thanks for that, I'm no techie I'm afraid, I don't really understand the instruction, my site is working again but can't use the 'Save and Stay' and 'Save' buttons, they just return me to products page with no changes to the product, I'm pulling my hair out. Link to comment Share on other sites More sharing options...
NemoPS Posted March 29, 2019 Share Posted March 29, 2019 Well I am afraid some tech will be needed unless you are a developer. You need to add the id_compare column in phpmyadmin, as INT with length 10. Try googling it, then google about setting a primary key. Make sure you backup the database through cpanel first Link to comment Share on other sites More sharing options...
FutureLED Posted March 29, 2019 Author Share Posted March 29, 2019 Thanks for the assist. I wonder if I upgrade from current 1.6.0.13 to 1.6.1.23 would this rectify? Link to comment Share on other sites More sharing options...
NemoPS Posted March 30, 2019 Share Posted March 30, 2019 I am not sure the upgrade will do a table check to be honest, so if it doesn't you will have the same issue. 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