Post by Livakee » Fri Mar 23, 2018 12:54 am

Check this out: https://www.templatemonster.com/help/op ... -menu.html

but I cannot find anything related to the "$categories" in the header.twig

or here is something slightly different: viewtopic.php?t=93015

or this mod, but not for version 3.x
https://www.opencart.com/index.php?rout ... n_id=26321

Newbie

Posts

Joined
Tue Feb 27, 2018 8:05 pm

Post by straightlight » Fri Mar 23, 2018 1:06 am

or here is something slightly different: viewtopic.php?t=93015
Inaccurate solution since the OP did not confirmed the posted solution.
or this mod, but not for version 3.x
https://www.opencart.com/index.php?rout ... n_id=26321
Even though the extension is not for v3.x releases, you can use the Template Switcher extension on the Marketplace to still use the TPL files rather than the default TWIG files.

The most generated errors being found on Opencart forum originates from contributed programming. The increased post counters are caused by redundancies of the same solutions that were already provided prior.


Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by Livakee » Sat Mar 24, 2018 3:34 am

Thank you. But i suppose even though i cannot use the v2.x extension, right?

Newbie

Posts

Joined
Tue Feb 27, 2018 8:05 pm

Post by straightlight » Sat Mar 24, 2018 4:32 am

The answer is ... right on the above ...

The most generated errors being found on Opencart forum originates from contributed programming. The increased post counters are caused by redundancies of the same solutions that were already provided prior.


Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by FCWC » Tue Oct 09, 2018 12:35 am

catalog/view/theme//template/common/menu.twig
To input custom links into Category section OC 3.0.2

New member

Posts

Joined
Tue Jul 31, 2012 3:17 am

Post by nuggzy » Fri Sep 06, 2019 7:24 pm

FCWC wrote:
Tue Oct 09, 2018 12:35 am
catalog/view/theme//template/common/menu.twig
To input custom links into Category section OC 3.0.2
an example would have been nice

Newbie

Posts

Joined
Thu Aug 15, 2019 5:03 am

Post by webocreation.com » Sat Sep 07, 2019 7:48 am

If you are looking to modify the code and add the link at the end of the categories then you can add like <li><a href="https://www.google.com">Forum</a></li> near the end of the catalog/view/theme//template/common/menu.twig

Example:

Code: Select all

{% if categories %}
    <div class="container">
        <nav id="menu" class="navbar">
            <div class="navbar-header">
                <span id="category" class="visible-xs">{{ text_category }}</span>
                <button type="button" class="btn btn-navbar navbar-toggle" data-toggle="collapse" data-target=".navbar-ex1-collapse">
                    <i class="fa fa-bars"></i>
                </button>
            </div>
            <div class="collapse navbar-collapse navbar-ex1-collapse">
                <ul class="nav navbar-nav">
                    {% for category in categories %}
                        {% if category.children %}
                            <li class="dropdown">
                                <a href="{{ category.href }}" class="dropdown-toggle" data-toggle="dropdown">{{ category.name }}</a>
                                <div class="dropdown-menu">
                                    <div class="dropdown-inner">
                                        {% for children in category.children|batch(category.children|length / category.column|round(1, 'ceil')) %}
                                            <ul class="list-unstyled">
                                                {% for child in children %}
                                                    <li>
                                                        <a href="{{ child.href }}">{{ child.name }}</a>
                                                    </li>
                                                {% endfor %}
                                            </ul>
                                        {% endfor %}
                                    </div>
                                    <a href="{{ category.href }}" class="see-all">{{ text_all }}
                                        {{ category.name }}</a>
                                </div>
                            </li>
                        {% else %}
                            <li>
                                <a href="{{ category.href }}">{{ category.name }}</a>
                            </li>
                        {% endif %}
                    {% endfor %}
                    <li>
                        <a href="https://yourlink.com">Forum</a>
                    </li>
                </ul>
            </div>
        </nav>
    </div>
{% endif %}



Blog free tips and tricks
Free extensions
OpenCart Tutorials
OpenCart Tutorials Youtube Video for developers


User avatar
New member

Posts

Joined
Fri Feb 02, 2018 11:51 pm

Post by letxobnav » Sat Sep 07, 2019 9:13 am

don't put data in twig views like that, use the controller menu.php.
add

Code: Select all

	$data['categories'][] = array(
	'name'     => 'NAME_OF_LINK',
	'children' => array(),
	'column'   => 1,
	'href'     => 'ANY_LINK'
	);

before

Code: Select all

return $this->load->view('common/menu', $data);

Crystal Light Centrum Taiwan
Extensions: MailQueue | SUKHR | VBoces

“Data security is paramount at [...], and we are committed to protecting the privacy of anyone who is associated with our [...]. We’ve made a lot of improvements and will continue to make them.”
When you know your life savings are gone.


User avatar
Expert Member

Posts

Joined
Fri Aug 18, 2017 4:35 pm
Location - Taiwan
Who is online

Users browsing this forum: No registered users and 33 guests