Zen Cart Logo
Forums / Code Collaboration / v153 $languages is it no more?

v153 $languages is it no more?

Views: 3,080

Results 1 to 8 of 8
22 Jul 2014, 16:01
#1
mc12345678 avatar

mc12345678

Totally Zenned

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

v153 $languages is it no more?

I have installed a fresh version of ZC 1.5.3. using the default products. (Did not require a database upgrade as I am trying to verify functionality of some code previously written.)

Alongside, I have added files that do not require any type of a merge with existing code, but do interface with the database requiring the addition of menu options in the admin panel.

I had previously used this code on ZC 1.5.0 and 1.5.1. Long and short of it is this, the code includes application_top to bring in and initialize ZC default information and then continues through operation written into the page being displayed (combinations of php and html code) until the bottom where application_bottom is included.

As part of this code, I include another file that has functions that reference the global variable $languages; however, it appears that $languages is not defined (at this point) when I am using ZC 1.5.3. I haven't gone back to test the same code against the previous versions; however, and as many posters will state, I know that it used to work with either of those versions. I was able to overcome the issue by placing:

$languages = zen_get_languages(); 

before the include of the other file; however, I am trying to find from anyone else in the know if there in fact has been a change in the initialization of the code so that I may in the future need to consider the existence of the variable $languages or is it just that I have misremembered something?

I did try to do a search for cases where $languages was assigned and found a few, but many more instances of it being used in some regards... At the time, the number of occurrences was a bit over whelming, but I was glad to stumble across the zen function to assign it. I know there is a new plugin that will allow the admin panel to have a different language than the default store language, etc... and I know there have been some other gross changes, but thought I would share my "trouble" with someone else, and maybe further some programmer's knowledge.

22 Jul 2014, 17:37
#2
dbltoe avatar

dbltoe

Totally Zenned

Join Date:
Jan 2004
Location:
N of San Antonio TX
Posts:
9,760
Plugin Contributions:
9

Re: v153 $languages is it no more?

That exact phrase shows up 81 times in the 1.5.3 clean install.
Perhaps something happening in youradmin/includes/functions/general.php around line 632 where the function takes place.

22 Jul 2014, 17:47
#3
mc12345678 avatar

mc12345678

Totally Zenned

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

Re: v153 $languages is it no more?

dbltoe:

That exact phrase shows up 81 times in the 1.5.3 clean install.
Perhaps something happening in youradmin/includes/functions/general.php around line 632 where the function takes place.

So I agree that $languages is included in the default/fresh install, but it doesn't appear to be a variable that is instantiated when application_top is loaded. When I had tested with:

print(sizeof($languages));

Or

print_r($languges[0]);

Both indicted that there was nothing present.

But after calling zen_get_languages() both functions worked.

I confirmed through super_globals on a 1.5.1 system that during these operations the variable $languages was indeed set, will try the updated version of the same program to see if it is present at the same point (without my call to the get statement).

Perhaps my title was a little misleading, but at the same time seemed appropriate/applicable.

22 Jul 2014, 18:13
#4
dbltoe avatar

dbltoe

Totally Zenned

Join Date:
Jan 2004
Location:
N of San Antonio TX
Posts:
9,760
Plugin Contributions:
9

Re: v153 $languages is it no more?

Interesting.
I don't see anything different between 1.5.1 and 1.5.3 in that they show the require for general.php on line 28 of youradmin/includes/init_includes/init_general_func.php
Don't have a 1.5.2 test site but, it does show a change to the above file in 1.5.2.
Will take better look this evening. Perhaps a require in the mod that fired it?

26 Jul 2014, 18:37
#5
mc12345678 avatar

mc12345678

Totally Zenned

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

Re: v153 $languages is it no more?

dbltoe:

Interesting.
I don't see anything different between 1.5.1 and 1.5.3 in that they show the require for general.php on line 28 of youradmin/includes/init_includes/init_general_func.php
Don't have a 1.5.2 test site but, it does show a change to the above file in 1.5.2.
Will take better look this evening. Perhaps a require in the mod that fired it?

Any results? At leastany worth reporting? :)

26 Jul 2014, 22:10
#6
dbltoe avatar

dbltoe

Totally Zenned

Join Date:
Jan 2004
Location:
N of San Antonio TX
Posts:
9,760
Plugin Contributions:
9

Re: v153 $languages is it no more?

Sorry, Nothing yet. Still dealing with PHP strict error reporting on other sites.

29 Jul 2014, 04:36
#7
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
177

Re: v153 $languages is it no more?

I'm not aware of any explicit changes that would cause the symptoms you're talking about.

Are you 1000% certain that you didn't have something customized to load $languages yourself?

It is indeed not loaded in application_top ... and never has been. But many (not all) admin pages do directly set it ... so maybe your custom code is finding it on certain pages but not on others.

29 Jul 2014, 04:57
#8
mc12345678 avatar

mc12345678

Totally Zenned

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

Re: v153 $languages is it no more?

So, the code in question is EasyPopulate version 4. I may as said have installed something to what seems to be a vanilla store that assigned $languages before the code, but I also thought I tried the code on a 1.5.1 and 1.5.3 site, and when I tested for $languages within easypopulate_4.php after loading the ZC code, but just before including the export/import code. On 1.5.3 $languages does not contain anything, but in 1.5.1 it did... Discovered during efforts to review other functionality across versions.