Jump to content

Languages issues on custom rules url


Recommended Posts

Hi everyone,

 

I've made my own module for stores management on my website.

I have implemented a solution to allow customers to find stores using countries and cities filter.

 

I can have 3 different urls : the basic one, the one with the country and a last one with the country and the city.

 

I have added new rule on the dispatcher to clean every url and this perfectly works.

Nonetheless, I got big issue when I start to change language.

 

For instance, when I just have choosen the country, I have this url :

 

--> www.toto.fr/en/stores/89/italy/genova

 

Then when I switch to french language, I got redirection saying that page moved to :

 

--> toto.fr/fr/magasin/89/italy/genova?categ=stores&id=89&name1=italy&name2=genova

 

whereas I expected having : toto.fr/fr/magasin/89/italie/genova

 

 

Does anyone have kind of explanations ? Or just an advice on what I should check or try ?

Thanks in advance and have nice day !

 

 

By the way, this is the rule I use :

'stores_rule' => array(
    'controller' =>  'stores',       
    'rule' =>        '{stores}/{id}/{nom_p}/{nom_v}',      
    'keywords' => array(       
        'id' => array('regexp' => '[0-9]+', 'param' => 'id_p'),
	'nom_pays' => array('regexp' => '[_a-zA-Z0-9-\pL]*', 'param' => 'name1'),
	'stores' => array('regexp' => '[_a-zA-Z0-9-\pL]*', 'param' => 'categ'),
	'nom_ville' => array('regexp' => '[_a-zA-Z0-9-\pL]*', 'param' => 'name2')
    )
)
Link to comment
Share on other sites

You need to have this format of custom rules:

'module-ph_simpleblog-list' => array(
                'controller' => 'list',
                'rule' => $blog_slug,
                'keywords' => array(),
                'params' => array(
                    'fc' => 'module',
                    'module' => 'ph_simpleblog',
                ),
            ),
module-module_name-controller_name Edited by Krystian Podemski (see edit history)
Link to comment
Share on other sites

×
×
  • Create New...