<?php
use common\components\artboximage\ArtboxImageHelper;
use common\modules\product\models\Category;
use yii\helpers\Html;
use yii\helpers\Url;

$models = Category::find()->all();
?>


<div id="mainmenu">
    <div class="container">
        <ul id="menu-bar">
            <li class="new_catalog">
                <a class="new_cat_link" href="#" >каталог</a>
                <div class="hide-cat-menu">
                    <table cellpadding="0" cellspacing="0" border="0">
                        <tr>
                            <td class="col-md-4 col-lg-4 main-cat_ no-padding-left no-padding-right">
                                <ul class="">
                                    <?php
                                    foreach($models as $model):?>
                                        <li>
                                            <a href="<?= Url::to(['catalog/category','category' => $model['alias']]) ?>">
                                                <?= $model->name?>
                                            </a>
                                        </li>
                                    <?php endforeach; ?>
                                </ul>
                            </td>
                            <td class="hide-cat-sub sub-cat_ col-md-8 col-lg-8">
                                <?php
                                foreach($models as $model):?>
                                    <ul class="row">
                                        <?php foreach($model->getTaxGroupsForMenu() as $group): ?>
                                            <li class="list_cat_sub col-md-3 col-lg-3">
                                                <a href="<?= Url::to(['catalog/category','category' => $model['alias'],'filters' => [$group['alias'] => [$group['option_alias']]]]) ?>">
                                                    <div>
                                                        <table cellpadding="0" cellspacing="0" border="0">
                                                            <tr>
                                                                <td>
                                                                    <?= Html::img(ArtboxImageHelper::getImageSrc(Yii::getAlias('@imagesUrl/tax_option/'. $group['image']), 'option_menu'))?>
                                                                </td>
                                                            </tr>
                                                        </table>
                                                        <span><?=$group['value']?></span>
                                                    </div>
                                                </a>
                                            </li>
                                        <?php endforeach;?>
                                    </ul>
                                <?php endforeach; ?>
                            </td>
                        </tr>
                    </table>
                </div>
            </li>




            <li>
                <?php
                echo Html::a('Акции', Url::to('/event/main'))
                ?>
            </li>

            <li>
                <?php
                echo Html::a('Дисконтная программа', Url::to('/discount'))
                ?>
            </li>

            <li>
                <?php
                echo Html::a('Статьи', Url::to('/articles/main'))
                ?>
            </li>










        </ul>
    </div>
</div>