/** * Get the mapping data: currency * * @return array */ public function getCurrency() { $rows = Shopware()->Db()->query(' SELECT C.currency id, C.name, IFNULL(PMC.plentyID, 0) plentyID FROM s_core_currencies C LEFT JOIN plenty_mapping_currency PMC ON PMC.shopwareID = C.currency ORDER BY C.name ')->fetchAll(); $plentyCurrencies = PlentymarketsConfig::getInstance()->getMiscCurrenciesSorted(); foreach ($rows as &$row) { if ($row['plentyID']) { $row['plentyName'] = $plentyCurrencies[$row['plentyID']]['name']; } else { if ($this->auto) { foreach ($plentyCurrencies as $plentyData) { $distance = levenshtein($row['id'], $plentyData['name']); if ($distance == 0) { $row['plentyName'] = $plentyData['name']; $row['plentyID'] = $plentyData['id']; PlentymarketsMappingController::addCurrency($row['id'], $plentyData['id']); } } } else { $row['plentyName'] = ''; } } } return $rows; }