Prestashop blocktopmenu.tpl中的菜单模板在哪里

Prestashop blocktopmenu.tpl中的菜单模板在哪里,prestashop,prestashop-1.6,Prestashop,Prestashop 1.6,各位,在Prestashop中找到{$MENU}模板我很累。我也试着找很多时间和研究,但我找不到。我想从{$MENU}自定义模板。有人能帮我吗 这是我的blocktopmenu.tpl文件: {if $MENU != ''} <!-- Menu --> <div class="sf-contener clearfix"> <ul class="sf-menu clearfix"> {$MENU} {if $MENU_S

各位,在Prestashop中找到
{$MENU}
模板我很累。我也试着找很多时间和研究,但我找不到。我想从
{$MENU}
自定义模板。有人能帮我吗

这是我的
blocktopmenu.tpl
文件:

{if $MENU != ''}

<!-- Menu -->
<div class="sf-contener clearfix">
    <ul class="sf-menu clearfix">
        {$MENU}
        {if $MENU_SEARCH}
            <li class="sf-search noBack" style="float:right">
                <form id="searchbox" action="{$link->getPageLink('search')|escape:'html'}" method="get">
                    <p>
                        <input type="hidden" name="controller" value="search" />
                        <input type="hidden" value="position" name="orderby"/>
                        <input type="hidden" value="desc" name="orderway"/>
                        <input type="text" name="search_query" value="{if isset($smarty.get.search_query)}{$smarty.get.search_query|escape:'html':'UTF-8'}{/if}" />
                    </p>
                </form>
            </li>
        {/if}
    </ul>
</div>
<div class="sf-right">&nbsp;</div>

<!--/ Menu -->
{/if}
{if$菜单!=''}
    {$MENU} {if$MENU_SEARCH}
  • {/if}
{/if}
正如您所知,Blocktopmenu是一个真正需要定制的难题

菜单本身没有模板文件。您必须破解(或重写)模块以自定义渲染

例如,我必须向
li
ul
元素添加一些类和ID

以下是文件
/modules/blocktopmenu/blocktomenu.php中的默认
generateCategoriesMenu()
方法:

受保护函数generateCategoriesMenu($categories,$is\u children=0)
{
$html='';
foreach($key=>$category的类别){
如果($category['level_depth']>1){
$cat=新类别($Category['id_Category']);
$link=Tools::HtmlEntitiesUTF8($cat->getLink());
}否则{
$link=$this->context->link->getPageLink('index');
}
/*当类别不活动时,我们不应向客户显示它*/
if((bool)$category['active']==false){
继续;
}
$html.='';
$html.='';
if(设置($category['children'])和&!empty($category['children'])){
$html.='
    '; $html.=$this->generateCategoriesMenu($category['children',1); 如果((int)$category['level_depth']>1&&!$is_children){ $files=scandir(\u PS\u CAT\u IMG\u DIR); 如果(计数(preg_grep('/^'.$category['id_category'].-([0-9])?_thumb.jpg/i',$files))>0){ $html.='
  • ; foreach($files作为$file){ if(preg_match('/^'.$category['id_category'].-([0-9])?_thumb.jpg/i',$file)==1){ $html.='context->link->getMediaLink(\u THEME\u CAT\u DIR.$file) “.alt=”.Tools::SafeOutput($category['name'])。”title=“” .Tools::SafeOutput($category['name'])。“class=“imgm”/>”; } } $html.='
  • '; } } $html.='
'; } $html.=''; } 返回$html; }
下面是我在
/override/modules/blocktopmenu/blocktopmenu.php
中的技巧:


ohh!我明白了,谢谢你,但子菜单很难自定义,因为我想将image if子菜单添加到下面的所有子菜单中。如果这回答了你的第一个问题,你能接受它并为此特定开发打开一个新问题吗?