简体   繁体   English

facebook messenger 的 OpenCart 主题问题

[英]OpenCart theme problem with facebook messenger

I successfully integrated FB Messenger into my OpenCart 3.0.3.7 website using the instructions from here https://developers.facebook.com/docs/messenger-platform/reference/web-plugins/我使用此处https://developers.facebook.com/docs/messenger-platform/reference/web-plugins/的说明成功地将 FB Messenger 集成到了我的 OpenCart 3.0.3.7 网站中

  <div id="fb-root"></div>
      <script>
        window.fbAsyncInit = function() {
          FB.init({
            xfbml            : true,
            version          : 'v10.0'
          });
        };

        (function(d, s, id) {
          var js, fjs = d.getElementsByTagName(s)[0];
          if (d.getElementById(id)) return;
          js = d.createElement(s); js.id = id;
          js.src = 'https://connect.facebook.net/el_GR/sdk/xfbml.customerchat.js';
          fjs.parentNode.insertBefore(js, fjs);
        }(document, 'script', 'facebook-jssdk'));
      </script>

      <!-- Your Chat Plugin code -->
      <div class="fb-customerchat"
        attribution="setup_tool"
        page_id="00000000000000">
      </div>    
    

Under the default theme, it works perfectly and as expected, but when I use the zeexo theme for some reason (I suspect js or css conflict??) it shows a white circle that does not respond to anything.在默认主题下,它可以完美运行并按预期工作,但是当我出于某种原因使用zeexo主题时(我怀疑 js 或 css 冲突??)它显示一个白色圆圈,没有任何响应。 How to overcome this problem?如何克服这个问题? What part of the code is responsible for this behavior?代码的哪一部分对这种行为负责?

在此处输入图像描述

There was a JS conflict with the theme's Facebook widget.与主题的 Facebook 小部件存在 JS 冲突。

All I had to do, was to replace the "bad" or old (??) JS code under the catalog\view\theme\zeexo\template\common\header.twig我所要做的就是替换catalog\view\theme\zeexo\template\common\header.twig下的“坏”或旧(??)JS代码

        <script>(function(d, s, id) {
          var js, fjs = d.getElementsByTagName(s)[0];
          if (d.getElementById(id)) return;
          js = d.createElement(s); js.id = id;
          js.src = "//connect.facebook.net/en_US/all.js#xfbml=1";
          fjs.parentNode.insertBefore(js, fjs);
        }(document, 'script', 'facebook-jssdk'));</script>

with the newer, I got from the Facebook SDK使用较新的,我从 Facebook SDK

  <script>
    window.fbAsyncInit = function() {
      FB.init({
        xfbml            : true,
        version          : 'v10.0'
      });
    };

    (function(d, s, id) {
      var js, fjs = d.getElementsByTagName(s)[0];
      if (d.getElementById(id)) return;
      js = d.createElement(s); js.id = id;
      js.src = 'https://connect.facebook.net/el_GR/sdk/xfbml.customerchat.js';
      fjs.parentNode.insertBefore(js, fjs);
    }(document, 'script', 'facebook-jssdk'));
  </script>

Now it works on both Facebook widget and FB messenger chat.现在它适用于 Facebook 小部件和 FB Messenger 聊天。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM