如何从 opencart 2.2 面包屑中删除下拉菜单?

How to remove dropdown from opencart 2.2 breadcrumb?

我使用的是 opencart v2.2.0,面包屑的代码如下。此面包屑将类别显示为下拉列表。我如何编辑此面包屑以删除该下拉列表并仅显示正确的类别和子类别?

这是它如何工作的截图: breadcrumb screen shot

这是代码:

<div class="breadcrumb <?php if($theme_options->get( 'breadcrumb_layout' ) == 2) { echo 'fixed'; } else { echo 'full-width'; } ?>">
<div class="background-breadcrumb"></div>
<div class="background">
    <div class="shadow"></div>
    <div class="pattern">
        <div class="container">
            <div class="clearfix">
                <ul>
                    <?php
                    $i = 0;
                    $next_cat_id = 0;
                    foreach ($breadcrumbs as $breadcrumb) {
                        $cats = array();
                        if($registry->get('request')->get['route'] == 'product/product' || $registry->get('request')->get['route'] == 'product/category'){
                            if($i == 1 ){
                                $cats = $theme_options->getCategories(0);
                            }else if($next_cat_id > 0 && count($breadcrumbs)-1 > $i){
                                $cats = $theme_options->getCategories($next_cat_id);
                            }
                        }


                    ?>
                    <li class="item <?php echo !empty($cats) ? 'dropdown' : '';?>">
                        <a <?php echo !empty($cats) ? 'class="dropdown-toggle" data-toggle="dropdown" aria-expanded="false"' : '';?>
                            href="<?php echo $breadcrumb['href']; ?>"><?php if($breadcrumb['text'] != '<i class="fa fa-home"></i>') { echo $breadcrumb['text']; } else { if($theme_options->get( 'home_text', $config->get( 'config_language_id' ) ) != '') { echo $theme_options->get( 'home_text', $config->get( 'config_language_id' ) ); } else { echo 'Home'; } } ?></a>

                        <?php if(!empty($cats)):?>
                        <ul class="dropdown-menu">
                            <li>
                                <?php foreach($cats as $cat):?>
                                <?php if($cat['label'] == $breadcrumb['text']):?>
                                    <?php $next_cat_id = $cat['category_id']; continue; ?>
                                <?php endif; ?>
                                <a href="<?php echo $cat['href'] ?>"><?php echo $cat['label'] ?></a>
                                <?php endforeach; ?>
                            </li>
                        </ul>
                        <?php endif; ?>

                    </li>
                    <?php $i++; } ?>
                </ul>
 <!--                   <h1 id="title-page"><?php echo $heading_title; ?>
                    <?php if(isset($weight)) { if ($weight) { ?>
                    &nbsp;(<?php echo $weight; ?>)
                    <?php } } ?>
                </h1>
                <div class="strip-line"></div>-->
            </div>
        </div>
    </div>
</div>

我不知道这段代码在哪里,所以关闭 div 和其他 html 时要小心。 按照我的代码,我删除了其他级别和下拉列表。我认为 $breadcrumbs 数组正在返回默认代码。如果他们更改了它,则还需要更改控制器部分。希望以下能奏效。

<div class="breadcrumb <?php if($theme_options->get( 'breadcrumb_layout' ) == 2) { echo 'fixed'; } else { echo 'full-width'; } ?>">
<div class="background-breadcrumb"></div>
<div class="background">
    <div class="shadow"></div>
    <div class="pattern">
        <div class="container">
            <div class="clearfix">
                <ul>
                    <?php
                    foreach ($breadcrumbs as $breadcrumb) { ?>
                        <li class="item">
                            <a
                                href="<?php echo $breadcrumb['href']; ?>"><?php if($breadcrumb['text'] != '<i class="fa fa-home"></i>') { echo $breadcrumb['text']; } else { if($theme_options->get( 'home_text', $config->get( 'config_language_id' ) ) != '') { echo $theme_options->get( 'home_text', $config->get( 'config_language_id' ) ); } else { echo 'Home'; } } ?></a>    
                        </li>
                        <?php } ?>
                </ul>
<!--                   <h1 id="title-page"><?php echo $heading_title; ?>
                    <?php if(isset($weight)) { if ($weight) { ?>
                    &nbsp;(<?php echo $weight; ?>)
                    <?php } } ?>
                </h1>
                <div class="strip-line"></div>-->
</div>
</div>
</div>
</div>