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( );
}
}
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
Code: Select all
http://example-shopurl.com/index.php?route=product/compare&v=93
Code: Select all
http://example-shopurl.com/index.php?route=product/compare&r=1&v=93
Code: Select all
http://example-shopurl.com/index.php?route=product/compare&r=1&v=0
It should work with seo-urls too.