Jump to content

Add Custom link to categories in categories block


Recommended Posts

The categories are displayed through a loop so if you hard code a link it will not be included in the loop.

 

To add a link just open modules/blockcategories/blockcategories.tpl and add your link either immediately after the opening <ul> or immediately before the closing </ul>. You will need to add your link as a list item.

<li><a href="http://www.yourlinkhere.com">Your Link Text</a></li>

Remember to create a modules folder in your theme and in that folder create a folder named blockcategories. Copy the blockcategories.tpl file into this folder so your custom link will not be erased when you upgrade.

 

Hope that helps!

 

Marty Shue

  • Like 1
Link to comment
Share on other sites

Yes, it works now. Setting cache to no did the trick. Thank you.

Is it also possible to add subcategories under that link?

 

The reason I wanted to add custom link is that I want to remove those "no_image" images under subcategories and keep the ones with images to show as defined. As I could`t find the answer for that I tried this alternative.

 

Anyway, thank you very much.

 

EDIT:

I found a way for subcategories:

 

<li class="submenu"><a href="#">Link with drop-down</a>

<ul>

<li><a href="#">Sub-item 1</a></li>

<li><a href="#">Sub-item 2</a></li>

 

One more question. Is it possible that the menu tree would open when a click a subcategory, like it normally does?

  • Like 1
Link to comment
Share on other sites

Glad it worked for you! I also see you found a way to add subcategories. If you plan to have a bunch of categories/subcategories this is going to be a lot of manual entry work for you. I hope you created the folders like I mentioned above or all your hard work will be lost when/if you upgrade your PS.

 

I think an easier way to remove the 'no_image' images would've been to simply comment out that section of the code (or remove if you prefer) or create your own custom 'no_image' graphic (with your logo or something).

 

Marty Shue

Link to comment
Share on other sites

Yes it would be much easier to comment out the no_images, but I have categories that I want to show images and those without images, which I want to show as a list.

As I don`t know the solution for that, I used custom links.

Also would it be Is possible that the menu tree would open when a click a subcategory, like it normally does?

I appreciate your help.

Link to comment
Share on other sites

  • 6 months later...
  • 2 years later...

The categories are displayed through a loop so if you hard code a link it will not be included in the loop.

 

To add a link just open modules/blockcategories/blockcategories.tpl and add your link either immediately after the opening <ul> or immediately before the closing </ul>. You will need to add your link as a list item.

<li><a href="http://www.yourlinkhere.com">Your Link Text</a></li>
Remember to create a modules folder in your theme and in that folder create a folder named blockcategories. Copy the blockcategories.tpl file into this folder so your custom link will not be erased when you upgrade.

 

Hope that helps!

 

Marty Shue

 

 

 

thats a good trick , but can you tell me how to add a custom link as a subcategory of category

Here is another question.. 

 

how to add a custom link as a subcategory of a category?

Link to comment
Share on other sites

thats a good trick , but can you tell me how to add a custom link as a subcategory of category

Here is another question.. 

 

how to add a custom link as a subcategory of a category?

 

 

This is not very hard. Please see the post above on how to do it. Here is part of the post that will help you -- 

 

I found a way for subcategories:

 

<li class="submenu"><a href="#">Link with drop-down</a>

<ul>

<li><a href="#">Sub-item 1</a></li>

<li><a href="#">Sub-item 2</a></li>

 

Hope that helps!

 

Marty Shue

Link to comment
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
×
×
  • Create New...