Jump to content

Add new products to compare from the comparision page


Recommended Posts

Has anyone attempted this, or perhaps already made a module?


Exactly what I'm looking for is the possibility to add products to compare on the comparison page, not on the category pages themselves.


Hopefully by some kind of ajax search...


If someone is willing to develop this, let me know, I'm willing to pay to get this function.

Link to comment
Share on other sites

  • 2 weeks later...

Just small hint


compareController.php, add



  public function initContent()

	if (isset($_GET['action'])) {
		if ($_GET['action'] == 'remove') {
			CompareProduct::removeCompareProduct((int)$this->context->cookie->id_compare, (int)Tools::getValue('id_product'));
		if ($_GET['action'] == 'add') {
			$id_compare = isset($this->context->cookie->id_compare) ? $this->context->cookie->id_compare : false;
			if (CompareProduct::getNumberProducts($id_compare) < Configuration::get('PS_COMPARATOR_MAX_ITEM'))
				CompareProduct::addCompareProduct($id_compare, (int)Tools::getValue('id_product'));


Then you can create form with input and send it to


with id product.

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

Really awesome advice, thanks!


Only problem is that it wreaks the funktion of the compare controller. I'm using 1.4.10, do you know if your code should work on that version?


Could it be that it should use a preProcess instead of initContent?

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