Jump to content
  • Checkout
  • Login
  • Get in touch


The e-commerce.

Adding Categories


Recommended Posts



I was wondering if it was possible to show the categories in the main page as well as showing in a menu?


Please see my link http://banshee.xssl.net/prguk.co.uk/index.php my client would like there to be a link to view all the categories with a image and title for that section.


Is this sort of thing possible and if so please could you let me know how to do it?


Many thanks in advance



Link to comment
Share on other sites

I know a way, it's probably not the most elegant but it works.

First, find includes/boxes/categories.php and make a copy of it and name it categories2.php

Open your new file categories2.php and do the following modifications:

Find function


and rename it to

function tep_show_category2

Then at the end of the file find

new infoBox($info_box_contents);

and rename it to

new infoBox2($info_box_contents);

Save that file.

Then open includes/classes/boxes.php

And add the following code before the ?> tag

class infoBox2 extends tableBox {

function infoBox2($contents) {

$info_box_contents = array();

$info_box_contents[] = array('text' => $this->infoBoxContents($contents));

$this->table_cellpadding = '1';

//$this->table_parameters = 'class="infoBox"';

$this->tableBox($info_box_contents, true);



function infoBoxContents($contents) {

$this->table_cellpadding = '3';

//$this->table_parameters = 'class="infoBoxContents"';

$info_box_contents = array();

$info_box_contents[] = array(array('text' => tep_draw_separator('pixel_trans.gif', '100%', '1')));

for ($i=0, $n=sizeof($contents); $i<$n; $i++) {

$info_box_contents[] = array(array('align' => (isset($contents[$i]['align']) ? $contents[$i]['align'] : ''),

'form' => (isset($contents[$i]['form']) ? $contents[$i]['form'] : ''),

'params' => 'class="boxText"',

'text' => (isset($contents[$i]['text']) ? $contents[$i]['text'] : '')));


$info_box_contents[] = array(array('text' => tep_draw_separator('pixel_trans.gif', '100%', '1')));

return $this->tableBox($info_box_contents);



Then wherever you want to display the list of categories add

<?php if ((USE_CACHE == 'true') && empty($SID)) {

echo tep_cache_categories_box2();

} else {

include(DIR_WS_BOXES . 'categories2.php');


It won’t add the pictures though, just the text.

Hope it works for you.

Link to comment
Share on other sites


This topic is now archived and is closed to further replies.

  • Create New...