Jump to content
LeeFoster

Category into a link

Recommended Posts

Is there any addon's or does anyone know of a way to turn a category into a link so that when the category is clicked it takes you to a different website?

Share this post


Link to post
Share on other sites

@LeeFoster You will need to code that. Below are a few ways to do it that I can think of at the moment. But unless there is some reason to have the link be a category, I would just delete that category and add the link manually, which is similar to the second method below. Leaving it as a category will always be a potential problem because if you install an addon that lists or uses categories, its code may require changing. And if you forget, it could cause a problem on your site.

- Edit the classes/categories_tree.php and change the code to look for that categories ID and add the url you want for it. Something like

if (categories_id = 33) {
  url = somehwhere else;
} else {
  original code goes here
}

- Edit the above file and change the database query not to include the category in the result. Then in the categories infobox, add a link after the rest of the categories for the one you want.

Share this post


Link to post
Share on other sites
17 minutes ago, Jack_mcs said:

@LeeFoster You will need to code that. Below are a few ways to do it that I can think of at the moment. But unless there is some reason to have the link be a category, I would just delete that category and add the link manually, which is similar to the second method below. Leaving it as a category will always be a potential problem because if you install an addon that lists or uses categories, its code may require changing. And if you forget, it could cause a problem on your site.

- Edit the classes/categories_tree.php and change the code to look for that categories ID and add the url you want for it. Something like


if (categories_id = 33) {
  url = somehwhere else;
} else {
  original code goes here
}

- Edit the above file and change the database query not to include the category in the result. Then in the categories infobox, add a link after the rest of the categories for the one you want.

This is going to be for the category on the index page not the categories box, will it still work?

Share this post


Link to post
Share on other sites

Perform the changing of "link address" in the MODULE that outputs the display...


Help shape the future of Phoenix; join the Phoenix Club

Share this post


Link to post
Share on other sites
4 minutes ago, burt said:

Perform the changing of "link address" in the MODULE that outputs the display...

Yeah I found it thanks.

Share this post


Link to post
Share on other sites
33 minutes ago, LeeFoster said:

This is going to be for the category on the index page not the categories box, will it still work?

Making the change in the class file will affect any code in the shop that displays categories assuming the class is used to get the categories. Changing the code in the module as @burtmentioned is a better way since it won't affect core files, but it will only apply to that one module.

Share this post


Link to post
Share on other sites
20 hours ago, LeeFoster said:

Took a little trial and error to get it right but I have managed to do so, thanks.

Is it a secret or are you going to tell how you did it in case others find this thread.

 


REMEMBER BACKUP, BACKUP AND BACKUP

Get the latest Responsive osCommerce CE (community edition) here

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

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

×