Jump to content
Latest News: (loading..)
Sign in to follow this  
grandpaj

Catagories in sub categories BS

Recommended Posts

Hi

 

Tsimi has provided me with code which will place sub categories on the category page in BS.  so I am sharing here for anyone that wants.

 

Thanks to Tsimi for the following code.

<?php
$ShowSubCategoriesIfIn = array('products');
if (in_array($category_depth, $ShowSubCategoriesIfIn)){
// show subcategory links!
  $categories_query = tep_db_query("select c.categories_id, cd.categories_name, c.categories_image, c.parent_id from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.parent_id = '" . (int)$current_category_id . "' and c.categories_id = cd.categories_id and cd.language_id = '" . (int)$languages_id . "' order by sort_order, cd.categories_name");
  $number_of_categories = tep_db_num_rows($categories_query);
  echo '<div class="row">';
  while($categories = tep_db_fetch_array($categories_query)){
  $cPath_new = tep_get_path($categories['categories_id']);
      echo '<div class="col-xs-6 col-sm-4">';
      echo '  <div class="text-center">';
      echo '    <a href="' . tep_href_link(FILENAME_DEFAULT, $cPath_new) . '">' . tep_image(DIR_WS_IMAGES . $categories['categories_image'], $categories['categories_name'], SUBCATEGORY_IMAGE_WIDTH, SUBCATEGORY_IMAGE_HEIGHT) . '</a>';
      echo '    <div class="caption text-center">';
      echo '      <h5><a href="' . tep_href_link(FILENAME_DEFAULT, $cPath_new) . '">' . $categories['categories_name'] . '</a></h5>';
      echo '    </div>';
      echo '  </div>';
      echo '</div>';
  }
  echo '</div>';
}
?>

Grandpa

Share this post


Link to post
Share on other sites

Where does that code need to be placed.


REMEMBER BACKUP, BACKUP AND BACKUP

Before installing the official version of oscommerce first look at a responsive version here

It's very easy to over complicate what are simple things in life

Share this post


Link to post
Share on other sites

@@14steve14

 

Hi Steve

 

Sorry,

 

index.php find

 

<div class="page-header">
  <h1><?php echo $catname; ?></h1>
</div>
<?php
if (tep_not_null($image['catdesc'])) {
  echo '<div class="well well-sm">' . $image['catdesc'] . '</div>';
}
?>
<div class="contentContainer">

 

Ive placed code here. but before the following

 

<?php
// optional Product List Filter
    if (PRODUCT_LIST_FILTER > 0) {

 

 

Cheers

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×