Post by CodeSpace » Fri May 23, 2014 6:47 am

Hi
A good extension would be a function with which you can display predefined comparisons via a link.

compare.php

Code: Select all

private function checkCompare()
	{
	     //V is the value for the new product_id.
         //Multiple values ​​are separated by /.
         //One product: v=4
         //Multiple products: v=4/8/156/274 
		if ( !isset( $this->request->get['v'] ) )
		{
			return true;
		}
        //To delete the previous products set r=1
		if ( isset( $this->request->get['r'] ) && $this->request->get['r'] === '1' )
		{
			$this->session->data['compare'] = array();
		}
		if ( strpos( $this->request->get['v'], '/' ) !== false )
		{
			$products = explode( '/', $this->request->get['v'] );
			foreach ( $products as $product )
			{
				$this->request->post['product_id'] = ( int )$product;              
				$this->add( );
			}
		}
		else
		{
			$this->request->post['product_id'] = ( int )$this->request->get['v'];
			$this->add( );
		}
	}
Example
Delete all products and add product 35, 85 and 93

Code: Select all

http://example-shopurl.com/index.php?route=product/compare&r=1&v=35/93/85
Add product 93

Code: Select all

http://example-shopurl.com/index.php?route=product/compare&v=93
Delete all and add product 93

Code: Select all

http://example-shopurl.com/index.php?route=product/compare&r=1&v=93
Delete all products

Code: Select all

http://example-shopurl.com/index.php?route=product/compare&r=1&v=0

It should work with seo-urls too.

User avatar
Active Member

Posts

Joined
Mon Aug 06, 2012 9:26 pm

Post by DCivit » Wed Jun 25, 2014 4:02 pm

Hi, i`m looking for something like this.

Please, ¿ could you explain a little more about this modification ?

The file that should be modify is catalog/controller/product/compare.php ?
If somebody use this modification, default compare behavior will continue working ?
How should i use this to construct new links with predefined comparisons ?

Thanks for your comments in advanced. I do not see anybody working on this and i think this will be a great extension if somebody will work on this.

Best regards.

User avatar
Newbie

Posts

Joined
Fri Aug 10, 2012 9:25 am
Location - Spain, Madrid
Who is online

Users browsing this forum: No registered users and 3 guests