Jump to content

Error when creating products


Recommended Posts

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

 

Link to comment
Share on other sites

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

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

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