Code

Facebook OpenGraph Module for OpenCart

Facebook OpenGraph Module for OpenCart

Quickly & Easily Add Facebook OpenGraph tags to your Store!

The Facebook OpenGraph Module for OpenCart provides a very quick and simple way to automatically add Facebook OpenGraph tags to your OpenCart website for any of your Product, Category, or Information pages. At this time the Module does not support adding OpenGraph tags to the homepage. Homepage support is planned for future release when a custom module can be built allowing for the homepage tags to be specified by the user rather than attempting to automatically pull these tags from the various elements that may, or may not, be used on any particular installation.

Utilizing vQmod for OpenCart versions 1.5+ and early 2.0+, this module contains only a single file to be uploaded, and does not modify a single core file of the OpenCart system. Instead, using the vQmod system, it dynamically injects the necessary code into cached version of the core files allowing for complete native functionality, while still maintaining the ability to update the OpenCart system without worry of overwriting any changes made by this plugin.

For OpenCart 2.0+ installations, this module also contains a single file for upload through the OpenCart OCMOD feature located within the “Modifications” section of the “Extensions” administration area. This single file can be uploaded directly from the OpenCart administration area and does not require FTP.

How it Works

There are several different elements from OpenCart that could all be used as information bits for the OpenGraph tags, so this is how this module forms the information it uses for the OpenGraph tags:

  • Product Pages retrieve the name of the product and then appends the store name from the system settings area (i.e. “Product Name | Store Name”) to create the OG:Title. The OG:Image is retrieved from the main, or first, image listed for the product. The OG:Description is created by taking the description of the product, stripping out the HTML tags, and trimming any leftover white space.
  • Category Pages retrieve the name of the category and then appends the store name from the system settings area (i.e. “Category Name | Store Name”) to create the OG:Title. The OG:Image is retrieved from the image specified for the category. The OG:Description is created by taking the description of the category, stripping out the HTML tags, and trimming any leftover white space.
  • Information Pages retrieve the name of the information page and then appends the store name from the system settings area (i.e. “Information Page | Store Name”) to create the OG:Title. The OG:Image is left blank, leaving it up to the Facebook crawler to determine if there are any images on the page. The OG:Description is created by taking the body of the information page, stripping out the HTML tags, and trimming any leftover white space.

Compatible from OpenCart 1.5+ up to OpenCart 2.0+

For users who are still on OpenCart 1.5 through early versions of OpenCart 2.0, you can use vQmod to install this module. Doing so allows for installation by a single file, and no modifications are made to the OpenCart installation so that there is never any changes made to core files.

For users who are on newer versions of OpenCart 2.0 and up, you can use OCMOD via the built-in “Modifications” section of the OpenCart administration. This module is installed by a single file and can be uploaded directly from the OpenCart admin without having to manually copy any files to the server. Again, there are no modifications made to the core OpenCart files using the OCMOD system.

This module includes three versions! The first provides support for all sites running OpenCart 1.5+ with vQmod. The second version provides support for all sites running OpenCart 2.0+ with vQmod. The third version provides support for all sites running OpenCart 2.0+ with OCMOD. Simply install the version specific to your current version of OpenCart and within minutes the module is up and running.

· Fully tested and functional with OpenCart 1.5.6 and vQmod 2.4.1

· Fully tested and functional with OpenCart 2.0.3.1 and vQmod 2.5.1

· Fully tested and functional with OpenCart 2.3.0.2 and OCMOD

Requirements

For older versions of OpenCart 1.5+ and early versions of OpenCart 2.0, please make sure you have vQmod installed on your installation of OpenCart prior to attempting to use this module. vQmod is a free download.

If you are running newer versions of OpenCart with the “Modifications” feature under “Extensions”, then you are able to utilize the OCMOD version of this plugin, and nothing additional is required.

Change History

Version 2.5.0 (pending)
  • Tested & Functional with OpenCart 2.3.0.2 and OCMOD
Version 2.0.0
  • Tested & Functional with OpenCart 2.0.3.1 and vQmod 2.5.1
  • Dropped support for OpenCart Blog Manager module
Version 1.5.0
  • Minor Fixes to URL and Image Methods
  • Added support for OpenCart Blog Manager module
Version 1.0.0
  • Initial software release
by
by
by
by
by
by