Forums / Templates, Stylesheets, Page Layout / language defines... inconsistent overrides for order_total modules

language defines... inconsistent overrides for order_total modules

Views: 815

Results 1 to 7 of 7
17 Jun 2012, 7:29 PM
#1
s_mack avatar

s_mack

Totally Zenned

Join Date:
Jun 2005
Location:
Kelowna, BC Canada
Posts:
1,033
Plugin Contributions:
4

language defines... inconsistent overrides for order_total modules

I've wondered this for years and now that I'm customizing (yet another) zen cart installation, I figured I'd ask...

It seems that some files you can place just the defines you want to change in the override file. For example

/inculdes/languages/english.php is overrided with /includes/languages/YOUR_TEMPLATE/english.php and you can pick and choose which defines you include in the new file. Any that you don't, will (logically) be taken from the main file.

BUT this isn't always the case. Other language files you have to include the whole text with all the define or they don't work.

Why is that? Is there any rhyme or reason to it that I'm missing?

  • Steven
17 Jun 2012, 7:31 PM
#2
stevesh avatar

stevesh

Black Belt

Join Date:
Feb 2005
Location:
Lansing, Michigan USA
Posts:
19,793
Plugin Contributions:
2

Re: language defines... inconsistent overrides for order_total modules

Could you give a specific example of one of the language files which 'have to include the whole text' ?

17 Jun 2012, 7:59 PM
#4
s_mack avatar

s_mack

Totally Zenned

Join Date:
Jun 2005
Location:
Kelowna, BC Canada
Posts:
1,033
Plugin Contributions:
4

Re: language defines... inconsistent overrides for order_total modules

stevesh:

Could you give a specific example of one of the language files which 'have to include the whole text' ?

Sure. One particular instance is /includes/languages/english/modules/order_total/ot_total.php

Perhaps its a modules thing? I'll look deeper and find out exactly what files.

17 Jun 2012, 8:43 PM
#5
s_mack avatar

s_mack

Totally Zenned

Join Date:
Jun 2005
Location:
Kelowna, BC Canada
Posts:
1,033
Plugin Contributions:
4

Re: language defines... inconsistent overrides for order_total modules

Nope. Found another one and its just a regular one...

/includes/languages/english/YOUR_TEMPLATE/button_names.php

17 Jun 2012, 10:07 PM
#6
kuroi avatar

kuroi

Totally Zenned

Join Date:
Apr 2006
Location:
London, UK
Posts:
10,475
Plugin Contributions:
11

Re: language defines... inconsistent overrides for order_total modules

The default is that you need a complete list of language defines in the override file, as when there's an override, only that will be loaded.

There is an exception for the primary language file, e.g. english.php. This wasn't always there, but was quietly introduced in version 1.3.2 or thereabouts. For this file only the override file would be loaded, followed by the main file. The rationale behind this was that the primary language files were so large that duplicating them seemed excessive and often caused problems in the next upgrade, as new definitions added to the default file tended to get missed from the override file during upgrades.

However, there is drawback to this approach. First the overrides are loaded and then the default values, which fills in the gaps. However, it also causes PHP to issue warning notices for those definitions that appear in both files and nowadays these are treated with much more respect, so I doubt you'll see this approach extended further.

Kuroi Web Design and Development | Twitter

(Questions answered in the forum only - so that any forum member can benefit - not by personal message)

17 Jun 2012, 11:31 PM
#7
s_mack avatar

s_mack

Totally Zenned

Join Date:
Jun 2005
Location:
Kelowna, BC Canada
Posts:
1,033
Plugin Contributions:
4

Re: language defines... inconsistent overrides for order_total modules

Interesting... so to be clear, what is the best practice then? To duplicate the entire file in each case and make edits in the duplicated file?