How to display Comparison in Opencart header?
How to display Comparison in Opencart header?
09.12.2020
Описание
By default, only selected products, cart, account, menu, and so on are displayed in the template header. But in some cases, product comparisons are sorely lacking. On sites with a large catalog, this is important. All actions were tested on OpenCart 2.x and OcStore 2.x! First, let's output the future text anywhere in our template, I'll output it in the header: Go to catalog/view/theme/default/template/common/header.tpl Find this line:
And after it we insert this: Next we need to go to catalog/controller/common/header.php And after the line: Paste this: And finally, add the text_compare variable for each language (I have Russian and English): 1) Go to catalog/language/ru-ru/common/header.php Insert: 2) Go to catalog/language/en-gb/common/header.php Paste: That's all! We go to the store page and see the result.
<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><li><a href="<?php echo $compare; ?>" title="<?php echo $text_compare; ?>"><i class="fa fa-exchange"></i> <span id="compare-total" class="hidden-xs hidden-sm hidden-md"><?php echo $text_compare; ?></span></a></li>$data['text_checkout'] = $this->language->get('text_checkout');$data['text_compare'] = sprintf($this->language->get('text_compare'), (isset($this->session->data['compare']) ? count($this->session->data['compare']) : 0)); $data['compare'] = $this->url->link('product/compare', '', 'SSL');$data['text_compare'] = sprintf($this->language->get('text_compare'), (isset($this->session->data['compare']) ? count($this->session->data['compare']) : 0)); $data['compare'] = $this->url->link('product/compare', '', 'SSL');$_['text_compare'] = 'Сравнение товаров (%s)';$_['text_compare'] = 'Product сomparison (%s)';