X-Cart:Integration with third party modules

From X-Cart 4 Classic
Revision as of 14:59, 20 May 2011 by Vladimir Gurinenko (talk | contribs) (Created page with 'In version 4.4.3, the module initialization routine has been changed and optimized. Unlike in versions 4.4.0-4.4.2, initialization order now does matter. For the standard module…')
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

In version 4.4.3, the module initialization routine has been changed and optimized. Unlike in versions 4.4.0-4.4.2, initialization order now does matter.

For the standard modules, dependencies of the modules on one another are described in the function include/data_cache.php:func_sort_active_modules

If your 3rd-party module depends on other modules, and no other modules depend on it, you can place the initialization of that module to the very end of the module initialization queue.

Here is how you do that.

Index: include/data_cache.php

--- include/data_cache.php 2011-05-16 14:11:41.000000000 +0400
+++ include/data_cache.php 2011-05-16 14:11:37.000000000 +0400
@@ -144,6 +144,7 @@
         'Image_Verification' => 33,# Image_Verification depends on Survey/News_Management
         'Manufacturers' => 23,
         'XAffiliate' => 24, #XAffiliate depends on Manufacturers
+ '3dPartyModule1' => 2000,
     );
     $key_a = isset($sort_order[$a]) ? -$sort_order[$a] : -1000;
     $key_b = isset($sort_order[$b]) ? -$sort_order[$b] : -1001;

This patch means that 3dPartyModule1 will be initialized last for this array of modules.

If the order number of a certain module is not defined, it is assumed to be 1000. The initialization order for modules with identical module numbers is undefined.