Logo Questions Linux Laravel Mysql Ubuntu Git Menu

Opencart Get Category URL based from Category ID




I'm working with a template in opencart where I am manually creating the links.

The category links on the storefront are subject to change to SEO friendly urls, so I dont want to be copying the urls that look like this index.php?route=product/category&path=100 if I'm going to have to go back and change it later.

I was wondering if there is some PHP code that I could use to somehow create a link based off of the category ID.

Lets say if my category id is 152

I want to be able to use PHP in my <a href"#"> to say something like this:

<a href="<?php get link for category '152' ?>">

ofcourse I know that isnt the code. But does anyone know a solution? Thanks

like image 876
JCBiggar Avatar asked Mar 21 '23 10:03


1 Answers

You just need to use the URL rewriter class, passing the category ID into it

<a href="<?php echo $this->url->link('product/category', 'path=152'); ?>">
like image 128
Jay Gilford Avatar answered Apr 02 '23 23:04

Jay Gilford