Forums / Templates, Stylesheets, Page Layout / Need to Add a Link in the Categories Box

Need to Add a Link in the Categories Box

Locked

Views: 556

Results 1 to 6 of 6
This thread is locked. New replies are disabled.
14 Dec 2010, 10:32 PM
#1
nehesh avatar

nehesh

New Zenner

Join Date:
Dec 2010
Location:
Sacramento, CA
Posts:
4
Plugin Contributions:
0

Need to Add a Link in the Categories Box

I can't find this anywhere on the forum or FAQs.

On the left side of the Cart is the CATEGORIES box. I have my categories that I have added through the ADMIN panel... but I need to add an outside link that isn't linked to the actual Zencart. Please help?

I've tried editing the tpl_categories.php file... but I can't figure out where to add the text with a link. I just need it in the Categories box on the left, under the current category names. (Under Quilts / Wall Hangings). I need it to look like a Category Name, but link somewhere else.

Link to site: http://www.lazydogdesigns.com/ecart

Thanks so much!

14 Dec 2010, 11:10 PM
#2
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: Need to Add a Link in the Categories Box

I answered this for someone else a few hours ago. You might try a basic search before posting a new question.
Can I add alink in the Categories Sidebox?

In your case, you would use a "subtext" comment on the last category to put your link content in.

14 Dec 2010, 11:12 PM
#3
nehesh avatar

nehesh

New Zenner

Join Date:
Dec 2010
Location:
Sacramento, CA
Posts:
4
Plugin Contributions:
0

Re: Need to Add a Link in the Categories Box

I saw that, but it didn't answer my question... in fact, I figured out how to fix it.

I edited the tpl_categories.php file.

After this array of code:

 $content .= '<div id="' . str_replace('_', '-', $box_id . 'Content') . '" class="sideBoxContent">' . "\n";
  for ($i=0;$i<sizeof($box_categories_array);$i++) {
    switch(true) {
// to make a specific category stand out define a new class in the stylesheet example: A.category-holiday
// uncomment the select below and set the cPath=3 to the cPath= your_categories_id
// many variations of this can be done
//      case ($box_categories_array[$i]['path'] == 'cPath=3'):
//        $new_style = 'category-holiday';
//        break;
      case ($box_categories_array[$i]['top'] == 'true'):
        $new_style = 'category-top';
        break;
      case ($box_categories_array[$i]['has_sub_cat']):
        $new_style = 'category-subs';
        break;
      default:
        $new_style = 'category-products';
      }
     if (zen_get_product_types_to_category($box_categories_array[$i]['path']) == 3 or ($box_categories_array[$i]['top'] != 'true' and SHOW_CATEGORIES_SUBCATEGORIES_ALWAYS != 1)) {
      } else {
      $content .= '<a class="' . $new_style . '" href="' . zen_href_link(FILENAME_DEFAULT, $box_categories_array[$i]['path']) . '">';
      if ($box_categories_array[$i]['current']) {
        if ($box_categories_array[$i]['has_sub_cat']) {
          $content .= '<span class="category-subs-parent">' . $box_categories_array[$i]['name'] . '</span>';
        } else {
          $content .= '<span class="category-subs-selected">' . $box_categories_array[$i]['name'] . '</span>';
        }
      } else {
        $content .= $box_categories_array[$i]['name'];
      }

      if ($box_categories_array[$i]['has_sub_cat']) {
        $content .= CATEGORIES_SEPARATOR;
      }
      $content .= '</a>';

      if (SHOW_COUNTS == 'true') {
        if ((CATEGORIES_COUNT_ZERO == '1' and $box_categories_array[$i]['count'] == 0) or $box_categories_array[$i]['count'] >= 1) {
          $content .= CATEGORIES_COUNT_PREFIX . $box_categories_array[$i]['count'] . CATEGORIES_COUNT_SUFFIX;
        }
      }
      $content .= '<br />' . "\n";
    }
  }

I added this code, and it populated the Text with the link I needed:

  $content .= '<a class="category-top" href="http://LINK">TEXT</a>';
14 Dec 2010, 11:17 PM
#4
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: Need to Add a Link in the Categories Box

Actually, it did contain an answer to your need, but what you did, for the very simple purpose you had, was a good way to do it.

14 Dec 2010, 11:28 PM
#5
nehesh avatar

nehesh

New Zenner

Join Date:
Dec 2010
Location:
Sacramento, CA
Posts:
4
Plugin Contributions:
0

Re: Need to Add a Link in the Categories Box

gjh42:

Actually, it did contain an answer to your need, but what you did, for the very simple purpose you had, was a good way to do it.

You're right. It did contain an answer... Your answer was what I had came up with, but it was still in the wrong place for where I needed it. The other answer was long, and cumbersome.