質問 > その他 > 商品がカートに入らなくなった |
その他
スレッド表示 | 新しいものから | 前のトピック | 次のトピック | 下へ |
投稿者 | スレッド |
---|---|
soramame |
投稿日時: 2017/4/26 11:24
対応状況: −−−
|
新米 登録日: 2017/4/26 居住地: 投稿: 2 |
商品がカートに入らなくなった ▼テンプレート
[EC-CUBE]3.0.12 [レンタルサーバ]ロリポップ [ブラウザ]Google chrome [現象] 商品詳細ページを下記に記載しましたように書き換えたところ カートに入れるボタンを押してもカートに入らなくなりました。 商品詳細ページの画面です。 http://broadbeans.co.jp/products/detail/1841 この画面のカートに入れるを押すと、 読み込むような動作をしますが、その後 http://broadbeans.co.jp/products/detail/1841? のようにアドレスの後ろに?がつくだけでカートの中身が増えません。 対応を教えてください。 [カスタマイズの有無]商品詳細ページを次のように書き換えました {% 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_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> <!--★商品名★--> <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> <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="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 style="display: none"><input type="hidden" id="mode" name="mode"></div> <div style="display: none"><input type="hidden" id="product_id" name="product_id" value="1841"></div> <div style="display: none"><input type="hidden" id="product_class_id" name="product_class_id" value="1846"></div> <div style="display: none"><input type="hidden" id="_token" name="_token" value="rZCs4f0p6XrQA0kiPfrokxiDw_MI6AjzYL1-MHUBpNI"></div> </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> <p id="detail_not_stock_box__description_detail" class="item_comment">{{ Product.description_detail|raw|nl2br }}</p> </div> <!--▲買い物かご--> {{ form_rest(form) }} </form> <!--★商品説明★--> <!-- /.item_detail --> <section id="item_detail_area" class="col-sm-6"> <div id="item_detail"> <div id="detail_wrap" class="row"> </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▲ --> {% endblock %} |
umebius |
投稿日時: 2017/4/26 11:33
対応状況: −−−
|
神 登録日: 2016/7/22 居住地: 投稿: 2085 |
Re: 商品がカートに入らなくなった このあたりが原因ではないでしょうか
引用: <div style="display: none"><input type="hidden" id="mode" name="mode"></div>
|
soramame |
投稿日時: 2017/4/26 14:49
対応状況: 確認中
|
新米 登録日: 2017/4/26 居住地: 投稿: 2 |
Re: 商品がカートに入らなくなった コメントありがとうございます。
ご指摘いただいた部分を削除してみましたが、 カートに入らない問題が引き続き起きています。 |
umebius |
投稿日時: 2017/4/26 14:58
対応状況: −−−
|
神 登録日: 2016/7/22 居住地: 投稿: 2085 |
Re: 商品がカートに入らなくなった では、カートボタンのidをadd-cartから変えたためではないでしょうか。
|
468 |
投稿日時: 2017/4/26 17:30
対応状況: −−−
|
神 登録日: 2008/10/26 居住地: 投稿: 3217 |
Re: 商品がカートに入らなくなった リンク先のサイトを見てみると
カートに入れる処理の<form></form>の間に product_id, product_class_id, _tokenなど必要な情報が入っていないように見えます。 多分、カート投入の為の<form></form>の中に、 商品についてのお問い合わせボタンを設置したことで、 </form>が勝手に挿入されていると思います。 ブラウザのソースの表示でHTMLを確認すると、 <form></form>の数がおかしいのが確認できると思います。
|
umebius |
投稿日時: 2017/4/26 17:54
対応状況: −−−
|
神 登録日: 2016/7/22 居住地: 投稿: 2085 |
Re: 商品がカートに入らなくなった 確かに今見るとずれてますね。
再投稿になりますが、 3.0.12ではmodeパラメータにadd_cartが入っていなければカートに追加できません。 そのためカートボタンのIDはadd-cartである必要があります。 あるいは下記のjsを修正ください
|
スレッド表示 | 新しいものから | 前のトピック | 次のトピック | トップ |