ZC1.5.4 backward Compatibility: Plugins with admin-level core-file overwrites
The Zen Cart v1.5.4 admin-level scripts (e.g. the popular ones like customers.php and orders.php) are now sprinkled with calls (for PCI compliance) to a new function named zen_record_admin_activity.
I've created a compatibility script so that anyone who supports a plugin that modifies admin-level core files can merge their plugin's changes with the Zen Cart v1.5.4 version of the file and have that version continue to operate on Zen Cart versions v1.5.0 through v1.5.3.
I'd like to request that anyone using these scripts keep the name that I've assigned to them. That way, if a store owner installs multiple plugins that use the compatibility script, there's only one version of the script actually installed in their store.
The script is simple in nature; it's auto-loaded just after the admin-level class file that defines the function in Zen Cart v1.5.4. When the script loads, it defines a dummy function with the same name/interface if that function is not already defined (i.e. you're not running Zen Cart v1.5.4). That way, the v1.5.4 changes you merge into your plugin's scripts will operate on earlier versions.
Two files are needed:
1 - /YOUR_ADMIN/includes/auto_loaders/config.zc154_compatibility.php
Code:
<?php
// -----
// Load the Zen Cart v1.5.4 compatibility module.
// Copyright (c) 2014 Vinos de Frutas Tropicales
//
$autoLoadConfig[65][] = array ('autoType' => 'init_script',
'loadFile' => 'init_zc154_compatibility.php');
2- /YOUR_ADMIN/incudes/init_includes/init_zc154_compatibility.php
Code:
<?php
// -----
// Common Module (used by many of my plugins) to provide downward compatibility to Zen Cart v1.5.4 admin-level changes.
// Copyright (c) 2014 Vinos de Frutas Tropicales
//
if (!defined('IS_ADMIN_FLAG')) {
die('Illegal Access');
}
// -----
// This plugin uses a Zen Cart v1.5.4 "core-file base". One or more files overwritten for this plugin make
// use of a function (zen_record_admin_activity) that was introduced in Zen Cart v1.5.4. That function (present in
// /admin/includes/classes/class.admin.zcObserverLogEventListener.php) loads at checkpoint 65.
//
// This init-file, also loaded at CP-65, provides the definition for the zen_record_admin_activity function IF IT IS
// NOT PREVIOUSLY DEFINED. That way, the various functions in the overwritten corre files will have their function-interface
// satisfied.
//
if (!function_exists ('zen_record_admin_activity')) {
function zen_record_admin_activity ($message, $severity) {
}
}
Re: ZC1.5.4 backward Compatibility: Plugins with admin-level core-file overwrites
I have NEVER been a fan of creating multiple "versions" of a module simply to support older versions of Zen Cart.. It's TOO much work required of me for a FREE thing, and IMHO, you should simply use the version of the module that's compatible with the version of the base software you are using.. If you want the NEW version with the NEW changes, you need to UPGRADE your store..
Anyway I digress.. Am I understanding correctly that with this little gem I DON'T have to do that.. Cause frankly the compatibility thing with regards to some of the newer versions of the v1.5.x Zen Cart releases is kinda why I've been dragging my feet on submitting the latest COWOA (which includes a BUNCH of cool new usability changes), Super Orders, and to a lesser degree IH4.. I REALLY didn't want to deal with all the potential "is this compatible with Zen Cart v1.5.0 and v1.5.1" questions..
Re: ZC1.5.4 backward Compatibility: Plugins with admin-level core-file overwrites
Quote:
Originally Posted by
DivaVocals
... Anyway I digress.. Am I understanding correctly that with this little gem I DON'T have to do that.. Cause frankly the compatibility thing with regards to some of the newer versions of the v1.5.x Zen Cart releases is kinda why I've been dragging my feet on submitting the latest COWOA (which includes a BUNCH of cool new usability changes), Super Orders, and to a lesser degree IH4.. I REALLY didn't want to deal with all the potential "is this compatible with Zen Cart v1.5.0 and v1.5.1" questions..
You are understanding correctly. This compatibility script essentially provides a stub function for the ZC1.5.4 (and later) versions of the admin-level scripts. The override won't occur on ZC1.5.4+, since the function already exists.
This allows you (and other plugin authors) to create a single version of their offerings that runs in pre- and post-1.5.4 environments, while integrating the most recent versions of the Zen Cart "base" admin-level scripts.
Re: ZC1.5.4 backward Compatibility: Plugins with admin-level core-file overwrites
Quote:
Originally Posted by
lat9
You are understanding correctly. This compatibility script essentially provides a stub function for the ZC1.5.4 (and later) versions of the admin-level scripts. The override won't occur on ZC1.5.4+, since the function already exists.
This allows you (and other plugin authors) to create a single version of their offerings that runs in pre- and post-1.5.4 environments, while integrating the most recent versions of the Zen Cart "base" admin-level scripts.
NICE!!! How awesome are you???
Pretty d@mn awesome I think!!!!
Re: ZC1.5.4 backward Compatibility: Plugins with admin-level core-file overwrites
@lat9, thanks for doing this. May I trouble you to package this up and submit it to the plugins area so people can find it there too?
Re: ZC1.5.4 backward Compatibility: Plugins with admin-level core-file overwrites
No problem, swguy! I'll get right on it.
Re: ZC1.5.4 backward Compatibility: Plugins with admin-level core-file overwrites
I've just finished uploading the script to the plugins; once approved, it will be available here: http://www.zen-cart.com/downloads.php?do=file&id=1945
Re: ZC1.5.4 backward Compatibility: Plugins with admin-level core-file overwrites
Quote:
Originally Posted by
lat9
YEAH :thumbsup:
Re: ZC1.5.4 backward Compatibility: Plugins with admin-level core-file overwrites
Quote:
Originally Posted by
lat9
Now available for download ...
Re: ZC1.5.4 backward Compatibility: Plugins with admin-level core-file overwrites
Am I to understand this correctly? I've been using "stock by attribute_1.5.3 with v1.5.0 of ZC. I have found that it still works properly...until v1.5.4.
If I install this module of yours, it will then make SBA1.5.3 compatible with ZC1.5.4?