Prestashop删除id类别
我是Prestashop用户,我正在尝试查找url类别解决方案 我需要知道删除Prestashop url的类别id(数字)的过程。 例如www.mydomain.com/16-myproductsPrestashop删除id类别,prestashop,prestashop-1.6,Prestashop,Prestashop 1.6,我是Prestashop用户,我正在尝试查找url类别解决方案 我需要知道删除Prestashop url的类别id(数字)的过程。 例如www.mydomain.com/16-myproducts 实际上,您可以重写Dispatcher.php类。这在很大程度上取决于你的版本 以下是我们去年在Malttt 1.6上如何做到这一点的,请注意此代码,因为它可能已经过时,它还包括其他情况(产品、供应商……): /* *@作者马特·洛伊 *@版权所有2016-2017代理商Malttt */ 类调度器
实际上,您可以重写Dispatcher.php类。这在很大程度上取决于你的版本 以下是我们去年在Malttt 1.6上如何做到这一点的,请注意此代码,因为它可能已经过时,它还包括其他情况(产品、供应商……):
/*
*@作者马特·洛伊
*@版权所有2016-2017代理商Malttt
*/
类调度器扩展了DispatcherCore
{
/**
*@var数组默认路由列表
*/
public$default\u routes=array(
“供应商规则”=>数组(
“控制器”=>“供应商”,
'规则'=>'供应商/{rewrite}/',
'关键字'=>数组(
'id'=>array('regexp'=>'[0-9]+'),
“重写”=>数组(“regexp”=>“[\u a-zA-Z0-9-\pL]*”,“参数”=>“供应商重写”),
“meta_关键字”=>array('regexp'=>'[\u a-zA-Z0-9-\pL]*'),
“meta_title'=>array('regexp'=>'[\u a-zA-Z0-9-\pL]*'),
),
),
“制造商规则”=>数组(
“控制器”=>“制造商”,
'规则'=>'制造商/{rewrite}/',
'关键字'=>数组(
'id'=>array('regexp'=>'[0-9]+'),
“重写”=>数组(“regexp”=>“[\u a-zA-Z0-9-\pL]*”,“param”=>“制造商重写”),
“meta_关键字”=>array('regexp'=>'[\u a-zA-Z0-9-\pL]*'),
“meta_title'=>array('regexp'=>'[\u a-zA-Z0-9-\pL]*'),
),
),
“cms_规则”=>数组(
“控制器”=>“cms”,
'rule'=>'info/{rewrite}',
'关键字'=>数组(
'id'=>array('regexp'=>'[0-9]+'),
“重写”=>array('regexp'=>“[\u a-zA-Z0-9-\pL]*”,'param'=>'cms\u rewrite'),
“meta_关键字”=>array('regexp'=>'[\u a-zA-Z0-9-\pL]*'),
“meta_title'=>array('regexp'=>'[\u a-zA-Z0-9-\pL]*'),
),
),
“cms\u类别\u规则”=>数组(
“控制器”=>“cms”,
'rule'=>'info/{rewrite}/',
'关键字'=>数组(
'id'=>array('regexp'=>'[0-9]+'),
“重写”=>array('regexp'=>“[\u a-zA-Z0-9-\pL]*”,'param'=>'cms\u category\u rewrite'),
“meta_关键字”=>array('regexp'=>'[\u a-zA-Z0-9-\pL]*'),
“meta_title'=>array('regexp'=>'[\u a-zA-Z0-9-\pL]*'),
),
),
“模块”=>阵列(
“控制器”=>null,
'rule'=>'module/{module}{/:controller}',
'关键字'=>数组(
'module'=>array('regexp'=>'[\u a-zA-Z0-9.-]+','param'=>'module'),
“控制器”=>array('regexp'=>“[\u a-zA-Z0-9.-]+','param'=>'controller'),
),
“params”=>数组(
'fc'=>'模块',
),
),
“产品规则”=>数组(
“控制器”=>“产品”,
'规则'=>'{category://}{rewrite}.html',
'关键字'=>数组(
'id'=>array('regexp'=>'[0-9]+'),
“重写”=>数组(“regexp”=>“[\u a-zA-Z0-9-\pL]*”,“param”=>“产品重写”),
'ean13'=>array('regexp'=>'[0-9\pL]*'),
'类别'=>数组('regexp'=>'[\u a-zA-Z0-9-\pL]*'),
'categories'=>array('regexp'=>'[/_a-zA-Z0-9-\pL]*'),
'参考'=>数组('regexp'=>'[\u a-zA-Z0-9-\pL]*'),
“meta_关键字”=>array('regexp'=>'[\u a-zA-Z0-9-\pL]*'),
“meta_title'=>array('regexp'=>'[\u a-zA-Z0-9-\pL]*'),
“制造商”=>数组('regexp'=>“[\u a-zA-Z0-9-\pL]*'),
“供应商”=>数组('regexp'=>“[\u a-zA-Z0-9-\pL]*'),
'price'=>array('regexp'=>'[0-9\,]*'),
'tags'=>array('regexp'=>'[a-zA-Z0-9-\pL]*'),
),
),
“分层规则”=>数组(
“控制器”=>“类别”,
'规则'=>'{rewrite}/filter{selected_filters}',
'关键字'=>数组(
'id'=>array('regexp'=>'[0-9]+'),
/*所选过滤器由模块blocklayered使用*/
“选定的\u筛选器”=>array('regexp'=>'*,'param'=>“选定的\u筛选器”),
“重写”=>数组(“regexp”=>“[\u a-zA-Z0-9-\pL]*”,“param”=>“类别重写”),
“meta_关键字”=>array('regexp'=>'[\u a-zA-Z0-9-\pL]*'),
“meta_title'=>array('regexp'=>'[\u a-zA-Z0-9-\pL]*'),
),
),
“类别规则”=>数组(
“控制器”=>“类别”,
'规则'=>'{rewrite}/',
'关键字'=>数组(
'id'=>array('regexp'=>'[0-9]+'),
'categories'=>array('regexp'=>'[/_a-zA-Z0-9-\pL]*'),
“重写”=>数组(“regexp”=>“[\u a-zA-Z0-9-\pL]*”,“param”=>“类别重写”),
“meta_关键字”=>array('regexp'=>'[\u a-zA-Z0-9-\pL]*'),
“meta_title'=>array('regexp'=>'[\u a-zA-Z0-9-\pL]*'),
),
),
);
}
实际上,您可以重写Dispatcher.php类。这在很大程度上取决于你的版本
以下是我们去年在Malttt 1.6上如何做到这一点的,请注意此代码,因为它可能已经过时,它还包括其他情况(产品、供应商……):
/*
*@作者马特·洛伊
*@版权所有2016-2017代理商Malttt
*/
阶级斗争
/*
* @author Matt Loye <matthieu@agence-malttt.fr>
* @copyright 2016-2017 Agence Malttt
*/
class Dispatcher extends DispatcherCore
{
/**
* @var array List of default routes
*/
public $default_routes = array(
'supplier_rule' => array(
'controller' => 'supplier',
'rule' => 'supplier/{rewrite}/',
'keywords' => array(
'id' => array('regexp' => '[0-9]+'),
'rewrite' => array('regexp' => '[_a-zA-Z0-9-\pL]*', 'param' => 'supplier_rewrite'),
'meta_keywords' => array('regexp' => '[_a-zA-Z0-9-\pL]*'),
'meta_title' => array('regexp' => '[_a-zA-Z0-9-\pL]*'),
),
),
'manufacturer_rule' => array(
'controller' => 'manufacturer',
'rule' => 'manufacturer/{rewrite}/',
'keywords' => array(
'id' => array('regexp' => '[0-9]+'),
'rewrite' => array('regexp' => '[_a-zA-Z0-9-\pL]*', 'param' => 'manufacturer_rewrite'),
'meta_keywords' => array('regexp' => '[_a-zA-Z0-9-\pL]*'),
'meta_title' => array('regexp' => '[_a-zA-Z0-9-\pL]*'),
),
),
'cms_rule' => array(
'controller' => 'cms',
'rule' => 'info/{rewrite}',
'keywords' => array(
'id' => array('regexp' => '[0-9]+'),
'rewrite' => array('regexp' => '[_a-zA-Z0-9-\pL]*', 'param' => 'cms_rewrite'),
'meta_keywords' => array('regexp' => '[_a-zA-Z0-9-\pL]*'),
'meta_title' => array('regexp' => '[_a-zA-Z0-9-\pL]*'),
),
),
'cms_category_rule' => array(
'controller' => 'cms',
'rule' => 'info/{rewrite}/',
'keywords' => array(
'id' => array('regexp' => '[0-9]+'),
'rewrite' => array('regexp' => '[_a-zA-Z0-9-\pL]*', 'param' => 'cms_category_rewrite'),
'meta_keywords' => array('regexp' => '[_a-zA-Z0-9-\pL]*'),
'meta_title' => array('regexp' => '[_a-zA-Z0-9-\pL]*'),
),
),
'module' => array(
'controller' => null,
'rule' => 'module/{module}{/:controller}',
'keywords' => array(
'module' => array('regexp' => '[_a-zA-Z0-9_-]+', 'param' => 'module'),
'controller' => array('regexp' => '[_a-zA-Z0-9_-]+', 'param' => 'controller'),
),
'params' => array(
'fc' => 'module',
),
),
'product_rule' => array(
'controller' => 'product',
'rule' => '{category:/}{rewrite}.html',
'keywords' => array(
'id' => array('regexp' => '[0-9]+'),
'rewrite' => array('regexp' => '[_a-zA-Z0-9-\pL]*', 'param' => 'product_rewrite'),
'ean13' => array('regexp' => '[0-9\pL]*'),
'category' => array('regexp' => '[_a-zA-Z0-9-\pL]*'),
'categories' => array('regexp' => '[/_a-zA-Z0-9-\pL]*'),
'reference' => array('regexp' => '[_a-zA-Z0-9-\pL]*'),
'meta_keywords' => array('regexp' => '[_a-zA-Z0-9-\pL]*'),
'meta_title' => array('regexp' => '[_a-zA-Z0-9-\pL]*'),
'manufacturer' => array('regexp' => '[_a-zA-Z0-9-\pL]*'),
'supplier' => array('regexp' => '[_a-zA-Z0-9-\pL]*'),
'price' => array('regexp' => '[0-9\.,]*'),
'tags' => array('regexp' => '[a-zA-Z0-9-\pL]*'),
),
),
'layered_rule' => array(
'controller' => 'category',
'rule' => '{rewrite}/filter{selected_filters}',
'keywords' => array(
'id' => array('regexp' => '[0-9]+'),
/* Selected filters is used by the module blocklayered */
'selected_filters' => array('regexp' => '.*', 'param' => 'selected_filters'),
'rewrite' => array('regexp' => '[_a-zA-Z0-9-\pL]*', 'param' => 'category_rewrite'),
'meta_keywords' => array('regexp' => '[_a-zA-Z0-9-\pL]*'),
'meta_title' => array('regexp' => '[_a-zA-Z0-9-\pL]*'),
),
),
'category_rule' => array(
'controller' => 'category',
'rule' => '{rewrite}/',
'keywords' => array(
'id' => array('regexp' => '[0-9]+'),
'categories' => array('regexp' => '[/_a-zA-Z0-9-\pL]*'),
'rewrite' => array('regexp' => '[_a-zA-Z0-9-\pL]*', 'param' => 'category_rewrite'),
'meta_keywords' => array('regexp' => '[_a-zA-Z0-9-\pL]*'),
'meta_title' => array('regexp' => '[_a-zA-Z0-9-\pL]*'),
),
),
);
}