Maksim
Maksim

Reputation: 185

Opencart categories links from main page

I would like to know how do I create my main categories on my homepage in Opencart to make 3 categories in a row each of which followed by it's subcategories like this: Scheme Sorry for my drawing skills. So there are going to be a clicable picture for each category and subcategory. However

<a href="<?php echo $this->url->link('product/category', 'path=59'); ?">pic</a>

does not work for me. It says "Access forbidden", so Is there any other way to make this? because as soon as I will be able to make a simple working link, I would be able to deal with the table.

Upvotes: 0

Views: 2322

Answers (1)

You Old Fool
You Old Fool

Reputation: 22931

You should generally avoid calling methods in the view (tpl). I would recommend defining it first in the relevant controller. In any event, your link should work but you have a misplaced quotation mark and you did not close you opening anchor tag. I should look like this:

<a href="<?php echo $this->url->link('product/category', 'path=59'); ?>">pic</a>

UPDATE:

As you have explained that you are adding this as html from an extension you cannot call a php function from there so you'll need to specify the actual link, which in this case would be:

<a href="/index.php?route=product/category&path=59">pic</a>

or based on the comment you posted

<a href="/shop/index.php?route=product/category&path=59">pic</a>

Upvotes: 2

Related Questions