Hello guys,

I have a multi language problem in shop cms pages.
We have in the shop 7 languages, because of mysql table size limit, oxid has 
config option to create additional tables if you have a lot of languages.
So we defined following configuration: $this->iLangPerTable = 7;
Language 7 is Romanian, after copy the content is saved in oxcontents_set1 
table:
[X]
[X]
After copy, the language romanian is not in language select, so we can't edit 
content of it:
[X]
The language select is created by getAvailableInLangs method.
$aObjFields contains only fields from core oxcontents table and not from 
oxcontents_set1 table.
So array_diff at the end of the method has no romanian language.

/**
 * Returns an array of languages in which object multilanguage
 * fields are already setted
 *
 * @return array
 */
public function getAvailableInLangs()
{
    $aLanguages = oxRegistry::getLang()->getLanguageNames();

    $aObjFields = $this->_getTableFields(
        getViewName($this->_sCoreTable, -1, -1),
        true
    );
    $aMultiLangFields = array();

    //selecting all object multilang fields
    foreach ($aObjFields as $sKey => $sValue) {

        //skipping oxactive field
        if (preg_match('/^oxactive(_(\d{1,2}))?$/', $sKey)) {
            continue;
        }

        $iFieldLang = $this->_getFieldLang($sKey);

        //checking, if field is multilanguage
        if ($this->isMultilingualField($sKey) || $iFieldLang > 0) {
            $sNewKey = preg_replace('/_(\d{1,2})$/', '', $sKey);
            $aMultiLangFields[$sNewKey][] = (int) $iFieldLang;
        }
    }

    // if no multilanguage fields, return default languages array
    if (count($aMultiLangFields) < 1) {
        return $aLanguages;
    }

    // select from non-multilanguage core view (all ml tables joined to one)
    $oDb = oxDb::getDb(oxDb::FETCH_MODE_ASSOC);
    $query = "select * from " . getViewName($this->_sCoreTable, -1, -1) . " 
where oxid = " . $oDb->quote($this->getId());
    $rs = $oDb->getAll($query);

    $aNotInLang = $aLanguages;

    // checks if object field data is not empty in all available languages
    // and formats not available in languages array
    if (is_array($rs) && count($rs[0])) {
        foreach ($aMultiLangFields as $sFieldId => $aMultiLangIds) {

            foreach ($aMultiLangIds as $sMultiLangId) {
                $sFieldName = ($sMultiLangId == 0) ? $sFieldId : $sFieldId . 
'_' . $sMultiLangId;
                if ($rs['0'][strtoupper($sFieldName)]) {
                    unset($aNotInLang[$sMultiLangId]);
                    continue;
                }
            }
        }
    }

    $aIsInLang = array_diff($aLanguages, $aNotInLang);

    return $aIsInLang;
}

Does somybody has idea how to fix this issue?

Thanks!

Mit freundlichen Grüßen
Alexander Scheider

----
four for business AG

Nordring 82 B  |  63067 Offenbach
phone: +49 69 801082-55  |  fax: +49 69 801082-79
mail: alexander.schei...@4fb.de<mailto:alexander.schei...@4fb.de> | web: 
http://www.4fb.de<http://www.4fb.de/>

Vorstand: Thomas Schäfer-Tertilt  |  Harald Wirths
Aufsichtsrat: Ferdinand Kopf (Vorsitz)

Amtsgericht Offenbach am Main HRB 41501
Ust-IDNr.: DE212133747



Besuchen Sie uns auf Facebook: 
facebook.com/fourforbusiness<http://facebook.com/fourforbusiness>

Reply via email to