Jump to content

icon catergories


requnael
 Share

Recommended Posts

2 hours ago, ms.dev said:

I, Which version of the ps_mainmenu module do you use? 

It seems to me that the problem comes from the ps_mainmenu module which has a problem because I have the same problem.

did you fix it?

 

Share this post


Link to post
Share on other sites

1 hour ago, ms.dev said:

Yes, I have submitted a new Github pull requests here : https://github.com/PrestaShop/ps_mainmenu/pull/36

https://angarthemes.eu/demo/P17AT04/en/ I use this theme 

 

Code from mainmenu.tpl
 

{* AngarTheme *}

{assign var=_counter value=0}
{function name="menu" nodes=[] depth=0 parent=null}
    {if $nodes|count}
      <ul class="top-menu container" {if $depth == 0}id="top-menu"{/if} data-depth="{$depth}">

		{if $depth == 0}
			<li class="home_icon"><a href="{$urls.base_url}"><i class="icon-home"></i><span>{l s='Home' d='Shop.Theme.Global'}</span></a></li>
		{/if}

        {foreach from=$nodes item=node}
            <li class="{$node.type}{if $node.current} current {/if}" id="{$node.page_identifier}">
            {assign var=_counter value=$_counter+1}
              <a
                class="{if $depth >= 0}dropdown-item{/if}{if $depth === 1} dropdown-submenu{/if}{if $node.children|count} sf-with-ul{/if}"
                href="{$node.url}" data-depth="{$depth}"
                {if $node.open_in_new_window} target="_blank" {/if}
              >
                {if $node.children|count}
                  {* Cannot use page identifier as we can have the same page several times *}
                  {assign var=_expand_id value=10|mt_rand:100000}
                  <span class="float-xs-right hidden-md-up">
                    <span data-target="#top_sub_menu_{$_expand_id}" data-toggle="collapse" class="navbar-toggler collapse-icons">
                      <i class="material-icons add">&#xE313;</i>
                      <i class="material-icons remove">&#xE316;</i>
                    </span>
                  </span>
                {/if}
                {$node.label}
              </a>
              {if $node.children|count}
              <div {if $depth === 0} class="popover sub-menu js-sub-menu collapse"{else} class="collapse"{/if} id="top_sub_menu_{$_expand_id}">
                {menu nodes=$node.children depth=$node.depth parent=$node}
              </div>
              {/if}
            </li>
        {/foreach}
      </ul>
    {/if}
{/function}

<div class="menu js-top-menu position-static hidden-sm-down" id="_desktop_top_menu">
    {menu nodes=$menu.children}
    <div class="clearfix"></div>
</div>

ps_categorytree.tpl

{**
 * 2007-2017 PrestaShop
 *
 * NOTICE OF LICENSE
 *
 * This source file is subject to the Academic Free License 3.0 (AFL-3.0)
 * that is bundled with this package in the file LICENSE.txt.
 * It is also available through the world-wide-web at this URL:
 * https://opensource.org/licenses/AFL-3.0
 * If you did not receive a copy of the license and are unable to
 * obtain it through the world-wide-web, please send an email
 * to [email protected] so we can send you a copy immediately.
 *
 * DISCLAIMER
 *
 * Do not edit or add to this file if you wish to upgrade PrestaShop to newer
 * versions in the future. If you wish to customize PrestaShop for your
 * needs please refer to http://www.prestashop.com for more information.
 *
 * @author    PrestaShop SA <contact@prestashop.com>
 * @copyright 2007-2017 PrestaShop SA
 * @license   https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0)
 * International Registered Trademark & Property of PrestaShop SA

 * Products select category alternative
 * if $node.id == $product.id_category_default
 * $node.name == $product.category_name

 *}

{* AngarTheme *}

{function name="categories" nodes=[] depth=0}
  {strip}
    {if $nodes|count}

        {foreach from=$nodes item=node}
			<li>
				{if $page.page_name == 'product'}
					<a href="{$node.link}" {if $node.id == $product.id_category_default}class="selected"{/if}>
						{$node.name}
					</a>
				{else}
					<a href="{$node.link}" {if $page.page_name == 'category'}{if $node.id == $category.id}class="selected"{/if}{/if}>
						{$node.name}
					</a>
				{/if}

				{if $node.children}
					<ul>
						{categories nodes=$node.children depth=$depth+1}
					</ul>
				{/if}
			</li>
        {/foreach}

    {/if}
  {/strip}
{/function}


<div class="block-categories block">
	{* AngarTheme *}
	<div class="h6 text-uppercase facet-label">
		<a href="{$categories.link nofilter}" title="{l s='Categories' d='Shop.Theme.Catalog'}">{if $page.page_name == 'index'}{l s='Categories' d='Shop.Theme.Catalog'}{else}{$categories.name}{/if}</a>
	</div>

    <div class="block_content">
		<ul class="tree dhtml">
			{categories nodes=$categories.children}
		</ul>
	</div>

</div>

 

Share this post


Link to post
Share on other sites

Try to debug $categories variable with this code

{$categories|@print_r}

and show if return a image_urls array

and to display a icon image for each sub link add this code after or before <li> :

{foreach from=$node.image_urls item=image_url}

<img src="{$image_url}">

{/foreach}

 

Share this post


Link to post
Share on other sites

5 hours ago, ms.dev said:

Try to debug $categories variable with this code

{$categories|@print_r}

and show if return a image_urls array

and to display a icon image for each sub link add this code after or before <li> :

{foreach from=$node.image_urls item=image_url}

<img src="{$image_url}">

{/foreach}

 

nah, there no image_urls

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More