バージョン選択

フォーラム

メニュー

オンライン状況

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

サイト内検索

質問 > フロント機能 > EC-CUBE4の商品詳細ページで特定カテゴリのサブカテゴリのみを表示させたい

フロント機能

新規スレッドを追加する

スレッド表示 | 新しいものから 前のトピック | 次のトピック | 下へ
投稿者 スレッド
hamuhamu
投稿日時: 2019/12/29 21:36
対応状況: −−−
半人前
登録日: 2019/12/16
居住地:
投稿: 22
EC-CUBE4の商品詳細ページで特定カテゴリのサブカテゴリのみを表示させたい
EC-CUBE4の商品詳細ページについて質問です。

「環境」
[EC-CUBE] EC-CUBE4.0.3
[PHP] PHP7.2.22
[データベース] MySQL 5.5.38
[WEBサーバ] Apache

「質問」
デフォルトテンプレートのカテゴリ一覧の表示コードは以下の通りですが、
この部分で
「カテゴリIDが1のサブカテゴリ(商品に設定されているサブカテゴリ)のみ」
を表示させたいです。

{% if Product.ProductCategories is not empty %}
    <div class="ec-productRole__category">
        <div>{{ '関連カテゴリ'|trans }}</div>
        {% for ProductCategory in Product.ProductCategories %}
            <ul>
                <li>
                    {% for Category in ProductCategory.Category.path %}
                        <a href="{{ url('product_list') }}?category_id={{ Category.id }}">{{ Category.name }}</a> {%- if loop.last == false %}
                        <span>></span>{% endif -%}
                    {% endfor %}
                </li>
            </ul>
        {% endfor %}
    </div>
{% endif %}


以下の条件を追加してみたのですが、親カテゴリのみが表示されます。

{% if Category.id == 1 and loop.last == true %}


ご教示いただけると幸いです。
どうかよろしくお願いいたします。
umebius
投稿日時: 2020/1/1 0:48
対応状況: −−−
登録日: 2016/7/22
居住地:
投稿: 2085
Re: EC-CUBE4の商品詳細ページで特定カテゴリのサブカテゴリのみを表示させたい
このような形でしょうか?

{% for ProductCategory in Product.ProductCategories %}

{% if ProductCategory.Category.path.0.id == 1 and ProductCategory.Category.id != 1 %}

<ul>
.....
.....
</ul>

{% endif %}

{% endfor %}


----------------
EC-CUBEカスタマイズ・高速化・脆弱性対策・SEO ご相談ください。

2系・3系から4系へのバージョンアップ実績豊富

aimeeclair
投稿日時: 2020/1/1 2:19
対応状況: −−−
新米
登録日: 2020/1/1
居住地:
投稿: 1
Re: EC-CUBE4の商品詳細ページで特定カテゴリのサブカテゴリのみを表示させたい
Our https://www.deluxeboxes.com/magnetic-closure-rigid-boxes/ can be accessible from us in different sizes and styles for example, Heart, oval, square or rectangular. We are able to print your company name, contact information and other important information on these boxes. With the use of advanced technology and skilled team of the designers, we also customize these boxes with different prints and patterns according to the customer requirement.
hamuhamu
投稿日時: 2020/1/1 19:47
対応状況: 解決済
半人前
登録日: 2019/12/16
居住地:
投稿: 22
Re: EC-CUBE4の商品詳細ページで特定カテゴリのサブカテゴリのみを表示させたい
ご回答ありがとうございます。
任意のサブカテゴリのみを表示できました!
スレッド表示 | 新しいものから 前のトピック | 次のトピック | トップ


 



ログイン


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

統計情報

総メンバー数は88,288名です
総投稿数は109,688件です

投稿数ランキング

1
seasoft
7365
2
468
3217
3
AMUAMU
2712
4
nanasess
2303
5
umebius
2085
6
yuh
1818
7
h_tanaka
1610
8
red
1567
9
mcontact
1240
10
tsuji
958
11
fukap
907
12
shutta
835
13
tao_s
796
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.