Page 1 of 1

Add compare product link

Posted: Mon Feb 23, 2015 11:50 pm
by s.freimanis
Hi All

I have found several topics about how to remove "compare products" link, however
I would like to add it somewhere at the top, lets say between "my account" and "Shopping cart"
so customer has an easy access to comparison list.

I have seen a topic for Open Cart 1.5.x. Unfortunately it does not work for OC 2.0

Forgot to mention, that I use default OpenCart 2.0.1.1 theme

Any advices please?

Re: Add compare product link

Posted: Wed Feb 25, 2015 12:22 am
by viethemes
You can edit the file catalog\view\theme\default\template\common\header.tpl, find

Code: Select all

<li><a href="<?php echo $wishlist; ?>" id="wishlist-total" title="<?php echo $text_wishlist; ?>"><i class="fa fa-heart"></i> <span class="hidden-xs hidden-sm hidden-md"><?php echo $text_wishlist; ?></span></a></li>
and add below code after that line

Code: Select all

<li><a href="<?php global $url; echo $url->link('product/compare'); ?>" title="Compare Product"><i class="fa fa-exchange"></i> <span class="hidden-xs hidden-sm hidden-md">Compare Product</span></a></li>

Re: Add compare product link

Posted: Wed Feb 25, 2015 5:12 pm
by s.freimanis
Thanks for advice, working now :)

However it appears in English only, so it is not translated
in other languages.

Any ideas?

Re: Add compare product link

Posted: Thu Feb 26, 2015 11:48 pm
by viethemes
s.freimanis wrote:Thanks for advice, working now :)

However it appears in English only, so it is not translated
in other languages.

Any ideas?
Hi,
Is your store multilingual or just one language?

Re: Add compare product link

Posted: Fri Feb 27, 2015 1:09 am
by s.freimanis
viethemes wrote:
s.freimanis wrote:Thanks for advice, working now :)

However it appears in English only, so it is not translated
in other languages.

Any ideas?
Hi,
Is your store multilingual or just one language?

It is multilingual site. Sorry, I did not mention it before.
It contains three languages.

Re: Add compare product link

Posted: Fri Feb 27, 2015 10:43 pm
by viethemes
You can try to replace with code below

Code: Select all

<li><a href="<?php global $url; echo $url->link('product/compare'); ?>" title="<?php global $language; echo $language->get('text_product_compare'); ?>"><i class="fa fa-exchange"></i> <span class="hidden-xs hidden-sm hidden-md"><?php echo $language->get('text_product_compare'); ?></span></a></li>
and go to each language file, for example catalog\language\english\default.php, add code below at the end of file

Code: Select all

$_['text_product_compare'] = 'Compare Products';
Note that translate the ablove text in each language.

Re: Add compare product link

Posted: Tue Mar 03, 2015 2:51 am
by s.freimanis
Working now!!! Thanks a lot!

In my case the main problem was, that after placing code, you need to go in admin panel of OpenCart -> Modifications and press on "Refresh"

Also the code provided <<< $_['text_product_compare'] = 'Compare Products'; >>> must be inserted at the end without
spaces before.


..................
$_['error_upload_7'] = 'Warning: Failed to write file to disk!';
$_['error_upload_8'] = 'Warning: File upload stopped by extension!';
$_['error_upload_999'] = 'Warning: No error code available!';

$_['text_product_compare'] = 'Compare Products';

Re: Add compare product link

Posted: Sat Jun 15, 2019 7:05 pm
by hassni
Please guide , i want to make different comparison banner on product page related to that product. i want comparison url of between products. when i add it products for compare, the seo url generates store.com/product_compare. I want the complete url of between products. Hope you will understand my query .