public function actionGetGoodsByCategory()
 {
     $category_id = Yii::$app->request->post('category_id');
     $model = Goods::getGoodsByCategoriId($category_id);
     Yii::$app->response->format = \yii\web\Response::FORMAT_JSON;
     if ($model) {
         return $this->renderAjax('/ajax/_get-goods-by-category', ['model' => $model]);
     } else {
         return $this->renderAjax('/ajax/_empty');
     }
 }
Example #2
0
            <?php 
}
?>
        </ul>
    </div>

    <div class="tab-content">
        <?php 
foreach ($modelGoodsCategories as $cat) {
    ?>
            <div class="tab-pane fade active in" id="<?php 
    echo str_replace(' ', '', $cat->name);
    ?>
">
                <?php 
    $goodsOfCategotyId = Goods::getGoodsByCategoriId($cat->id);
    ?>
                <?php 
    if ($goodsOfCategotyId) {
        ?>
                    <?php 
        foreach ($goodsOfCategotyId as $good) {
            ?>
                        <div class="col-sm-3">
                            <div class="product-image-wrapper">
                                <div class="single-products">
                                    <div class="productinfo text-center">
                                        <a href="/shop/detail?item=<?php 
            echo $good->id;
            ?>
"><img src="<?php