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
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'); ?>">
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With