View Issue Details

IDProjectCategoryView StatusLast Update
0005244OXID eShop (all versions)4.07. Source code, Testpublic2023-11-20 13:58
ReporterHelmut L. Assigned To 
PrioritynormalSeveritymajorReproducibilityalways
Status confirmedResolutionopen 
Product Version4.7.6 / 5.0.6 
Summary0005244: getAvailableInLangs does not work with fields with lowercase letters
DescriptionIf you create a multilanguage table and add a field to the table which contains lowercase letters oxI18n->getAvailableInLangs always returns an empty array.
Steps To ReproduceCreate a multilanguage table and add a field with lowercase letters to the table:
 create table test (
  oxid char(32) not null,
  test_field varchar(10),
  test_field_1 varchar(10),
  test_field_2 varchar(10),
  primary key (oxid)
 );
 insert into test (oxid, test_field) values(md5('test'), 'test');

Add the table to the multilanguage tables array and regenerate the views.

Check with PHP the available languages:
 $test = oxNew('oxi18n');
 $test->init('test');
 $test->loadInLang(0, md5('test'));
 $test->getAvailableInLangs();
Additional InformationIn the getAvailableInLangs method strtoupper is always used on the $sFieldName parameter and thus does no more match with the field name retrieved from the db.

You should simply uppercase also the field names retrieved from the db:
 $rs['0'] = array_map('strtoupper', $rs['0']);
TagsNo tags attached.
ThemeAll
BrowserAll
PHP VersionNot defined
Database VersionNot defined

Activities

Helmut L.

2013-06-25 15:48

reporter   ~0008834

My suggested fix was a bit incomplete. Here is the working solution:
$keys = array_map('strtoupper', array_keys($rs['0']));
$rs['0'] = array_combine($keys, $rs['0']);