バージョン選択

フォーラム

メニュー

オンライン状況

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

サイト内検索

 > フロント機能 > EC-CUBE3.0.11 category.twigでの商品数判定につきまして

フロント機能

新規スレッドを追加する

フラット表示 前のトピック | 次のトピック
投稿者 スレッド
MPV
投稿日時: 2016/10/19 20:22
対応状況: −−−
仙人
登録日: 2011/3/27
居住地:
投稿: 309
Re: EC-CUBE3.0.11 category.twigでの商品数判定につきまして
nanasess様

早々にお返事頂きまして、誠にありがとうございます。
お教え頂きました通りにやってみました。

ec3/src/Eccube/Entity/Category.phpの最後の方に


    /**
     * Get Creator
     *
     * @return \Eccube\Entity\Member
     */
     public function getCreator()
     {
         return $this->Creator;
     }

     /**
      * Get publishCount
      *
      * @return integer
      */
     public function publishCount()
     {
         $result = array_reduce(
             array_map(
                 function ($ProductCategory) {
                     $Product = $ProductCategory->getProduct();
                     if ($Product->getStatus()->getId() === 1) {
                         return 1;
                     } else {
                         return 0;
                     }
                 }, $this->ProductCategories->toArray()),
             function ($carry, $item) {
                 return $carry += $item;
             }
         );
         return $result ? $result : 0;
     }
  }


と、コードを追加しました。

そして、app/template/default/Block/category.twig に



{% macro tree(Category) %}
     <li>
         <a href="{{ url('product_list') }}?category_id={{ Category.id }}">
             {{ Category.name }}【{{ Category.publishCount }}】
         </a>



というように、カテゴリ名の横に公開商品数を表示させてみようと
しましたところ、やはり

Twig_Error_Runtime in Template.php line 396: An exception has been thrown during the rendering of a template ("Entity was not found.") in "__string_template__4b98462fe4bd8fa020a5f9c3d2c7e3b00fc5db6e7bc57dcafad4ec00331e165e" at line 26.

EntityNotFoundException in ProxyFactory.php line 177: Entity was not found.

というように、エンティティがないという
エラーが出てしまいます。(T_T)

今はEC-CUBE3.0.10に差し戻して確認しています。
フラット表示 前のトピック | 次のトピック


題名 投稿者 日時
   EC-CUBE3.0.11 category.twigでの商品数判定につきまして MPV 2016/10/19 14:05
     Re: EC-CUBE3.0.11 category.twigでの商品数判定につきまして MPV 2016/10/19 15:07
       Re: EC-CUBE3.0.11 category.twigでの商品数判定につきまして nanasess 2016/10/19 15:19
         Re: EC-CUBE3.0.11 category.twigでの商品数判定につきまして MPV 2016/10/19 18:13
           Re: EC-CUBE3.0.11 category.twigでの商品数判定につきまして nanasess 2016/10/19 19:16
           » Re: EC-CUBE3.0.11 category.twigでの商品数判定につきまして MPV 2016/10/19 20:22
               Re: EC-CUBE3.0.11 category.twigでの商品数判定につきまして MPV 2016/10/19 23:21
                 Re: EC-CUBE3.0.11 category.twigでの商品数判定につきまして nanasess 2016/10/20 10:31
                   Re: EC-CUBE3.0.11 category.twigでの商品数判定につきまして MPV 2016/11/7 10:15
                     Re: EC-CUBE3.0.11 category.twigでの商品数判定につきまして nanasess 2016/11/7 10:59
                       Re: EC-CUBE3.0.11 category.twigでの商品数判定につきまして MPV 2016/11/12 11:22
                         Re: EC-CUBE3.0.11 category.twigでの商品数判定につきまして YOKO 2018/3/2 15:22

 



ログイン


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

統計情報

総メンバー数は90,023名です
総投稿数は110,282件です

投稿数ランキング

1
seasoft
7369
2
468
3217
3
AMUAMU
2712
4
nanasess
2314
5
umebius
2085
6
yuh
1819
7
h_tanaka
1677
8
red
1570
9
mcontact
1343
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.