Page 1 of 1

How to add a back / up button to category list?

Posted: Fri Jan 01, 2010 12:24 am
by eb_dev
Hi,

First of all I like to say great work with the shopping cart, i've found it the easiest cart to customise so far and look forward to using it more and more.

I've almost completed the customisation process on my cart but need to add a back button to my sub-categories list, or more specifically a button that goes up one category (providing there is a higher category). I'm listing my main categories along a top nav and my sub-categories in a column below that vertically.

Thanks,

eb_dev

Re: How to add a back / up button to category list?

Posted: Sat Jan 21, 2012 8:19 am
by solojuve1897
*Bump*

Thread from 2009 with no answer. It's exactly what I'm looking for, but for OpenCart 1.5.1.3

Any help?

Re: How to add a back / up button to category list?

Posted: Sun Jan 22, 2012 1:41 am
by celestial
solojuve1897 wrote:*Bump*

Thread from 2009 with no answer. It's exactly what I'm looking for, but for OpenCart 1.5.1.3

Any help?
Place this code where you need:

<div class="buttons">
<div class="right"><a onclick="javascript:history.go(-1)" class="button"><span><?php echo $text_go_back; ?></span></a></div>
</div>

I USE this code in the file catalog\view\theme\default\template\product\category.tpl in this place

<?php if (!$categories && !$products) { ?>
<div class="content">
<?php echo $text_empty; ?>
</div>
<div class="buttons">
<div class="right"><a onclick="javascript:history.go(-1)" class="button"><span><?php echo $text_go_back; ?></span></a></div>
</div>
<?php } else { ?>
<div class="buttons">
<div class="right"><a onclick="javascript:history.go(-1)" class="button"><span><?php echo $text_go_back; ?></span></a></div>
</div>
<?php } ?>


You must define (if multilingual) text_go_back in the language file and controller

catalog\language\english\product\category.php

add
$_['text_go_back'] = 'Go Back';

the same if use others languages.

catalog\controller\product\category\category.php

add

$this->data['text_go_back'] = $this->language->get('text_go_back');

Line 96

Re: How to add a back / up button to category list?

Posted: Sun Jan 22, 2012 1:45 am
by solojuve1897
Appreciated!

Works!