質問 > その他 > 独自ドメインに変更したらカートに商品が入らなくなった |
その他
スレッド表示 | 新しいものから | 前のトピック | 次のトピック | 下へ |
投稿者 | スレッド |
---|---|
ykkm |
投稿日時: 2018/7/5 10:16
対応状況: −−−
|
半人前 登録日: 2018/7/3 居住地: 投稿: 12 |
独自ドメインに変更したらカートに商品が入らなくなった ▼テンプレート
[EC-CUBE] 3.0.16 [レンタルサーバ] ロリポップ [OS] MacOS 10.13.4 [PHP] 5.3.29 [データベース] MySQL 5.6.23-log [WEBサーバ] Apache [ブラウザ] MacOS 10.13.4 [導入プラグインの有無] PayPalExpress,新着商品ブロックプラグイン [カスタマイズの有無] 無 [現象] ロリポップのドメインから独自ドメインに変更したところ、カートに商品が入らなくなってしまいました。 「カートに入れる」ボタンをクリックしても、アドレスの最後に?が付いて次画面に遷移しません。 商品詳細ページのtwigはデフォルトのままです。 ロリポップドメインで「カートに入れる」ボタン周辺の要素を確認すると、 <button id="add-cart" class="btn btn-primary btn-block prevention-btn prevention-mask"type="submit">カートに入れる</button> の最後に「event」の表示があって、これをクリックすると以下の3つのデータが表示されます。 ーー1ーー function() { $overlay = $('<div class="prevention-masked">'); $('body').append($overlay); } ーー2ーー function() { $(this).attr('disabled', 'disabled'); var $form = $(this).parents('form'); // マスク表示させるためsetTimeoutを使って処理を遅らせる setTimeout(function() { $form.submit(); }, 0); return false; } ーー3ーー function() { $('#mode').val('add_cart'); } しかし、独自ドメインで要素を確認すると、この「event」という表示がありませんでした。 システムに関して素人で、どこを修正するべきか皆目見当がつかない状態です。 何卒宜しくお願い致します。 |
468 |
投稿日時: 2018/7/5 11:45
対応状況: −−−
|
神 登録日: 2008/10/26 居住地: 投稿: 3217 |
Re: 独自ドメインに変更したらカートに商品が入らなくなった jsファイルのリンクが切れていたりしていないでしょうか?
デフォルトだと以下のファイルが対象かと思います。 /html/template/default/js/function.js
|
ykkm |
投稿日時: 2018/7/6 10:41
対応状況: −−−
|
半人前 登録日: 2018/7/3 居住地: 投稿: 12 |
Re: 独自ドメインに変更したらカートに商品が入らなくなった ご教授ありがとうございます。
integrityで確認したところ、jsのリンク切れは無いようです。 知識が無い中無理やり自力でどうにかしようとしているのがいけないのですが・・・・。 他に原因となる可能性のある個所はありますでしょうか? ちなみに、商品詳細ページのtwigは以下の通りです。 何卒宜しくお願い申し上げます。 {# 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 }} ); {% elseif form.classcategory_id1 is defined %} eccube.checkStock(document.form1, {{ Product.id }}, {{ form.classcategory_id1.vars.value|json_encode|raw }}, null); {% 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> {#Favorite product button#} {% 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> {#End div#detail_cart_box__button_area #} {% 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> {#Favorite product button#} {% 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> {#End div#detail_cart_box__button_area #} {% endif %} {#End stock find#} </div> <!--▲買い物かご--> {{ form_rest(form) }} </form> <!--★商品説明★--> <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▲ --> {% endblock %} |
nanasess |
投稿日時: 2018/7/6 10:54
対応状況: −−−
|
神 登録日: 2006/9/9 居住地: 投稿: 2314 |
Re: 独自ドメインに変更したらカートに商品が入らなくなった JavaScript エラーとか出ていませんか?
|
x002dc |
投稿日時: 2018/7/6 11:21
対応状況: −−−
|
半人前 登録日: 2018/6/27 居住地: 東京 投稿: 30 |
Re: 独自ドメインに変更したらカートに商品が入らなくなった function.jsが正常に読まれているのであれば、他の方が書かれている通り、おそらくjsでエラーが発生しているため、カートに入れる処理が正常に動作していないと思われます。
実際、「events」の表示がなくなってしまっているのは、カートを押下したときの処理が登録されていないことを示しています。 まずは、Chromeなどを使って、javascriptのエラーを確認することをおすすめします。 https://eng-entrance.com/javascript-display-error |
ykkm |
投稿日時: 2018/7/11 11:23
対応状況: −−−
|
半人前 登録日: 2018/7/3 居住地: 投稿: 12 |
Re: 独自ドメインに変更したらカートに商品が入らなくなった ありがとうございます。
chromeでチェックしたところ、エラーは検出されず、以下の警告文のようなものが表示されました。 >jquery.js:4388 [Violation] Added non-passive event listener to a scroll-blocking 'touchstart' event. Consider marking event handler as 'passive' to make the page more responsive. See https://www.chromestatus.com/feature/5745543795965952 jquery.js:4388 該当部分は以下の最終行です。 // Only use addEventListener/attachEvent if the special events handler returns false if ( !special.setup || special.setup.call( elem, data, namespaces, eventHandle ) === false ) { // Bind the global event handler to the element if ( elem.addEventListener ) { elem.addEventListener( type, eventHandle, false ); どうも、今回のエラーと関係がなさそうですが・・・。 その他、エラーの原因になりそうなことはありますでしょうか? ちなみに、独自ドメインにSSLを設定していることが影響している可能性はありますか? 八方塞がりです。何卒宜しくお願い申し上げます。 |
ykkm |
投稿日時: 2018/7/11 11:45
対応状況: −−−
|
半人前 登録日: 2018/7/3 居住地: 投稿: 12 |
Re: 独自ドメインに変更したらカートに商品が入らなくなった <補足です>
あれやこれや試して見ているうちに、なぜか独自ドメインの「カートに入れる」ボタンのHTMLの最後にも「event」の表示がされるようになりました。 しかし、依然カートに商品は入りません。 eventの内容は以下の通りです。 >click...html/template/default/js/function.js?=3.0.16:133 jQuery >click...html/template/default/js/function.js?=3.0.16:133 jQuery >click https://独自ドメイン/products/detail/13:228 jQuery jQueryをクリックすると、それぞれ以下のように表示されます。 ------- function() { $overlay = $('<div class="prevention-masked">'); $('body').append($overlay); } ------- function() { $(this).attr('disabled', 'disabled'); var $form = $(this).parents('form'); // マスク表示させるためsetTimeoutを使って処理を遅らせる setTimeout(function() { $form.submit(); }, 0); return false; } ------- function() { $('#mode').val('add_favorite'); } |
468 |
投稿日時: 2018/7/11 14:23
対応状況: −−−
|
神 登録日: 2008/10/26 居住地: 投稿: 3217 |
Re: 独自ドメインに変更したらカートに商品が入らなくなった 一連の現象について、テンプレートの変更が影響していると思われますが、
独自ドメインに切り替えると上手く動作しないという事からセッション関連の問題を抱えている可能性もあるかと思います。 今はカートの画面に遷移しないのでしょうか? 差し障りが無いようでしたら、 実際のページをご提示いただくのが手取り早いのではないかと思います。
|
ykkm |
投稿日時: 2018/7/11 16:54
対応状況: −−−
|
半人前 登録日: 2018/7/3 居住地: 投稿: 12 |
Re: 独自ドメインに変更したらカートに商品が入らなくなった ありがとうございます。
テンプレートをデフォルトの初期状態に戻して試して見ましたが、同じエラーがおきてしまいました。 現在は、デフォルトテンプレートに変更を加えたものに戻した状態になっています。 URLは以下の通りです。 https://ateliermumu.shop/products/detail/13 「カートに入れる」ボタンの他に「お気に入りに追加」も同様の症状になっています。 どうぞ宜しくお願い申し上げます。 |
468 |
投稿日時: 2018/7/11 17:34
対応状況: −−−
|
神 登録日: 2008/10/26 居住地: 投稿: 3217 |
Re: 独自ドメインに変更したらカートに商品が入らなくなった ありがとうございます。
サイトを確認させていただいて気になった点ですが、 /app/config/eccube/path.ymlの7行目のroot_urlpathの設定が/shopになっていないでしょうか? 多分、/が正しい設定かと思います。 (ドメイン適用前は/shopというディレクトリにインストールされていませんか? その他/shopが記述されている設定はありませんか?) お気に入りも原因は同じかと思います。
|
(1) 2 » |
スレッド表示 | 新しいものから | 前のトピック | 次のトピック | トップ |