<?php

/**
 * Created by PhpStorm.
 * User: alejandro.sosa
 * Date: 28/05/2016
 * Time: 21:37
 */
use yii\widgets\Pjax;
use yii\helpers\Url;
use yii\helpers\Html;
use frontend\models\Contenido;
Pjax::begin(['id' => 'rt-menu-categorias', 'scrollTo' => 0]);
?>
    <div class="vertical-menu-content is-home" id="rt-categorias">
        <ul class="vertical-menu-list">
            <?php 
foreach (Contenido::listadoCategoriasPopularesArticulos() as $id => $categoria) {
    $texto = Yii::t('frontend', '{contador, plural,=1 {# articulo} other {# articulos}}', ['contador' => $categoria->getArticulosnuevos()]);
    $contador = $categoria->getArticulosnuevos() == 0 ? '' : Html::tag('span', $categoria->getArticulosnuevos(), ['class' => 'new badge', 'data-toggle' => 'tooltip', 'data-placement' => 'top', 'title' => $texto]);
    $icono = !empty($categoria->iconoCategoria()) ? Html::img($categoria->iconoCategoria(), ['class' => 'icon-menu', 'alt' => $categoria->nombre]) : '';
    echo Html::tag('li', Html::a($icono . $categoria->nombre . '' . $contador, Url::to(['articulo/categoria', 'categoria' => $categoria->slug]), ['id' => 'c' . $categoria->idcategoria, 'data' => ['method' => 'post', 'params' => ['hc' => 7]]]), ['id' => $categoria->idcategoria, 'data-id' => $categoria->idcategoria]);
}
?>
        </ul>
        <div class="all-category"><span class="open-cate">Ver más</span></div>
    </div>
    <div class="category-menu"></div>
<?php 
Pjax::end();
<?php

/**
 * Created by PhpStorm.
 * User: alejandro.sosa
 * Date: 28/05/2016
 * Time: 21:37
 */
use yii\widgets\Pjax;
use yii\helpers\Url;
use yii\helpers\Html;
use frontend\models\Contenido;
Pjax::begin(['id' => 'rt-menu-categorias', 'scrollTo' => 0]);
?>
    <div class="vertical-menu-content is-home" id="rt-categorias">
        <ul class="vertical-menu-list">
            <?php 
foreach (Contenido::listadoCategoriasPopularesDescuentos() as $id => $categoria) {
    $total = $categoria->totalDescuentosCategoriaPrincipal();
    $texto = Yii::t('frontend', '{contador, plural,=1 {# articulo} other {# articulos}}', ['contador' => $total]);
    $contador = $total == 0 ? '' : Html::tag('span', $total, ['class' => 'new badge', 'data-toggle' => 'tooltip', 'data-placement' => 'top', 'title' => $texto]);
    echo Html::tag('li', Html::a($categoria->iconoCategoria() . $categoria->nombre . '' . $contador, Url::to(['descuento/categoria', 'categoria' => $categoria->slug]), ['id' => 'c' . $categoria->id, 'data' => ['method' => 'post', 'params' => ['hc' => 7]]]), ['id' => $categoria->id, 'data-id' => $categoria->id]);
}
?>
        </ul>
        
    </div>
    <div class="category-menu"></div>
<?php 
Pjax::end();