pawelindustry Posted February 25 Share Posted February 25 Mam następujący problem w swoim sklepie. Mimo różnych kombinacji nie udaje mi się uzyskać efektu, by na stronie kategorii, pod nawigacją pojawiały się wszystkie kategorie, z czego bieżąca kategoria byłaby rozwinięta, pokazując podkategorie. Kombinowałem różne rozwiązania wynikające z ustawień szablonu Optima, jednakże bez efektu. Za wszelką pomoc będę bardzo wdzięczny. Kod ps_categorytree.tpl wygląda następująco: {function name="categories" nodes=[] depth=0} {strip} {if $nodes|count} <ul class="category-sub-menu"> {foreach from=$nodes item=node} <li data-depth="{$depth}" class="{if isset($currentCate) && ($node.id == $currentCate || in_array($currentCate, array_column($node.children, 'id')))} active{/if}"> {if $depth === 0} <a href="{$node.link}">{$node.name}</a> {if $node.children} <div class="navbar-toggler collapse-icons" data-toggle="collapse" data-target="#exCollapsingNavbar{$node.id}" aria-expanded="true"> <i class="material-icons add"></i> <i class="material-icons remove"></i> </div> <div class="collapse show always-open" id="exCollapsingNavbar{$node.id}"> {categories nodes=$node.children depth=$depth+1} </div> {/if} {else} <a class="category-sub-link" href="{$node.link}">{$node.name}</a> {if $node.children} <span class="arrows collapse-icons" data-toggle="collapse" data-target="#exCollapsingNavbar{$node.id}" aria-expanded="true"> <i class="material-icons add"></i> <i class="material-icons remove"></i> </span> <div class="collapse show" id="exCollapsingNavbar{$node.id}"> {categories nodes=$node.children depth=$depth+1} </div> {/if} {/if} </li> {/foreach} </ul> {/if} {/strip} {/function} <div class="block-categories"> <ul class="category-top-menu"> {if $categories.id == '2'} <li><a class="text-uppercase h6" href="{$categories.link nofilter}">{l s='Product categories' d='Modules.Categorytree.Shop'}</a></li> {else} <li><a class="text-uppercase h6" href="{$categories.link nofilter}">{$categories.name}</a></li> {/if} <li>{categories nodes=$categories.children}</li> </ul> </div> Link to comment Share on other sites More sharing options...
Knowband Plugins Posted February 25 Share Posted February 25 Czy możesz udostępnić więcej szczegółów problemu? Udostępniony kod to plik motywu LUB dowolny kod modułu? Link to comment Share on other sites More sharing options...
pawelindustry Posted February 25 Author Share Posted February 25 Jest to kod z pliku motywu. Przykładowo tak to wygląda na jednej z podkategorii: https://sklep.pipindustry.pl/14-lancuchy Link to comment Share on other sites More sharing options...
Knowband Plugins Posted February 25 Share Posted February 25 Czego więc jej brakuje? Widzę listę wszystkich kategorii? Link to comment Share on other sites More sharing options...
pawelindustry Posted February 25 Author Share Posted February 25 (edited) Efekt, jaki chcę uzyskać, ma być taki, by bieżąca kategoria, w której jestem, była rozwinięta. Wygląda to tak:https://optima.posthemes.com/demo4/tools4/en/51-hand-tools Edited February 25 by pawelindustry (see edit history) Link to comment Share on other sites More sharing options...
endriu107 Posted February 25 Share Posted February 25 Ten kod jest oryginalnie z szablonu czy już po przeróbkach? Skąd tam jest $currentCate ? Nie powinno być czasem $currentCategory ? To po pierwsze po drugie nie wiem czy tylko to wystarczy czy ten warunek nie trzeba będzie ująć jeszcze w innym miejscu. Link to comment Share on other sites More sharing options...
atomek Posted February 25 Share Posted February 25 9 godzin temu, pawelindustry napisał: Efekt, jaki chcę uzyskać, ma być taki, by bieżąca kategoria, w której jestem, była rozwinięta. Wygląda to tak:https://optima.posthemes.com/demo4/tools4/en/51-hand-tools Według mnie efekt rozwiniętej kategorii jest uzyskiwany przez javascript. Sama modyfikacja templatki modułu nie wystarczy. Szukaj w tym kierunku. Link to comment Share on other sites More sharing options...
Knowband Plugins Posted February 26 Share Posted February 26 (edited) Sprawdziłem demo i odkryłem, że klasa aktywna jest stosowana do bieżącej kategorii, która stosuje efekt. Chociaż nie jest to dostępne w twoim przypadku Zatem ten warunek nie działa, co dodaje klasę "aktywną". <li data-depth="{$depth}" class="{if isset($currentCate) && ($node.id == $currentCate || in_array($currentCate, array_column($node.children, 'id')))} active{/if}"> Zatem problem może wynikać z $currentCate. Edited February 26 by Knowband Plugins (see edit history) Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now