Skip to content

Commit

Permalink
Product translations not being compatible with Contao 3.3 changes (#1109
Browse files Browse the repository at this point in the history
)
  • Loading branch information
Toflar committed May 23, 2014
1 parent e27a322 commit 1b9c684
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
1 change: 1 addition & 0 deletions system/modules/isotope/docs/CHANGELOG-2.1.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Version 2.1.2-stable (2014-??-??)
- Wrong column count in collection template again (#1091)
- Assets import calling to classes in wrong namespace (#1113)
- TypeAgent not being compatible with Contao 3.3 changes
- Product translations not being compatible with Contao 3.3 changes (#1109)


Version 2.1.1-stable (2014-05-20)
Expand Down
22 changes: 11 additions & 11 deletions system/modules/isotope/drivers/DC_ProductData.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ class DC_ProductData extends \DC_Table
protected $blnEditLanguage;

/**
* Array of languages for this product's type
* Array of translations for this product's type
* @var array
*/
protected $arrLanguages;
protected $arrTranslations;

/**
* Array of language labels
Expand Down Expand Up @@ -441,13 +441,13 @@ public function edit($intID = false, $ajaxId = false)
}

if (count($arrPageLanguages) > 1) {
$this->arrLanguageLabels = \System::getLanguages();
$this->arrLanguages = array_intersect(array_keys($this->arrLanguageLabels), $arrPageLanguages);
$this->arrTranslationLabels = \System::getLanguages();
$this->arrTranslations = array_intersect(array_keys($this->arrTranslationLabels), $arrPageLanguages);

if (\Input::post('FORM_SUBMIT') == 'tl_language') {
$session = $this->Session->getData();

if (in_array(\Input::post('language'), $this->arrLanguages)) {
if (in_array(\Input::post('language'), $this->arrTranslations)) {
$session['language'][$this->strTable][$this->intId] = \Input::post('language');

if (\Input::post('deleteLanguage') != '') {
Expand All @@ -463,7 +463,7 @@ public function edit($intID = false, $ajaxId = false)
\Controller::reload();
}

if ($_SESSION['BE_DATA']['language'][$this->strTable][$this->intId] != '' && in_array($_SESSION['BE_DATA']['language'][$this->strTable][$this->intId], $this->arrLanguages)) {
if ($_SESSION['BE_DATA']['language'][$this->strTable][$this->intId] != '' && in_array($_SESSION['BE_DATA']['language'][$this->strTable][$this->intId], $this->arrTranslations)) {
$objRow = $this->Database->prepare("SELECT * FROM " . $this->strTable . " WHERE pid=? AND language=?")->execute($this->intId, $_SESSION['BE_DATA']['language'][$this->strTable][$this->intId]);

if (!$objRow->numRows) {
Expand Down Expand Up @@ -672,21 +672,21 @@ public function edit($intID = false, $ajaxId = false)
}

// Check languages
if (is_array($this->arrLanguages) && !empty($this->arrLanguages)) {
if (is_array($this->arrTranslations) && !empty($this->arrTranslations)) {
$arrAvailableLanguages = $this->Database->prepare("SELECT language FROM " . $this->strTable . " WHERE pid=?")->execute($this->intId)->fetchEach('language');
$available = '';
$undefined = '';

foreach ($this->arrLanguages as $language) {
foreach ($this->arrTranslations as $language) {
if (in_array($language, $arrAvailableLanguages)) {
if ($_SESSION['BE_DATA']['language'][$this->strTable][$this->intId] == $language) {
$available .= '<option value="' . $language . '" selected="selected">' . $this->arrLanguageLabels[$language] . '</option>';
$available .= '<option value="' . $language . '" selected="selected">' . $this->arrTranslationLabels[$language] . '</option>';
$_SESSION['TL_INFO'] = array($GLOBALS['TL_LANG']['MSC']['editingLanguage']);
} else {
$available .= '<option value="' . $language . '">' . $this->arrLanguageLabels[$language] . '</option>';
$available .= '<option value="' . $language . '">' . $this->arrTranslationLabels[$language] . '</option>';
}
} else {
$undefined .= '<option value="' . $language . '">' . $this->arrLanguageLabels[$language] . ' (' . $GLOBALS['TL_LANG']['MSC']['undefinedLanguage'] . ')' . '</option>';
$undefined .= '<option value="' . $language . '">' . $this->arrTranslationLabels[$language] . ' (' . $GLOBALS['TL_LANG']['MSC']['undefinedLanguage'] . ')' . '</option>';
}
}

Expand Down

0 comments on commit 1b9c684

Please sign in to comment.