Forums / Contribution-Writing Guidelines / ZC1.5.4 backward Compatibility: Plugins with admin-level core-file overwrites

ZC1.5.4 backward Compatibility: Plugins with admin-level core-file overwrites

Views: 10,805

Results 1 to 13 of 13
20 Dec 2014, 5:26 PM
#1
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,111
Plugin Contributions:
56

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

<?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

<?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) {
  }
}
16 Jan 2015, 6:22 PM
#2
divavocals avatar

divavocals

Totally Zenned

Join Date:
Jan 2007
Location:
Los Angeles, California, United States
Posts:
10,011
Plugin Contributions:
3

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..

My Site - Zen Cart & WordPress integration specialist
I don't answer support questions via PM. Post add-on support questions in the support thread. The question & the answer will benefit others with similar issues.

16 Jan 2015, 6:42 PM
#3
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,111
Plugin Contributions:
56

Re: ZC1.5.4 backward Compatibility: Plugins with admin-level core-file overwrites

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.

16 Jan 2015, 6:44 PM
#4
divavocals avatar

divavocals

Totally Zenned

Join Date:
Jan 2007
Location:
Los Angeles, California, United States
Posts:
10,011
Plugin Contributions:
3

Re: ZC1.5.4 backward Compatibility: Plugins with admin-level core-file overwrites

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!!!!

My Site - Zen Cart & WordPress integration specialist
I don't answer support questions via PM. Post add-on support questions in the support thread. The question & the answer will benefit others with similar issues.

18 Jan 2015, 12:46 AM
#5
swguy avatar

swguy

Administrator

Join Date:
Feb 2006
Location:
Tampa Bay, Florida
Posts:
10,720
Plugin Contributions:
56

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?

That Software Guy. My Store: Zen Cart Support
Available for hire - See my ad in Services
Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
Do you benefit from Zen Cart? Then please support the project.

18 Jan 2015, 12:53 PM
#6
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,111
Plugin Contributions:
56

Re: ZC1.5.4 backward Compatibility: Plugins with admin-level core-file overwrites

No problem, swguy! I'll get right on it.

18 Jan 2015, 1:34 PM
#7
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,111
Plugin Contributions:
56

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

18 Jan 2015, 3:17 PM
#8
design75 avatar

design75

Totally Zenned

Join Date:
Dec 2009
Location:
Amersfoort, The Netherlands
Posts:
2,862
Plugin Contributions:
5

Re: ZC1.5.4 backward Compatibility: Plugins with admin-level core-file overwrites

lat9:

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

YEAH :thumbsup:

19 Jan 2015, 1:32 PM
#9
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,111
Plugin Contributions:
56

Re: ZC1.5.4 backward Compatibility: Plugins with admin-level core-file overwrites

lat9:

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
Now available for download ...

27 Jan 2015, 1:07 PM
#10
rick29690 avatar

rick29690

New Zenner

Join Date:
May 2009
Location:
Travelers Rest, SC
Posts:
22
Plugin Contributions:
0

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?

27 Jan 2015, 1:44 PM
#11
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: ZC1.5.4 backward Compatibility: Plugins with admin-level core-file overwrites

Rick29690:

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?

This question is more applicable to the forum for stock by attributes. That said, the plugin doesn't magically make every plugin 1.5.4 compatible. Specifically regarding SBA, it invokes jquery that likely conflicts with what is provided in zc 1.5.4. Additionally there is a SBA 1.5.4 that was created for ZC 1.5.3 as SBA 1.5.3 was not. All that said, there is an effort being taken to make SBA compatible with ZC 1.5.4 which will use this plugin to support backwards compatiblility...

If I may also plug something else, if not mistaken lat9 offers a similar product to SBA that is likely already ZC 1.5.4 compatible...

ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...

27 Jan 2015, 1:57 PM
#12
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,111
Plugin Contributions:
56

Re: ZC1.5.4 backward Compatibility: Plugins with admin-level core-file overwrites

mc12345678:

This question is more applicable to the forum for stock by attributes. That said, the plugin doesn't magically make every plugin 1.5.4 compatible. Specifically regarding SBA, it invokes jquery that likely conflicts with what is provided in zc 1.5.4. Additionally there is a SBA 1.5.4 that was created for ZC 1.5.3 as SBA 1.5.3 was not. All that said, there is an effort being taken to make SBA compatible with ZC 1.5.4 which will use this plugin to support backwards compatiblility...

If I may also plug something else, if not mistaken lat9 offers a similar product to SBA that is likely already ZC 1.5.4 compatible...
What mc12345678 said is true; the compatibility script doesn't work any magic in and of itself -- it's intended to be used by plugin authors whose plugin modifies admin-level core files and would like to have a single distribution that works properly in Zen Cart v1.5.4 and earlier versions.

27 Jan 2015, 4:58 PM
#13
divavocals avatar

divavocals

Totally Zenned

Join Date:
Jan 2007
Location:
Los Angeles, California, United States
Posts:
10,011
Plugin Contributions:
3

Re: ZC1.5.4 backward Compatibility: Plugins with admin-level core-file overwrites

mc12345678:

If I may also plug something else, if not mistaken lat9 offers a similar product to SBA that is likely already ZC 1.5.4 compatible...
She does, and it is... :laugh:

and in using said module (Product Options Stock Management), I discovered another SBA shortcoming.. but I will report this on the SBA support thread

My Site - Zen Cart & WordPress integration specialist
I don't answer support questions via PM. Post add-on support questions in the support thread. The question & the answer will benefit others with similar issues.