Facebook plugins conflict, what is behind the problem?

In this article I will describe shortly the problem with usage of various facebook modules in PrestaShop. Case is very specific, related to many facebook libraries that facebook has and allows to use with their widgets / apps.

As you probably know - modules that integrates your shop with Facebook include some javascripts from Facebook usually. Without these javascripts modules will not have possibility to initiate integration so in effect modules will not work. 


Let me explain the way of how facebook apps works.
Facebook offers several javascript libraries dedicated to facebook widgets / api.  These libraries are:

  1. sdk.js - dedicated for simple widgets like likebox, pagechat etc
  2. all.js - for all widgets that sdk.js offers and also for api queries (for exmaple to get facebook user email, first and last name etc.)
  3. customerchat.js - for all widgets from sdk.js, for all api queries from all.js + for messenger support


How facebook libraries works?
If your shop uses several Facebook modules and if these modules include various Facebook's .js libraries - there is a hight risk that you will have some conflicts between these plugins. Simply saying - Facebook plugins can't work with various .js libraries. Within your website you can use only one Facebook's js library. If you will include several libraries - website will use the most basic file.

 

Facebook libraries and features that these libraries supports

facebook library Widgets
(simple widgets like likebox, pagechat)
Messenger chat
(chat bubble)
Facebook api
(facebook login etc.)
all.js
all.js + appID
sdk.js
sdk.js + appID
customerchat.js
customerchat.js + appID

 

The most advanced library that facebook offers, where all modules work is a customerchat.js library with defined appID number. It suppoers simple widgets, facebook's api integration and messenger chat bubble. If you want to use various facebook's modules - make sure that these modules give you possibility to decide what library module will load and if these modules have possibility to not include the library at all.

 

For example,

  • You want to use "facebook login" module with "messenger chat" addon. From what you can read inside table i pasted - you will need to use customerchat.js + appID.
  • You want to use "facebook likebox" module you will need all.js library
  • You want to use "facebook likebox" module with "facebook login" - you will need all.js + appID
  • etc.

 

All Facebook Modules from mypresta.eu offer gives possibility to decide about what library will be loaded and define appID. Only then you will avoid conflicts between Facebook modules.

author milos myszczuk
Article by Milosz Myszczuk PrestaShop expert, official PrestaShop community moderator. PHP developer, specialist in relative and spatial databases management, GIS Analyst, CEO & founder of VEKIA interactive agency. Read more about VEKIA company
If you like my articles and want much more valuable tips, feel free to send me donation
1.4 version 1.4.11 1.6 404 addon admin advertise ahref ajax alpha animation api app application authentication back office backup badge banner basics block bootstrap button cache carrier cart catalog category certificate changelog chat class clear client clip cms code colors columns comments configuration contact container content controller cookie counter country coupon css csv currency customer dashboard database debug default delete delivery desktop developer device disable discount displayNav displayTop download dynamic editor effect empty encrypt engine error exchange exclude export facebook faceshop fade fancoupon fancybox fanpage fatal feature feed field file fix fixed font footer free friendly url front ftp full gallery generate gift global godaddy google google+ gray grid groupon header help hide highlight homefeatured homepage hook hosting hover howto htaccess html html5 ID image import include input instagram installation integration iPhone issue javascript jquery kgb knowhow languages law left likebox link list livingsocial loading log login logo loyality mail mailing maintenance manufacturer marketing marquee mcrypt menu meta mobile modification module movie moving multilanguage multiupload must have mysql news newsletter notification number open graph order override page password performance PHP phpmyadmin picture pinterest plugin popup post prestashop prestashop 1.0 prestashop 1.1 prestashop 1.2 prestashop 1.3 prestashop 1.4 prestashop 1.5 price rules problem product profile promotion proslider purifier quantity query quick tip random rates register reinsurance release reporting reset responsive restore results ribbon rich text right sales search security seo service shadow share shipping shop shopmania slider smarty social networks SQL SSL statistics stock store style subcategory superuser support switcher tab tablet tag tax template text theme tinyMCE tips and tricks tpl tracking translations tree trends trigger tumblr tutorial twitter update upgrade upload variables video visits voucher vulnerability web2print wide widget width window wishlist wysiwyg youtube zip zopim