Add a Facebook Page Fan Box to your Zen Cart store


A Facebook Page Fan Box can be a great way to integrate your Facebook Page and Zen Cart store.  Here are the step-by-step instructions to create a new sidebox and add the Facebook Page Fan Box code.

The Facebook Part

  1. Login to your Facebook page.
  2. Click the link to Edit Page, found under your picture/logo.
    image
  3. On the right hand side of the Edit screen, click on the Promote with a Like Box link. Facebook - Promote with a Like Box
  4. Enter your Facebook Page ID.  The Like Box (or Fan Box) can be customised to suit the width of your Zen Cart column.  You can also choose whether or not to show the Stream (your feed) and the Header as part of your Fan Box.
    Customise Facebook Like Box
  5. When you have your preferred settings, click the Get Code button.  On the next screen you will see that there are two code boxes.  In this example we are going to use the code from the second XFBML box.  Highlight the contents of this box and select Ctrl-C to copy (or right-click and select Copy).
    Facebook Fan Box Code
  6. Paste this code into a txt file and save to use later.

The Zen Cart Part

  1. We will be using the Blank Sidebox Add-on for Zen Cart as a basis for our Facebook Fan Box.  Download my Facebook Fan Box Sidebox and unzip the file ready to edit.
  2. Open the fanbox_sidebox_defines.php file (in includes\languages\english\extra_definitions) in your favourite Text Editor and locate this line of code:
    define('TEXT_FANBOX_SIDEBOX', 'Add Facebook XFBML Code here');
  3. and replace the section between the single quotes with your code saved from Facebook.  It will look something like this:
    define('TEXT_FANBOX_SIDEBOX', '<fb:like-box profile_id="196744630780" width="140" connections="4" stream="false" header="false"></fb:like-box>');
  4. Save the fanbox_sidebox_defines.php file.
  5. Using your favourite FTP program, upload the Facebook Fan Box Sidebox add-on files to your Zen Cart store.
  6. Log in to your store’s Zen Cart Admin.
  7. From the Tools menu, select Layout Boxes Controller.  You will notice at the top of the screen an informational message.
    New Sidebox
  8. Click Edit next to the Facebook Fan Box Sidebox.
    Facebook Fan Box Sidebox in Zen Cart
    Select ON for Left/Right Column Status and the add your preferred location (left or right) and sort order.  Click on the Update button to save your settings.
    Edit Box - Zen Cart
  9. You will notice that the sidebox now appears, however it is currently blank.  We have one more step to go.  The Facebook XFBML requires additional code in the footer of your page.
    image
  10. Open up the tpl_main_page.php file from includes/templates/template_default/common.  Scroll to the end of the file – the last line will be:
    </body>
  11. Just before this last line, add the following code:
    <div id="fb-root"></div>
    <script>
     window.fbAsyncInit = function() {
     FB.init({appId: 'your app id', status: true, cookie: true,
     xfbml: true});
     };
     (function() {
     var e = 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>
  12. Save the modified tpl_main_page.php file to your override folder.  This will be /includes/templates/CUSTOM/ where CUSTOM represents the name of your current template folder.
  13. Now, take a look at your new Facebook Fan Box Sidebox.
    Facebook Fan Box Sidebox in Zen Cart

And, of course, come and visit me on Facebook especially if you ‘Like’ this tutorial :)

Update

If you are having problems with your Facebook Like Box not appearing in Internet Explorer, try the following edit in the Zen Cart HTML header file.

  1. Open the html_header.php file (in includes/templates/template_default/common) in your favourite Text Editor and locate this line of code (on line 43 for me):
    <html xmlns="http://www.w3.org/1999/xhtml" <?php echo HTML_PARAMS; ?>>
  2. and update it to the following:
    <html xmlns="http://www.w3.org/1999/xhtml" <?php echo HTML_PARAMS; ?> xmlns:og="http://opengraphprotocol.org/schema/"
     xmlns:fb="http://www.facebook.com/2008/fbml">
  3. Save the html_header.php file (following the override system if you wish this change to be template-specific).
     
   
     

, , , ,

More Zen Cart:

  1. How do I set my Facebook Like Box so that it is visible to everyone?
  2. How does the Facebook Like button work with my Zen Cart store?
  3. Facebook Like Button can improve shopper experience for Zen Cart stores
  4. Add the Facebook Like Button to your Zen Cart store
  5. Update Page Title of Page 2, Page 3 or Page 4 in More Information sidebox
  1. #1 by Jesus on 10 September, 2011 - 5:52 am

    Is it possible to change what is on top of the horizontal line to appear on the bottom, and what appears on the bottom appear on the top first? if so, could you please tell me how to make these edits?

  2. #2 by Carol on 20 September, 2011 - 9:29 pm

    Hi to everyone, firstly thanks for this tutorial, I am following the steps but I have the following problem:

    Using your favourite FTP program, upload the Facebook Fan Box Sidebox add-on files to your Zen Cart store.
    Log in to your store’s Zen Cart Admin.
    From the Tools menu, select Layout Boxes Controller. You will notice at the top of the screen an informational message.

    I upload includes folder inside blank_sidebox_2.0

    but in layout boxes controller, it doesn´t appear any message saying about a new box, why? I uploaded with filezilla, and have done first steps correctly. Help please

  3. #3 by Andy Foster on 16 November, 2011 - 11:08 pm

    Facebook seem to have changed the Get Code boxes so that this guide doesn’t make sense any more! Facebook provides several different boxes of code aimed at HTML websites rather than php ones like zen cart. Any chance of an update to the guide? That would be ace…

(will not be published)

Notify me of followup comments via e-mail. You can also subscribe without commenting.