Joomla extension Articles Good Search module can't handle German "umlauts"

22 Views Asked by At

I've been troubling with the problem that wehen I type "München" into the search of the extension it always changes to "mnchen" and the result clearlydoes not show up. Ä, Ü and Ö are a big trouble Also tried with Joomla's own search module no problem there.

Added the languages in xml also tried to work a bit with the php but no change on that subject.

would be very thankful about any help cuz im kinda a beginner.

Thanks a lot (Page is local)

php:

<?php

/**
 * @package     Articles Good Search
 *
 * @copyright   Copyright (C) 2017 Joomcar extensions. All rights reserved.
 * @license     GNU General Public License version 2 or later.
 */

// no direct access
defined('_JEXEC') or die('Restricted access');

error_reporting(E_ALL & ~E_STRICT & ~E_NOTICE & ~E_WARNING & ~E_DEPRECATED);

require_once (dirname(__FILE__).'/helper.php');
$helper = new modArticlesGoodSearchHelper($params);

$cityFieldId = 1;

// Setzen Sie den Filter nur für Städte
$filters = "field:{$cityFieldId}";

$filters = $params->get('filters');

if(!JPluginHelper::isEnabled('system', 'articlesgoodsearch')) {
    echo "Articles Good Search plugin is not published.<br />";
}

if($filters == "") {
    echo "Select search fields in Articles Good Search module parameters! <br />";
    return;
}

if($params->get('savesearch') && JFactory::getSession()->get("SaveSearchValues")) {
    $skip = array("option", "task", "view", "Itemid", "search_mode", "dynobox", "field_id", "field_type");
    foreach(JFactory::getSession()->get("SaveSearchValues") as $key=>$value) {
        if(in_array($key, $skip)) continue;
        JFactory::getApplication()->input->set($key, $value);
    }
}

// Make the module respect umlauts
$filters_tmp = explode("\r\n", $filters);
foreach ($filters_tmp as $key => $filter) {
    $filters_tmp[$key] = strtr($filter, array('ä' => 'ae', 'ü' => 'ue', 'ö' => 'oe'));
}
$filters = implode("\r\n", $filters_tmp);

$filters_tmp = explode("\r\n", $filters);
$filters = Array();
foreach($filters_tmp as $k=>$filter) {
    $filter = explode(":", $filter);
    $filters[$k] = new stdClass;
    if($filter[0] == 'field') {
        $instance = $helper->getCustomField($filter[1]);
        $filters[$k]->id = $filter[1];
        if($filter[2] == "") { 
            $filter[2] = $instance->type; 
        }
        $filters[$k]->type = $filter[2];
        $filters[$k]->instance = $instance;
        //added for compatibility with radical multifield
        $flt = explode('{', $filters_tmp[$k], 2);
        if(!empty($flt[1]) && $flt[1] != '') {
            $filters[$k]->extra_params = '{' . $flt[1];
        }
    }
    else {
        $filters[$k]->id = '1000'.$k;
        $filters[$k]->type = $filter[0];
    }
}

require (JModuleHelper::getLayoutPath('mod_articles_good_search', $params->get('module_template', 'Default') . '/template'));

0

There are 0 best solutions below