Results 1 to 8 of 8
  1. #1
    Join Date
    Jun 2009
    Posts
    617
    Plugin Contributions
    0

    Default Where in the product page do I put this bit of code?

    I am trying to implement the Facebook 'Like' Button on my product info pages and believe I have everything in place except for one MINOR thing.... a bit confused on how to load the JavaScript SDK in my site?

    I have been looking here on Facebook and it seems that the easiest way to do it is to put this bit of code:
    PHP Code:
    <div id="fb-root"></div>
    <
    script>
      
    window.fbAsyncInit = function() {
        
    FB.init({appId'your app id'statustruecookietrue,
                 
    xfbmltrue});
      };
      (function() {
        var 
    document.createElement('script'); e.async true;
        
    e.src document.location.protocol +
          
    '//connect.facebook.net/en_US/all.js';
        
    document.getElementById('fb-root').appendChild(e);
      }());
    </script> 
    in my page.

    Where in the product page do I put this bit of code to load the SDK?
    Thank you,
    autoace

  2. #2
    Join Date
    Jan 2004
    Posts
    66,373
    Blog Entries
    7
    Plugin Contributions
    274

    Default Re: Loading Facebook SDK

    Quote Originally Posted by autoace View Post
    Where in the product page do I put this
    Your product page is handled by tpl_product_info_display.php
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  3. #3
    Join Date
    Jun 2009
    Posts
    617
    Plugin Contributions
    0

    Default Re: Where in the product page do I put this bit of code?

    *Where* in the tpl_product_info_display.php page?

    -Or-

    It doesn't matter??
    Thank you,
    autoace

  4. #4
    Join Date
    Jan 2004
    Posts
    66,373
    Blog Entries
    7
    Plugin Contributions
    274

    Default Re: Where in the product page do I put this bit of code?

    Answer: Wherever you want it to appear.

    There are many blocks of HTML in the file, which you'll see shown exactly in your browser if you click View Source to see it.
    Put your code between any of those sections. If it produces some visual output, then it'll show up on-screen wherever you've placed it. Move it around to where you really want it.

    The sections are marked as <!-- bof: section --> and <!-- eof: section --> Best not to stick anything new "between" the bof/eof ("begin of fragment" / "end of fragment"), but rather best to put anyplace *after* a eof.
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  5. #5
    Join Date
    Jun 2009
    Posts
    617
    Plugin Contributions
    0

    Default Re: Where in the product page do I put this bit of code?

    Thank you
    Thank you,
    autoace

  6. #6
    Join Date
    Jun 2009
    Posts
    617
    Plugin Contributions
    0

    Default Re: Where in the product page do I put this bit of code?

    Can I place the js code between the head tags in the html_header.php file? (/common)?
    Thank you,
    autoace

  7. #7
    Join Date
    Jan 2004
    Posts
    66,373
    Blog Entries
    7
    Plugin Contributions
    274

    Default Re: Where in the product page do I put this bit of code?

    What exactly are you still having troubles with?

    1. You should never be putting code into html_header.php
    2. If your code *must* go inside the <head> tags, then you should use the auto-loading method documented in your /docs/ folder and here: http://www.zen-cart.com/wiki/index.p...s_-_Javascript
    3. If your code actually produces output, such as the "like" button you wanted it to generate, then putting it in the <head> tags would be a bad idea, since that gives you no control over where the output is presented in the page, and may prevent it from actually being displayed at all.
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  8. #8
    Join Date
    Jun 2009
    Posts
    617
    Plugin Contributions
    0

    Default Re: Where in the product page do I put this bit of code?

    Thank you for the reply, very good information.
    Thank you,
    autoace

 

 

Similar Threads

  1. Replies: 5
    Last Post: 20 May 2014, 07:51 AM
  2. v150 Why is this little bit of code showing on my page?
    By WebKat in forum General Questions
    Replies: 6
    Last Post: 1 Apr 2012, 07:19 PM
  3. Where do I put this script code?
    By Kalindscharms in forum General Questions
    Replies: 8
    Last Post: 6 Jul 2010, 10:23 PM
  4. where to put this code?
    By spiked11 in forum Templates, Stylesheets, Page Layout
    Replies: 4
    Last Post: 21 Jul 2007, 05:41 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR