バージョン選択

フォーラム

メニュー

オンライン状況

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

サイト内検索

質問 > フロント機能 > [教えてください]プラグインを使用した拡張機能について

フロント機能

新規スレッドを追加する

スレッド表示 | 新しいものから 前のトピック | 次のトピック | 下へ
投稿者 スレッド
tawaba
投稿日時: 2019/5/27 21:05
対応状況: −−−
半人前
登録日: 2019/5/27
居住地:
投稿: 12
[教えてください]プラグインを使用した拡張機能について
表題の件について、どなたか助けてください。

「商品情報項目追加プラグイン」
https://www.ec-cube.net/products/detail.php?product_id=1012
を購入し、商品詳細画面に項目を追加したいのですが、拡張項目を商品詳細画面に表示することができません。
私がやった手順は以下になります。

[1]
プラグインを導入し、拡張項目「セレクトボックス」を作成。
選択肢は以下を作成
value1:テキスト1
value2:テキスト2
value3:テキスト3

[2]
detail.twigで、下記コードを実装
{% for values in __EX_PRODUCT.3.value %}
<p>{{values}}</p>
{% endfor %}

[結果]
ブラウザ上に、何も表示されない。

[補足1]
プラグインのコード例には、以下のように記述がされています。
====
{{ __EX_PRODUCT.3.name }} , {{ __EX_PRODUCT.3.value }}
====

[補足2]
セレクトボックスの選択肢の設定方法は、以下のように書かれています。
====
ルール1. 1行に1つの選択肢情報を記載する
ルール2. 選択肢の値と、テキストの間はコロン「:」で区切る

(設定例)
value1:テキスト1
value2:テキスト2
value3:テキスト3
====

以上となります。
ご教示宜しくお願いいたします。

468
投稿日時: 2019/5/28 8:32
対応状況: −−−
登録日: 2008/10/26
居住地:
投稿: 3217
Re: [教えてください]プラグインを使用した拡張機能について
キャッシュをクリアするとどうなりますか?
管理画面のコンテンツ管理からキャッシュクリアの操作が行えます。


----------------
株式会社シロハチ
■ECCUBE2系、3系構築カスタマイズご相談ください。
EC-CUBE3マニュアル
blog

tawaba
投稿日時: 2019/5/28 17:40
対応状況: −−−
半人前
登録日: 2019/5/27
居住地:
投稿: 12
Re: [教えてください]プラグインを使用した拡張機能について
ご返信ありがとうございます。

キャッシュをクリアしてもダメでした。。。

ちなみに、拡張項目で画像を出すことはできました。

ソースは以下になります。

<!-- これは正しく表示されます -->
<div class="expansion-size-image">
{% for value in __EX_PRODUCT.1.value %}
<div class="size-images">
<img src="{{ app.config.image_save_urlpath }}/{{value}}" />
</div>
{% endfor %}
</div>
<!-- / これは正しく表示されます -->

<!-- これは表示されません -->
<div class="expansion-size-image">
{% for values in __EX_PRODUCT.3.value %}
<p>{{values}}</p>
{% endfor %}
</div>
<!-- / これは表示されません -->
468
投稿日時: 2019/5/29 10:58
対応状況: −−−
登録日: 2008/10/26
居住地:
投稿: 3217
Re: [教えてください]プラグインを使用した拡張機能について
ご提示いただいたtwigの記述を見る限りでは問題は無いように見えますね。

確認なのですが、__EX_PRODUCT.1の項目もセレクトボックスですか?
あと、セレクトボックスは複数選択できる形式で追加されるものなのでしょうか?


----------------
株式会社シロハチ
■ECCUBE2系、3系構築カスタマイズご相談ください。
EC-CUBE3マニュアル
blog

tawaba
投稿日時: 2019/5/31 13:58
対応状況: −−−
半人前
登録日: 2019/5/27
居住地:
投稿: 12
Re: [教えてください]プラグインを使用した拡張機能について
ご返信ありがとうございます。

__EX_PRODUCT.1の項目はセレクトボックスでは無く、画像を表示するだけの項目になります。
セレクトボックスは、複数選択はせず、1つだけ選択できるものとなります。

先ほど下記のように記述してみたら、optionタグに文字列を表示することができたのですが、拡張項目画面で設定した選択肢の文字列が表示されなくて、項目IDと項目名が表示れてしまい、意図する状態では無いです。。。

念のため、ページ全体のソースを記載いたしますので、何かヒントがあればご教示いただけますでしょうか><;

該当となる箇所は、ソースの最下部となります。


{#
This file is part of EC-CUBE

Copyright(c) 2000-2015 LOCKON CO.,LTD. All Rights Reserved.

http://www.lockon.co.jp/

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
#}
{% extends 'default_frame.twig' %}

{% set body_class = 'product_page' %}

{% block javascript %}
<script>
    eccube.classCategories = {{ Product.class_categories|json_encode|raw }};

    // 規格2に選択肢を割り当てる。
    function fnSetClassCategories(form, classcat_id2_selected) {
        var $form = $(form);
        var product_id = $form.find('input[name=product_id]').val();
        var $sele1 = $form.find('select[name=classcategory_id1]');
        var $sele2 = $form.find('select[name=classcategory_id2]');
        eccube.setClassCategories($form, product_id, $sele1, $sele2, classcat_id2_selected);
    }

    {% if form.classcategory_id2 is defined %}
    fnSetClassCategories(
            document.form1, {{ form.classcategory_id2.vars.value|json_encode|raw }}
    );
    {% endif %}
</script>

<script>
$(function(){
    $('.carousel').slick({
        infinite: false,
        speed: 300,
        prevArrow:'<button type="button" class="slick-prev"><span class="angle-circle"><svg class="cb cb-angle-right"><use xlink:href="#cb-angle-right" /></svg></span></button>',
        nextArrow:'<button type="button" class="slick-next"><span class="angle-circle"><svg class="cb cb-angle-right"><use xlink:href="#cb-angle-right" /></svg></span></button>',
        slidesToShow: 4,
        slidesToScroll: 4,
        responsive: [
            {
                breakpoint: 768,
                settings: {
                    slidesToShow: 3,
                    slidesToScroll: 3
                }
            }
        ]
    });

    $('.slides').slick({
        dots: true,
        arrows: false,
        speed: 300,
        customPaging: function(slider, i) {
            return '<button class="thumbnail">' + $(slider.$slides[i]).find('img').prop('outerHTML') + '</button>';
        }
    });

    $('#favorite').click(function() {
        $('#mode').val('add_favorite');
    });

    $('#add-cart').click(function() {
        $('#mode').val('add_cart');
    });

    // bfcache無効化
    $(window).bind('pageshow', function(event) {
        if (event.originalEvent.persisted) {
            location.reload(true);
        }
    });
});
</script>

{% endblock %}

{% block main %}
    {# todo ブロック化}
    <div id="topicpath" class="row">
        {% for ProductCategory in Product.ProductCategories %}
        <ol>
            <li><a href="{{ url('product_list') }}">全商品</a></li>
            {% for Category in ProductCategory.Category.path %}
                <li><a href="{{ url('product_list') }}?category_id={{ Category.id }}">{{ Category.name }}</a></li>
            {% endfor %}
            <li>{{ Product.name }}</li>
        </ol>
        {% endfor %}
    </div>
    #}

    <!-- ▼item_detail▼ -->
    <div id="item_detail">
        <div id="detail_wrap" class="row">
            <!--★画像★-->
            <div id="item_photo_area" class="col-sm-6">
                <div id="detail_image_box__slides" class="slides">
                    {% if Product.ProductImage|length > 0 %}
                        {% for ProductImage in Product.ProductImage %}
                        <div id="detail_image_box__item--{{ loop.index }}"><img src="{{ app.config.image_save_urlpath }}/{{ ProductImage|no_image_product }}"/></div>
                        {% endfor %}
                    {% else %}
                        <div id="detail_image_box__item"><img src="{{ app.config.image_save_urlpath }}/{{ ''|no_image_product }}"/></div>
                    {% endif %}
                </div>
            </div>

            <section id="item_detail_area" class="col-sm-6">

                <!--★商品名★-->
                <h3 id="detail_description_box__name" class="item_name">{{ Product.name }}</h3>
                <div id="detail_description_box__body" class="item_detail">

                    {% if Product.ProductTag is not empty %}
                        <!--▼商品タグ-->
                        <div id="product_tag_box" class="product_tag">
                            {% for ProductTag in Product.ProductTag %}
                                <span id="product_tag_box__product_tag--{{ ProductTag.Tag.id }}" class="product_tag_list">{{ ProductTag.Tag }}</span>
                            {% endfor %}
                        </div>
                        <hr>
                        <!--▲商品タグ-->
                    {% endif %}

                    <!--★通常価格★-->
                    {% if Product.hasProductClass -%}
                        {% if Product.getPrice01Min is not null and Product.getPrice01IncTaxMin == Product.getPrice01IncTaxMax %}
                        <p id="detail_description_box__class_normal_price" class="normal_price"> 通常価格:<span class="price01_default">{{ Product.getPrice01IncTaxMin|price }}</span> <span class="small">税込</span></p>
                        {% elseif Product.getPrice01Min is not null and Product.getPrice01Max is not null %}
                        <p id="detail_description_box__class_normal_range_price" class="normal_price"> 通常価格:<span class="price01_default">{{ Product.getPrice01IncTaxMin|price }} ~ {{ Product.getPrice01IncTaxMax|price }}</span> <span class="small">税込</span></p>
                        {% endif %}
                    {% else -%}
                        {% if Product.getPrice01Max is not null %}
                        <p id="detail_description_box__normal_price" class="normal_price"> 通常価格:<span class="price01_default">{{ Product.getPrice01IncTaxMin|price }}</span> <span class="small">税込</span></p>
                        {% endif %}
                    {% endif -%}

                    <!--★販売価格★-->
                    {% if Product.hasProductClass -%}
                        {% if Product.getPrice02IncTaxMin == Product.getPrice02IncTaxMax %}
                        <p id="detail_description_box__class_sale_price" class="sale_price text-primary"> <span class="price02_default">{{ Product.getPrice02IncTaxMin|price }}</span> <span class="small">税込</span></p>
                        {% else %}
                        <p id="detail_description_box__class_range_sale_price" class="sale_price text-primary"> <span class="price02_default">{{ Product.getPrice02IncTaxMin|price }} ~ {{  Product.getPrice02IncTaxMax|price }}</span> <span class="small">税込</span></p>
                        {% endif %}
                    {% else -%}
                        <p id="detail_description_box__sale_price" class="sale_price text-primary"> <span class="price02_default">{{ Product.getPrice02IncTaxMin|price }}</span> <span class="small">税込</span></p>
                    {% endif -%}

                    <!--▼商品コード-->
                    <p id="detail_description_box__item_range_code" class="item_code">商品コード: <span id="item_code_default">
                        {{ Product.code_min }}
                        {% if Product.code_min != Product.code_max %} ~ {{ Product.code_max }}{% endif %}
                        </span> </p>
                    <!--▲商品コード-->

                    <!-- ▼関連カテゴリ▼ -->
                    <div id="relative_category_box" class="relative_cat">
                        <p>関連カテゴリ</p>
                          {% for ProductCategory in Product.ProductCategories %}
                        <ol id="relative_category_box__relative_category--{{ ProductCategory.product_id }}_{{ loop.index }}">
                            {% for Category in ProductCategory.Category.path %}
                            <li><a id="relative_category_box__relative_category--{{ ProductCategory.product_id }}_{{ loop.parent.loop.index }}_{{ Category.id }}" href="{{ url('product_list') }}?category_id={{ Category.id }}">{{ Category.name }}</a></li>
                            {% endfor %}
                        </ol>
                        {% endfor %}
                    </div>
                    <!-- ▲関連カテゴリ▲ -->

                    <form action="?" method="post" id="form1" name="form1">
                        <!--▼買い物かご-->
                        <div id="detail_cart_box" class="cart_area">
                            {% if Product.stock_find %}

                                {# 規格 #}
                                {% if form.classcategory_id1 is defined %}
                                <ul id="detail_cart_box__cart_class_category_id" class="classcategory_list">
                                    {# 規格1 #}
                                    <li>
                                        {{ form_widget(form.classcategory_id1) }}
                                        {{ form_errors(form.classcategory_id1) }}
                                    </li>
                                    {# 規格2 #}
                                    {% if form.classcategory_id2 is defined %}
                                        <li>
                                            {{ form_widget(form.classcategory_id2) }}
                                            {{ form_errors(form.classcategory_id2) }}
                                        </li>
                                     {% endif %}
                                </ul>
                                {% endif %}

                                {# 数量 #}
                                <dl id="detail_cart_box__cart_quantity" class="quantity">
                                    <dt>数量</dt>
                                    <dd>
                                        {{ form_widget(form.quantity) }}
                                        {{ form_errors(form.quantity) }}
                                    </dd>
                                </dl>

                                <div class="extra-form">
                                    {% for f in form.getIterator %}
                                        {% if f.vars.name matches '[^plg*]' %}
                                            {{ form_row(f) }}
                                        {% endif %}
                                    {% endfor %}
                                </div>

                                {# カートボタン #}
                                <div id="detail_cart_box__button_area" class="btn_area">
                                    <ul id="detail_cart_box__insert_button" class="row">
                                        <li class="col-xs-12 col-sm-8"><button type="submit" id="add-cart" class="btn btn-primary btn-block prevention-btn prevention-mask">カートに入れる</button></li>
                                    </ul>
                                    {% if BaseInfo.option_favorite_product == 1 %}
                                    <ul id="detail_cart_box__favorite_button" class="row">
                                        {% if is_favorite == false %}
                                            <li class="col-xs-12 col-sm-8"><button type="submit" id="favorite" class="btn btn-info btn-block prevention-btn prevention-mask">お気に入りに追加</button></li>
                                        {% else %}
                                            <li class="col-xs-12 col-sm-8"><button type="submit" id="favorite" class="btn btn-info btn-block" disabled="disabled">お気に入りに追加済みです</button></li>
                                        {% endif %}
                                    </ul>
                                    {% endif %}
                                </div>
                            {% else %}
                                {# 在庫がない場合は品切れボタンのみ表示 #}
                                <div id="detail_cart_box__button_area" class="btn_area">
                                    <ul class="row">
                                        <li class="col-xs-12 col-sm-8"><button type="button" class="btn btn-default btn-block" disabled="disabled">ただいま品切れ中です</button></li>
                                    </ul>
                                </div>
                            {% endif %}
                        </div>
                        <!--▲買い物かご-->
                        {{ form_rest(form) }}
                    </form>

                    <!--★商品説明★-->
                    <h3 class="detail_title">COMMENT</h3>
                    <p id="detail_not_stock_box__description_detail" class="item_comment">{{ Product.description_detail|raw|nl2br }}</p>

                </div>
                <!-- /.item_detail -->

            </section>
            <!--詳細ここまで-->
        </div>

        {# フリーエリア #}
        {% if Product.freearea %}
        <div id="sub_area" class="row">
            <div class="col-sm-10 col-sm-offset-1">
                <div id="detail_free_box__freearea" class="freearea">{{ include(template_from_string(Product.freearea)) }}</div>
            </div>
        </div>
        {% endif %}
    </div>
    <!-- ▲item_detail▲ -->

    <!-- 寸法 これは正しく表示されます -->
    <div class="expansion-size-image">
      {% for value in __EX_PRODUCT.1.value %}
        <div class="size-images">
          <img src="{{ app.config.image_save_urlpath }}/{{value}}" />
        </div>
      {% endfor %}
    </div>
    <!--  / 寸法 これは正しく表示されます -->
    
    <!--  これが正しく表示されません -->
    <div class="expansion-size-image">
      <select class="" name="">
        {% for values in __EX_PRODUCT.5 %}
          <option value="">{{values}}</option>
        {% endfor %}
      </select>
    </div>
    <!--  / これが正しく表示されません -->
<!-- ▲item_detail▲ -->
{% endblock %}
468
投稿日時: 2019/5/31 16:56
対応状況: −−−
登録日: 2008/10/26
居住地:
投稿: 3217
Re: [教えてください]プラグインを使用した拡張機能について
もしかして、セレクトボックスを表示しようとされているのは
フロントの商品詳細ページですか?

ご利用のプラグインは、
管理画面に入力項目を追加して、その内容をフロントに表示するプラグインかと思いますので
商品詳細ページにform関連の部品を追加するようなものではないかと思いますが如何でしょうか?
(提供元に確認していただくのが確実かと思いますが...)

>[補足2]
>セレクトボックスの選択肢の設定方法は、以下のように書かれています。
>====
>ルール1. 1行に1つの選択肢情報を記載する
>ルール2. 選択肢の値と、テキストの間はコロン「:」で区切る
↑こちらは管理画面の商品編集画面にセレクトボックスを表示させる場合の記述ルールの説明ではないでしょうか?

カート投入時に何か情報をユーザーに入力させようとされていますか?
(のしの有無のようなオプション機能)
もし、そのような要件の場合は
注文データまでオプション情報をつなげていく必要があると思いますので
プラグインとしては以下のものを利用する形になるかと思います。
https://www.ec-cube.net/products/detail.php?product_id=1148


----------------
株式会社シロハチ
■ECCUBE2系、3系構築カスタマイズご相談ください。
EC-CUBE3マニュアル
blog

tawaba
投稿日時: 2019/6/1 17:26
対応状況: −−−
半人前
登録日: 2019/5/27
居住地:
投稿: 12
Re: [教えてください]プラグインを使用した拡張機能について
ご返信ありがとうございます。

>もしかして、セレクトボックスを表示しようとされているのは
>フロントの商品詳細ページですか?
はい。ご指摘の様に、フロント画面で表示をしたいと考えております。

今回の開発は、アパレルサイトにおける商品詳細ページで、「商品のサイズ」「商品のカラー」といった項目を購入時にユーザーに選択させるようにしたいと思っております。

ご提案くださいましたプラグインですと、上記の仕様を担保できそうですね!
提供元に確認してみます!

スレッド表示 | 新しいものから 前のトピック | 次のトピック | トップ


 



ログイン


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

統計情報

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

投稿数ランキング

1
seasoft
7367
2
468
3217
3
AMUAMU
2712
4
nanasess
2311
5
umebius
2085
6
yuh
1819
7
h_tanaka
1638
8
red
1569
9
mcontact
1279
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.