バージョン選択

フォーラム

メニュー

オンライン状況

67 人のユーザが現在オンラインです。 (59 人のユーザが フォーラム を参照しています。)
登録ユーザ: 0
ゲスト: 67
もっと...

サイト内検索

質問 > フロント機能 > EC-CUBE3で指定のカテゴリに属する商品表示

フロント機能

新規スレッドを追加する

フラット表示 前のトピック | 次のトピック
投稿者 スレッド
atsupooon
投稿日時: 2017/11/16 7:03
対応状況: −−−
新米
登録日: 2015/3/14
居住地:
投稿: 7
EC-CUBE3で指定のカテゴリに属する商品表示
環境
ECCUBE 3.0.15
DB mysql
php 5.6

DBなどは特に初期の状態のままです。

トップページで、指定のカテゴリーに属する商品のみを表示させたいと思っております。
※件数指定で、Blockで表示させたいと思っております。

商品一覧の取得は取得できたのですが、ここから指定のカテゴリーのものを
条件分岐で表示させる部分がわかりません。


namespace Eccube\Controller\Block;


use Eccube\Application;


class TabItemsController
{
    public function index(Application $app)
    {
      $newItemList = $app['orm.em']->getRepository('\Eccube\Entity\Product')
          ->findBy(
              array('Status' => 1,
                    'del_flg' => 0),
              array('id' => 'DESC'),
              8,
              0
          );

          //カテゴリー取得
          $itemCateList = $app['eccube.repository.category']->getList();

      // テンプレートへ値を渡して出力させる
      return $app['view']->render('Block/tab_items.twig', array(
        'newItemList' => $newItemList,
        'itemCateList' => $itemCateList
      ));
    }
}




コントローラー側でカテゴリーの取得はできました(全件取得しておりますが。。。)


<!--新着商品-->
<div class="item_gallery">
    <h4>新商品</h4>
    <ul class="row">
      {% for newItem in newItemList  %}
        <div class="col-sm-3 col-xs-6">
            <div class="pickup_item">
                <a href="{{ url('product_detail', {'id': newItem.id}) }}">
                    <div class="item_photo"><img src="{{ app.config.image_save_urlpath }}/{{ newItem.main_list_image|no_image_product }}"></div>
                    <dl>
                      <dt class="item_name">{{newItem.name}}</dt>
                      <dd class="item_price">
                      {% if newItem.hasProductClass -%}
                          {% if newItem.getPrice02Min == newItem.getPrice02Max %}
                          <p class="normal_price"><span class="price01_default">{{ newItem.getPrice02IncTaxMin }}</span><span class="small">円</span></p>
                          {% elseif newItem.getPrice02Min is not null and newItem.getPrice02Max is not null %}
                          <p class="normal_price"><span class="price01_default">{{ newItem.getPrice02IncTaxMin }}</span> ~ <span class="price01_default">{{ newItem.getPrice02IncTaxMax }}</span><span class="small">円</span></p>
                          {% endif %}
                      {% else -%}
                          {% if newItem.getPrice02Max is not null %}
                          <p class="normal_price"><span class="price01_default">{{ newItem.getPrice02IncTaxMin }}</span><span class="small">円</span></p>
                          {% endif %}
                      {% endif -%}
                    </dl>
                </a>
            </div>
          </div>
      {% endfor %}
    </ul>
</div>


ここから先わかる方お教えして頂けますでしょうか。

宜しくお願い致します。
フラット表示 前のトピック | 次のトピック


題名 投稿者 日時
 » EC-CUBE3で指定のカテゴリに属する商品表示 atsupooon 2017/11/16 7:03
     Re: EC-CUBE3で指定のカテゴリに属する商品表示 468 2017/11/16 20:46
       Re: EC-CUBE3で指定のカテゴリに属する商品表示 atsupooon 2017/11/24 4:49
         Re: EC-CUBE3で指定のカテゴリに属する商品表示 umebius 2017/11/24 5:08
           Re: EC-CUBE3で指定のカテゴリに属する商品表示 468 2017/11/24 10:43
             Re: EC-CUBE3で指定のカテゴリに属する商品表示 atsupooon 2017/11/29 5:57

 



ログイン


EC-CUBE公式 Amazon Payプラグイン

統計情報

総メンバー数は88,887名です
総投稿数は110,000件です

投稿数ランキング

1
seasoft
7367
2
468
3217
3
AMUAMU
2712
4
nanasess
2313
5
umebius
2085
6
yuh
1819
7
h_tanaka
1646
8
red
1570
9
mcontact
1295
10
tsuji
958
11
fukap
907
12
shutta
835
13
tao_s
799
14 ramrun 789
15 karin 689
16 sumida 641
17
homan
633
18 DELIGHT 572
19
patapata
502
20
flealog
485


ネットショップの壺

EC-CUBEインテグレートパートナー

Copyright© EC-CUBE CO.,LTD. All Rights Reserved.