プラグイン > バグ報告・利用に関する質問 > Impossible to access an attribute ("name01") on a string variable ("anon.").について |
バグ報告・利用に関する質問
スレッド表示 | 新しいものから | 前のトピック | 次のトピック | 下へ |
投稿者 | スレッド |
---|---|
shige0309 |
投稿日時: 2019/3/23 23:30
対応状況: −−−
|
半人前 登録日: 2018/2/27 居住地: 投稿: 28 |
Impossible to access an attribute ("name01") on a string variable ("anon.").について ▼テンプレート
[EC-CUBE] 3.0.16 [レンタルサーバ] さくらインターネット レンタルサーバー スタンダード [OS] FreeBSD 11.2-RELEASE-p8 amd64 [PHP] PHP 7.2.14 [データベース] MySQL 5.7 [WEBサーバ] nginx + Apache2.4系 [ブラウザ] Google Chrome 72.0.3626.121 [導入プラグインの有無] 詳しい商品一覧 BrandingAdmin キャンセル時 在庫を自動で戻します 最近チェックした商品 規格詳細表示 お問い合わせ管理 GoogleAnalytics簡単設置プラグイン この商品をみた人はこんな商品もみています MailMagazine 新着商品 新着情報画像 for EC-CUBE3 売れ筋順プラグイン for EC-CUBE3 画像Zipアップローダー 新着情報ページネータ ぱんクズプラグイン おすすめ商品管理プラグイン 売上ランキング 売上集計プラグイン 一覧画面(商品管理)背景色追加プラグイン FAQ管理プラグイン 入力確認プラグイン 見積書お問い合わせ追加プラグイン [カスタマイズの有無] オリジナルテンプレートを使用しています。 [現象] データベースをテストから本番サーバーにインポートした所、下記エラーが発生し、エラー内容も解除方法もわからず困っています。 Impossible to access an attribute ("name01") on a string variable ("anon."). 「default_frame.twig」の下記で発生しているようです。 <div class="container clearfix"> {% if app.user.name01 != '' %} <p class="d-none d-lg-block float-right">ようこそ {{ app.user.name01 }} {{ app.user.name02 }}様</p> {% else %} <p class="d-none d-lg-block float-right">ようこそ ゲスト様</p> {% endif %} </div> 申し訳ございませんが、皆さんのお力を頂けますと幸いです。 |
umebius |
投稿日時: 2019/3/23 23:32
対応状況: −−−
|
神 登録日: 2016/7/22 居住地: 投稿: 2085 |
Re: Impossible to access an attribute ("name01") on a string variable ("anon.").について ログインしているかの判定が必要なので
{% if app.user.name01 != '' %}を下記に変更する必要があります。 {% if is_granted('ROLE_USER') and app.user.name01 != '' %} app.user.name01 が空文字の可能性がないのであれば {% if is_granted('ROLE_USER') %}だけで十分かもしれません。
|
shige0309 |
投稿日時: 2019/3/23 23:52
対応状況: −−−
|
半人前 登録日: 2018/2/27 居住地: 投稿: 28 |
Re: Impossible to access an attribute ("name01") on a string variable ("anon.").について umebius様ありがとうございます。
{% if is_granted('ROLE_USER') and app.user.name01 != '' %} に変更した所、「Impossible to access an attribute ("name01") on a string variable ("anon.").」は発生しなくなりましたが、下記エラーが発生しました。 An exception has been thrown during the rendering of a template ("User Warning: Unable to generate a URL for the named route "block_header_right_menu" as such route does not exist."). 「block_header_right_menu」が存在しないと警告されているようです。Blockフォルダにファイルが存在しないということでしょうか。 |
umebius |
投稿日時: 2019/3/23 23:55
対応状況: −−−
|
神 登録日: 2016/7/22 居住地: 投稿: 2085 |
Re: Impossible to access an attribute ("name01") on a string variable ("anon.").について 全く別のエラーですね。
Blockフォルダにファイルが存在しないかどうかはわかりませんが、 FrontControllerProviderにURLの記載がないからだと思います。 header_right_menuブロックはどうやって作成されたのでしょうか? データベースに直接INSERTですか? |
shige0309 |
投稿日時: 2019/3/23 23:59
対応状況: −−−
|
半人前 登録日: 2018/2/27 居住地: 投稿: 28 |
Re: Impossible to access an attribute ("name01") on a string variable ("anon.").について umebius様
データベースに直接INSERT致しました。 FrontControllerProviderにURL記載していないので、記載してみます。 ご返信ありがとうございます。 大変助かります。 |
umebius |
投稿日時: 2019/3/24 0:16
対応状況: −−−
|
神 登録日: 2016/7/22 居住地: 投稿: 2085 |
Re: Impossible to access an attribute ("name01") on a string variable ("anon.").について DBへ直接INSERTされるということは
動的な内容があるブロックということですか? (静的なものなら管理画面から作成する方が楽なので) 動的であれば、よろしければ参考にしてください。 EC-CUBE3 動的ブロックの作成方法
|
shige0309 |
投稿日時: 2019/3/24 0:59
対応状況: −−−
|
半人前 登録日: 2018/2/27 居住地: 投稿: 28 |
Re: Impossible to access an attribute ("name01") on a string variable ("anon.").について umebius様
おっしゃられる通り、動的なブロックです。 静的なら楽なのですが 下記参考にさせていただきます EC-CUBE3 動的ブロックの作成方法 本当にありがとうございます! 大変助かります |
shige0309 |
投稿日時: 2019/3/24 1:17
対応状況: 確認中
|
半人前 登録日: 2018/2/27 居住地: 投稿: 28 |
Re: Impossible to access an attribute ("name01") on a string variable ("anon.").について umebius様
FrontControllerProviderにURLを設定した所エラーは解除されました ありがとうございます! 下記エラーが発生しました NewsImagesはプラグインの「新着情報画像 for EC-CUBE3」の変数のような気がします。 Twig_Error_Runtime in Template.php line 487: Variable "NewsImages" does not exist in "__string_template__ae62a1f11f6987c8bde50dfb704849943530435d725477cabb7bc5b5346cb8f9" at line 14. すみませんが、ご教示いただけると幸いです。 |
umebius |
投稿日時: 2019/3/24 1:23
対応状況: −−−
|
神 登録日: 2016/7/22 居住地: 投稿: 2085 |
Re: Impossible to access an attribute ("name01") on a string variable ("anon.").について 新着情報画像 for EC-CUBE3については良く知らないのですが、
要はNewsImagesという変数がtwigに使われているのに、コントローラー(プラグインのEventかも)から渡されてきていないというエラーです。 なのでNewsImagesというtwigの変数がどこで使われているかをまず特定することが先決かと思います。 その周辺のコードをご提示いただければ修正案は出せるかもしれません。 |
shige0309 |
投稿日時: 2019/3/24 1:40
対応状況: −−−
|
半人前 登録日: 2018/2/27 居住地: 投稿: 28 |
Re: Impossible to access an attribute ("name01") on a string variable ("anon.").について umebius様
ご返信ありがとうございます! 新着情報画像 for EC-CUBE3ですが、 {% if NewsImages[News.id] %} <img src='{{ app.config.image_save_urlpath }}/{{ NewsImages[News.id] }}' /> {% endif %} 「新着情報ブロック編集ページの「{% for News in NewsList %}{% endfor %}」内に上記タグを追加して下さい。」とのことです。 とりあえず確認した所、新着情報ブロックに埋め込んでありました。 「新着情報ブロック」 <li class="col-xl-4 col-lg-4 col-md-4 mt-3 col-sm-4 col-6"> {% if News.url %} <a href="{{ News.url }}" {% if News.link_method=='1' %}target="_blank" {% endif %}>{% endif %} {% if NewsImages[News.id] %} <img src="{{ app.config.image_save_urlpath }}/{{ NewsImages[News.id] }}"/> {% else %} <img src="{{ app.config.front_urlpath }}/img/common/no_image.gif" alt="NO IMAGE"/> {% endif %} <br> <p class="topics-cat_time mt-2"><time datetime="{{ News.date|date('Y/m/d') }}">{{ News.date|date('Y/m/d') }}</time></p> <p class="font-weight-bold mt-2">{{ News.title }}</p> {% if News.comment or News.url %} <span class="mt-2 mb-5 d-inline-block">{{ News.comment|raw|nl2br }}</span> {% endif %} {% if News.url %}</a>{% endif %} </li> 申し訳ございませんが、ご教示頂けますと幸いです。 |
(1) 2 » |
スレッド表示 | 新しいものから | 前のトピック | 次のトピック | トップ |