Skip to content

Instantly share code, notes, and snippets.

@lat9
Last active May 23, 2025 13:24
Show Gist options
  • Save lat9/9deb64d3325081d18bb0db5534bcf142 to your computer and use it in GitHub Desktop.
Save lat9/9deb64d3325081d18bb0db5534bcf142 to your computer and use it in GitHub Desktop.
zc210 Changes Supporting `encapsulated` plugins

If your site runs on Zen Cart 2.0.0 or 2.0.1, there are some core-file changes required for the encapsulated versions of various plugins to operate correctly on your storefront.

You can most likely simply replace (or add) a file to your site to enable an updated plugin's use. Be sure to have a backup copy of the original file, just in case the updated file causes issues on your site!

Depending on your updated plugin's directions, following is an overall list of the various Zen Cart base files that were changed in the zc201 to zc210 transition to enable additional features in encapsulated plugins.

General Changes

/ajax.php

This file, updated in releases following Zen Cart 2.0.0 via PR 6462 enables an encapsulated plugin to provide additional AJAX handlers.

/includes/classes/initSystem.php

This file, updated in the release following Zen Cart 2.0.1 via PR 6480 corrects the storefront auto-load of an encapsulated plugin's class files.

/includes/classes/ResourceLoaders/CatalogArraysLanguageLoader.php

This file, updated in the release following Zen Cart 2.0.1 via PR 6493 enables storefront overrides of an encapsulated plugin's extra_definitions language files.

/includes/classes/PluginSupport/ScriptedInstaller.php

This file, updated in the release following Zen Cart 2.0.1 via correctly supplies an encapsulated plugin its currently-installed version on any upgrade (PR 6498) and adds support for the helper-class (PR 6456).

/includes/classes/PluginSupport/ScriptedInstallHelpers.php

This file, added in the release following Zen Cart 2.0.1 via PR 6456 adds some "helper" functions for a plugin's installation.

/includes/classes/PluginSupport/ScriptedInstallerFactory.php

This file, added in the release following Zen Cart 2.0.1 via PR 6456 adds some "helper" functions for a plugin's installation.

Plugins Including order-total/shipping/payment Modules

PR 6682 and PR 6735 added support, enabling encapsulated plugins to contain order-total, shipping and payment modules. The following files were changed or added to accomplish this:

  • /admin/modules.php
  • /includes/classes/order_total.php
  • /includes/classes/shipping.php
  • /includes/classes/payment.php
  • /includes/classes/ResourceLoaders/ArraysLanguageLoader.php
  • /includes/classes/ResourceLoaders/LanguageLoader.php
  • /includes/classes/ResourceLoaders/ModuleFinder.php (added)

Enable Encapsulated Plugins' Observers to Query Details

PR 6773 added support this support, enabling an observer to query details about the plugin version/directory in which it is located. Helps with:

  • knowing what version is in effect
  • knowing what context we're in (admin/catalog/Installer)
  • loading a catalog stylesheet via a plugin, first from plugin directory, and then from active template directory (as an override), without having to publish files to the core catalog directory.

The following files were changed/added to accomplish this:

  • /includes/classes/ResourceLoaders/PageLoader.php
  • /includes/classes/traits/InteractsWithPlugins.php (added)

Plugins Including Payment Modules with Admin Notifications

PR 7004 adds support for encapsulated payment-modules to provide their admin notifications to the admin's Customers :: Orders tool's detailed display. This PR was accepted post-zc210 release and contains changes in /admin/orders.php.

Plugins Including Storefront Page-Specific Files

PR 7099 adds support for encapsulated plugins that include storefront page-specific files, e.g. includes/modules/pages/checkout_shipping/header_php_myplugin.php. This PR was accepted post-zc210 release and contains changes in the following files:

  • /index.php
  • /includes/classes/FileSystem.php
  • /includes/classes/ResourceLoaders/PageLoader.php
  • /includes/templates/template_default/common/html_header_js_loader.php
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment