Jump to content

Where to get category link?


mikeandrews
 Share

Recommended Posts

Hello.

 

I need to make a button that will be a link to a certain category. I don't know where to get links to my categories. When I edit a category I only see friendly URL that is not working. In SEO & URLs I tried to switch that option on but it crashed my site so I want other way.

 

I just need to know what code to use for a link and which information to put in it.

Share this post


Link to post
Share on other sites

Normally in a tpl fie, you use something like:

 

{$link->getCategoryLink($category->id_category, $category->link_rewrite)|escape:'html':'UTF-8'}

 

But $link and $category need to be defined, so it depend on the file where you need it is that has been don already or that you have to add it in the accompanying php file.

 

You can also just add the fixed link, if you're sure nothing will change (like from Friendly URL to non-friendly URL etc)

Easiest way to find out then is to just hand over the category in the category block in the left column. You will then see the URL where you will go to when clicking on it, like www.yourdoman.com/5-tshirts or so. Then use /5-tshirts as link (don't add the domain name part, just the part starting from the root)

 

If you don't have the category block installed and you have Friendly URL set to ON, you can find the category number in the catalog->categories. Browse to the category you want to link to. At the left is its ID number. When editing that category, you can see what Friendly URL it has., then assemble the link this by putting this info together:

 /IDnumber-friendlyURL   (don't forget the slash at the beginning and the dash in between

 

example: ID = 5:

 

post-455771-0-70525100-1417795281_thumb.png

 

 

Friendly URL = tshirts

post-455771-0-88475500-1417795311_thumb.png

 

together: /5-tshirts

 

 

Hope this helps,

pascal.

 

 

 

 

 

 

 

  • Like 1
  • Haha 1

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
 Share

×
×
  • Create New...

Important Information

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