2015-06-08 80 views
1

我的Prestashop用户即时试图找到一个URL类别的解决方案的Prestashop删除ID类别

我需要知道的过程中移除的Prestashop URL类别ID(数字)。 对于实例www.mydomain.com/16-myproducts

问候

+0

此功能在PrestaShop中不可用,最好的方法是使用模块。 – PrestaShopDeveloper

回答

0

其实你可能会做Dispatcher.php类覆盖。这几乎取决于你是哪个版本。

这里是我们如何做到这在Malttt在1.6,去年,请注意使用此代码,因为它可能是过时的,它也包括其他情况下(产品,供应商......):

/* 
* @author  Matt Loye <[email protected]> 
* @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]*'), 
      ), 
     ), 
    ); 
}