S
S
Sergey Parkhunov2020-03-15 00:42:24
JavaScript
Sergey Parkhunov, 2020-03-15 00:42:24

opencart | How to link to a specific category of products?

Good afternoon!

You need to add links to certain product categories in the article.
I want to do this by example, as with links in the footer to articles ↓

<ul class="list-unstyled">
    <li><a href="<?php echo $informations[8]['href']; ?>"><?php echo $informations[8]['title']; ?></a></li>
    <li><a href="<?php echo $informations[9]['href']; ?>"><?php echo $informations[9]['title']; ?></a></li>
    <li><a href="<?php echo $informations[10]['href']; ?>"><?php echo $informations[10]['title']; ?></a></li>
</ul>


Tell me, please, is this possible?
Something like this ↓ only working version
<li><a href="<?php echo $category_id[5]['href']; ?>"><?php echo $category_id[5]['title']; ?></a></li>


Opencart - Version 2.3.0.2 (trs-2.3.0.0)

Answer the question

In order to leave comments, you need to log in

4 answer(s)
V
VicTHOR, 2019-08-09
@freelion93

M(.*)?A(.*)?0,0,1(.*)$

L
lazuren, 2020-03-18
@lazuren

How do you do it will not work, because when you add a line to an article

<li><a href="<?php echo $category_id[60]['href']; ?>"><?php echo $category_id[60]['title']; ?></a></li>
you are bypassing the php interpreter that handles your variables <?php echo $category_id[60]['href']; ?>
Try this:
<li><a href="/index.php?route=product/category&category_id=60">Категория 60</a></li>

A
azaza, 2020-03-15
@natojezlo

after add your own, update the cache I don’t see a problem </li>

S
Sergey Parkhunov, 2020-03-15
@BlankmaN715

Something doesn't work...
5e6ddb5ee532a842822793.png
My category, as I understand it, is #60
5e6ddbcec13c7697966792.png
Therefore, if everything is correct in the previous example, then it should look like this ↓ , or something like that)

<li><a href="<?php echo $category_id[60]['href']; ?>"><?php echo $category_id[60]['title']; ?></a></li>

But as shown above, the link to the category doesn't work...
I'm guessing there's a bug here, but I can't figure out what it is yet. Please help me figure it out.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question