categories.php 1.94 KB
<?php
/** @var $this \yii\web\View */
/** @var $dataProvider \yii\data\ActiveDataProvider */

$this->title = $category->name;
foreach($category->getParents()->all() as $parent) {
    $this->params['breadcrumbs'][] = ['label' => $parent->name, 'url' => ['catalog/category', 'alias' => $parent->alias]];
}
$this->params['breadcrumbs'][] = $this->title;
?>
<h1 class="category_page_main_title"><?= $this->title ?></h1>

<div class="category_wrap">

    <div class="category_wrap_3_colum"><!-- 3 colons for items ==================================  1rst colum -->

        <?php foreach($category->getAllChildrenTree(2) as $category) :?>
            <div class="wrap">
                <div class="cat_li_cont">
                <?php if (!empty($category['item']->image)) :?>
                    <img src="<?= $category['item']->image?>" alt="<?= $category['item']->name?>">
                <?php else :?>
                    <img src="/images/category/1.png" alt="">
                <?php endif;?>
                    <div class="desc"><?= $category['item']->name?><!-- (133)--></div>
                <?php if(!empty($category['children'])) :?>
                    <span class="arrow"></span>
                <?php endif?>
                </div>
                <?php if(!empty($category['children'])) :?>
                <div class="cat_li_sub_ul">
                    <ul>
                    <?php foreach($category['children'] as $_category) :?>
                        <li><a href="<?= \yii\helpers\Url::to(['catalog/category', 'alias' => $_category['item']->alias])?>"><?= $_category['item']->name?><!-- (18)--></a></li>
                    <?php endforeach?>
                    </ul>
                </div>
                <?php endif?>
            </div>
            <!--    $this->params['breadcrumbs'][] = ['label' => $parent->name, 'url' => ['catalog/category', 'alias' => $parent->alias]];-->
        <?php endforeach?>

    </div><!-- end of 3 colons for items -->

</div>