Hello everybody,
I am rather new to this forum but I am studying the zen cart code (1.3.8a) for a while and I am preparing a developer's book for code explanation and some contributions soon.
In the light of the above I am trying to understand the code for the shipment modules and I also experience some strange (normal ?) behavior.
So lets dive:

1st: The listing of shipment modules is happening inside /admin/modules.php where around lines 177+ we see
PHP Code:
$module = new $class;
      if (
$module->check() > 0) {
        if (
$module->sort_order 0) {     
          if (
$installed_modules[$module->sort_order] != '') {
            
$zc_valid false
Now each module class defines check() in a similar way, for example in item.php
PHP Code:
        $check_query $db->Execute("select configuration_value from " TABLE_CONFIGURATION " where configuration_key = 'MODULE_SHIPPING_ITEM_STATUS'");
        
$this->_check $check_query->RecordCount(); 
which means that it checks if module is installed and NOT if module is enabled.
This also means that installed but disabled modules are taken into account in sort order calculation and can produce the dreadful message:
WARNING: YOU HAVE DUPLICATE SORT ORDERS WHICH WILL RESULT IN CALCULATION ERRORS
PLEASE CORRECT THESE ISSUES NOW!
Does this have a logic ?
Additionally even if modules are active but belong to different zones they should not create a problem with their sort order.

And anyway what the sort order has to do with calculations ?!?

2nd:
Again in modules.php around line 230 we see where the green/yellow buttons are produced:
PHP Code:
 echo ' ' . ((!empty($module->enabled) && is_numeric($module->sort_order)) ? zen_image(DIR_WS_IMAGES 'icon_status_green.gif') : ((empty($module->enabled) && is_numeric($module->sort_order)) ? zen_image(DIR_WS_IMAGES 'icon_status_yellow.gif') : zen_image(DIR_WS_IMAGES 'icon_status_red.gif'))); 
This means that it checks if each module is enabled.
Now again in all modules (e.g. item.php) the following lines dictate if a module is enabled or not:
PHP Code:
      if ( ($this->enabled == true) && ((int)MODULE_SHIPPING_ITEM_ZONE 0) ) {
        
$check_flag false;
        
$check $db->Execute("select zone_id from " TABLE_ZONES_TO_GEO_ZONES " where geo_zone_id = '" MODULE_SHIPPING_ITEM_ZONE "' and zone_country_id = '" $order->delivery['country']['id'] . "' order by zone_id");
        while (!
$check->EOF) {
          if (
$check->fields['zone_id'] < 1) {
            
$check_flag true;
            break;
          } elseif (
$check->fields['zone_id'] == $order->delivery['zone_id']) {
            
$check_flag true;
            break; 
BUT when you access the list from the admin interface the $order object is NOT instantiated (correct me if I am wrong...) which means that IF a zone is defined for a module this will NOT show as enabled, thus green.
That is exactly what I am experiencing:
When I add a zone to a module it turns yellow, when I remove it it turns Green?!?
Does this have a logic ?

I thank you all for your help in advance and hope you enjoy the book when it comes out....It will be free of course....

Thanks again
Ioannis