private function processComplexFields(SJB_Listing $listing, $listingInfo) { if (!empty($listingInfo['complex'])) { $i18n = SJB_I18N::getInstance(); $listingComplex = unserialize($listingInfo['complex']); $complexFieldsIds = array(); foreach ($listingComplex as $complexId => $complexValues) { if (!$listing->getProperty($complexId)) { $complexFieldsIds[] = $complexId; $complexInfo = SJB_ListingFieldDBManager::getListingFieldInfoByID($complexId); $complexInfo['value'] = $complexValues; foreach ($complexValues as $fieldId => $fieldValue) { $fieldSid = SJB_ListingFieldDBManager::getComplexFieldSIDbyID($fieldId); $fieldInfo = SJB_ListingFieldDBManager::getListingComplexFieldInfoBySID($fieldSid); $complexInfo['fields'][] = $fieldInfo; foreach ($fieldValue as $key => $value) { if ($value != null) { switch ($fieldInfo['type']) { case 'int': case 'integer': $complexInfo['value'][$fieldId][$key] = $i18n->getInt($value); break; case 'float': $complexInfo['value'][$fieldId][$key] = $i18n->getFloat($value); break; case 'date': $complexInfo['value'][$fieldId][$key] = $i18n->getDate($value); break; } } } } $listing->addProperty($complexInfo); } } return $complexFieldsIds; } return array(); }