dpyic24480 2016-09-08 18:30
浏览 47

Prestashop自定义模块友好网址

I developed a custom module for Prestashop, and I have some issues regarding the friendly url parameters retrieval. If I disable the friendly url, everything works as supposed, but whenever I try with friendly url it doesn't work

So, the problem is the following:. I have a friendly url link just like the one below:

domain.com/22-flower-delivery-Hong+Kong.html

and the other link:

domain.com/22-flower-delivery-Hong+Kong-Sai+Kung.html

The first link gets a country page and the other one is showing a city inside that country.

The route in Prestashop is done like below:

$my_link = array(
    'module-vpages-dpage' => array(
    'controller' => 'dpage',
    'rule' => '{id_country:-}flower-delivery{-:country}{-:city}.html',
    'keywords' => array(
        'id_country' => array('regexp' => '[0-9]+', 'param' => 'id_country'),
        'setCountry' => array('regexp' => '[0-9]+', 'param' => 'setCountry'),
        'country' => array('regexp' => '[\w]+', 'param' => 'country'),
        'city' => array('regexp' => '[_a-zA-Z0-9\pL\pS-]*', 'param' => 'city'),
        'module_action' => array('regexp' => '[\w]+', 'param' => 'module_action')
    ),
    'params' => array(
        'fc' => 'module',
        'module' => 'vpages'
    )
    )
);

The main issue is that this works if the country or the city has a single word as name, but if there are 2 words (Hong Kong, New Zeeland, etc) then it will crash. A am using urlencode() and decode just to be sure that everything is passed ok but still with no luck.

Could someone help sort it out?

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 Python报错怎么解决
    • ¥15 simulink如何调用DLL文件
    • ¥15 关于用pyqt6的项目开发该怎么把前段后端和业务层分离
    • ¥30 线性代数的问题,我真的忘了线代的知识了
    • ¥15 有谁能够把华为matebook e 高通骁龙850刷成安卓系统,或者安装安卓系统
    • ¥188 需要修改一个工具,懂得汇编的人来。
    • ¥15 livecharts wpf piechart 属性
    • ¥20 数学建模,尽量用matlab回答,论文格式
    • ¥15 昨天挂载了一下u盘,然后拔了
    • ¥30 win from 窗口最大最小化,控件放大缩小,闪烁问题