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;
}
}
}