Jump to content
amnesiak

Add Custom link to categories in categories block

Recommended Posts

Hello,

Is it possible to add a custom link to specific category in the categories block?

Share this post


Link to post
Share on other sites

Hi Marty,

Can you please tell me how can I do it and why wouldn`t you suggest it.

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

Hi Marty,

I tried the code but nothing changes when I paste it. It does not show at categories block. (force compile is on)

I pasted it in different places as suggested,

Share this post


Link to post
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

Share this post


Link to post
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

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

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.

 

 

amnesiak, did you ever manage to get this fixed? I have the same issue!

 

Thanks...

Share this post


Link to post
Share on other sites

can anyone respond to my case please


 


I have a category and subcategories under it 


 


i want to add a custom link to the end of the subcategory 

Share this post


Link to post
Share on other sites

can anyone respond to my case please


 


I have a category and subcategories under it 


 


i want to add a custom link to the end of the subcategory 

Share this post


Link to post
Share on other sites

do you use custom theme or default one?

also you're reffering to default block categories module?

Share this post


Link to post
Share on other sites

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?

Share this post


Link to post
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

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

×

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More