Keyword

Extra fields + joomfish = translation doesn't appear

  • guespa
  • guespa's Avatar Topic Author
  • Offline
  • Junior Member
More
14 years 2 months ago #79324 by guespa
When i translate extra fields, in the frontend is the original langage that appears.(Everything is published in the backend)
Someone have a solution?

Please Log in or Create an account to join the conversation.

More
14 years 2 months ago #79325 by thrinodos
same problem here...any solution?

Please Log in or Create an account to join the conversation.

More
13 years 11 months ago #79326 by fran p
I have a similar problem with extra fields in K2(2.2) and Joomfish(2.0.4). When I update an item's K2 extra fields information, the corresponding JF translation Extra Fields do NOT update. They display as the day the translation was created.

I've found a less-than-ideal way to solve this by deleting the entire translation from JF and recreating it (then the current K2 Extra fields content is correct), but if my extra fields require further updating, I'd need to repeat this process.


I also have 2 translations that seem to be broken or incomplete. Extra fields show in the default language (English) but they don't show Extra Fields in the translations (front end). In the JF admin screen, the WYSIWYG editor (JCE) doesn't show either. Oddly, this happens with only 2 out of hundreds of K2 items. Even when I try to re-create these items, the same thing happens every time. Still searching for the difference in these files or what may be causing this...

Please Log in or Create an account to join the conversation.

  • guespa
  • guespa's Avatar Topic Author
  • Offline
  • Junior Member
More
13 years 11 months ago #79327 by guespa
I found something that "works". When i translate i do first the extra fields translation and after i press "apply". It allways works although this is only a half solution.

Please Log in or Create an account to join the conversation.

  • guespa
  • guespa's Avatar Topic Author
  • Offline
  • Junior Member
More
13 years 11 months ago #79328 by guespa
@ fran p, I have the same problem withe JCE, it doesn't show in the Joomfish admin screen but only with the two last items i create. No problem with the others. I asked in JCE and Joomfish forums but no one knows why. But if you choose another WYSIWYG editor the problem disappears. If you find a solution i'm interested.

Please Log in or Create an account to join the conversation.

More
13 years 11 months ago #79329 by Nathan Brown
Replied by Nathan Brown on topic Extra fields + joomfish = translation doesn't appear
Hey guys, this is a core hack, but it seems to work to show extra field data :P
(note, it doesn't translate the field names, only the data - but it should be a good starting point for anyone trying to do this)


I'm not a PHP guy, and this is my first real hack out of desperate need, so please use with caution (and post improvements please!) It seems like a relatively simple thing and I'm quite shocked that none of the 'Pro' PHP guys here have helped with this. I hope it helps someone.

You need to replace some code in the file:

components/k2_com/models/item.php

replace the first function "getData() {...}" with

function getData() {

$id = JRequest::getInt('id');
$db = & JFactory::getDBO();
$query = "SELECT * FROM #__k2_items WHERE id={$id}";
$db->setQuery($query, 0, 1);
$row = $db->loadObject();
//Joomfish Hack to set correct language extra fields
$this->setJoomFishExtraFieldData($row);
return $row;
}
//Checks language and replaces extra fields with correct language data from joomfish
function setJoomFishExtraFieldData($row){
$id = JRequest::getInt('id');
jimport('joomla.filesystem.file');
$db = &JFactory::getDBO();
$language = &JFactory::getLanguage();
$defaultLang = $language->getDefault();
$currentLang = $language->getTag();

if (JFolder::exists(JPATH_ADMINISTRATOR.DS.'components'.DS.'com_joomfish') && $currentLang != $defaultLang) {

$query = "SELECT id FROM #__languages WHERE code='{$currentLang}' ";
$db->setQuery($query, 0, 1);
$langdata = $db->loadObject();
$langcode = $langdata->id;

$query = "SELECT value FROM #__jf_content WHERE reference_id={$id} AND language_id={$langcode} AND reference_field='extra_fields' ";
$db->setQuery($query, 0, 1);
$jfdata = $db->loadObject();

if (count($jfdata)) {
$row->extra_fields = $jfdata->value;
}
}
}

Please Log in or Create an account to join the conversation.

More
13 years 10 months ago #79330 by silvena ralinova
Replied by silvena ralinova on topic Extra fields + joomfish = translation doesn't appear
Not working for me! But 10x for the work! Hope someone will consider you idea!

Nathan Brown said:Hey guys, this is a core hack, but it seems to work to show extra field data :P (note, it doesn't translate the field names, only the data - but it should be a good starting point for anyone trying to do this)

I'm not a PHP guy, and this is my first real hack out of desperate need, so please use with caution (and post improvements please!) It seems like a relatively simple thing and I'm quite shocked that none of the 'Pro' PHP guys here have helped with this. I hope it helps someone.

You need to replace some code in the file:

components/k2_com/models/item.php

replace the first function "getData() {...}" with

function getData() {

$id = JRequest::getInt('id');
$db = & JFactory::getDBO();
$query = "SELECT * FROM #__k2_items WHERE id={$id}";
$db->setQuery($query, 0, 1);
$row = $db->loadObject();
//Joomfish Hack to set correct language extra fields
$this->setJoomFishExtraFieldData($row);
return $row;
}
//Checks language and replaces extra fields with correct language data from joomfish
function setJoomFishExtraFieldData($row){
$id = JRequest::getInt('id');
jimport('joomla.filesystem.file');
$db = &JFactory::getDBO();
$language = &JFactory::getLanguage();
$defaultLang = $language->getDefault();
$currentLang = $language->getTag();

if (JFolder::exists(JPATH_ADMINISTRATOR.DS.'components'.DS.'com_joomfish') && $currentLang != $defaultLang) {

$query = "SELECT id FROM #__languages WHERE code='{$currentLang}' ";
$db->setQuery($query, 0, 1);
$langdata = $db->loadObject();
$langcode = $langdata->id;

$query = "SELECT value FROM #__jf_content WHERE reference_id={$id} AND language_id={$langcode} AND reference_field='extra_fields' ";
$db->setQuery($query, 0, 1);
$jfdata = $db->loadObject();

if (count($jfdata)) {
$row->extra_fields = $jfdata->value;
}
}
}

Please Log in or Create an account to join the conversation.


Powered by Kunena Forum