Jump to content

teerachai

Members
  • Posts

    1
  • Joined

  • Last visited

Posts posted by teerachai

  1. ไฟล์ที่ต้องแก้มีดั้งนี้

     

    1.\classes\Tools.php

     

    ค้นหา Function str2url แล้ว copy ทับไปเลยครับ

     

    public static function str2url($str)
    {
     static $allow_accented_chars = null;
     if ($allow_accented_chars === null)
      $allow_accented_chars = Configuration::get('PS_ALLOW_ACCENTED_CHARS_URL');
     $str = trim($str);
     if (function_exists('mb_strtolower'))
      $str = mb_strtolower($str, 'utf-8');
     elseif (!$allow_accented_chars)
      $str = Tools::replaceAccentedChars($str);
     // Remove all non-whitelist chars.
     if ($allow_accented_chars)
      $str = preg_replace('/[^a-zA-Z0-9\s\'\:\/\[\]-\pL\pM]/u', '', $str);
     else
      $str = preg_replace('/[^a-zA-Z0-9\s\'\:\/\[\]-]/','', $str);
     $str = preg_replace('/[\s\'\:\/\[\]-]+/', ' ', $str);
     $str = str_replace(array(' ', '/'), '-', $str);
     // If it was not possible to lowercase the string with mb_strtolower, we do it after the transformations.
     // This way we lose fewer special chars.
     if (!function_exists('mb_strtolower'))
      $str = strtolower($str);
     return $str;
    }
    

     

    2.\classes\Validate.php

     

    ค้นหา Function isLinkRewrite และ isRoutePattern แล้ว copy ทับไปเลยครับ (อยู่ติดกันครับ)

     

    public static function isLinkRewrite($link)
    {
     if (Configuration::get('PS_ALLOW_ACCENTED_CHARS_URL'))
      return preg_match('/^[_a-zA-Z0-9\-\pL\pM]+$/u', $link);
     return preg_match('/^[_a-zA-Z0-9\-]+$/', $link);
    }
    public static function isRoutePattern($pattern)
    {
     if (Configuration::get('PS_ALLOW_ACCENTED_CHARS_URL'))
      return preg_match('/^[_a-zA-Z0-9\(\)\.{}:\/\-\pL\pM]+$/u', $pattern);
     return preg_match('/^[_a-zA-Z0-9\(\)\.{}:\/\-]+$/', $pattern);
    }
    

     

    3. \classes\Dispatcher.php

     

    Copy ทับไปเลยครับ

     

    public $default_routes = array(
     'category_rule' => array(
      'controller' => 'category',
      'rule' =>  '{id}-{rewrite}',
      'keywords' => array(
    'id' =>	array('regexp' => '[0-9]+', 'param' => 'id_category'),
    'rewrite' =>  array('regexp' => '[_a-zA-Z0-9-\pL\pM]*'),
    'meta_keywords' => array('regexp' => '[_a-zA-Z0-9-\pL\pM]*'),
    'meta_title' =>  array('regexp' => '[_a-zA-Z0-9-\pL\pM]*'),
      ),
     ),
     'supplier_rule' => array(
      'controller' => 'supplier',
      'rule' =>  '{id}__{rewrite}',
      'keywords' => array(
    'id' =>	array('regexp' => '[0-9]+', 'param' => 'id_supplier'),
    'rewrite' =>  array('regexp' => '[_a-zA-Z0-9-\pL\pM]*'),
    'meta_keywords' => array('regexp' => '[_a-zA-Z0-9-\pL\pM]*'),
    'meta_title' =>  array('regexp' => '[_a-zA-Z0-9-\pL\pM]*'),
      ),
     ),
     'manufacturer_rule' => array(
      'controller' => 'manufacturer',
      'rule' =>  '{id}_{rewrite}',
      'keywords' => array(
    'id' =>	array('regexp' => '[0-9]+', 'param' => 'id_manufacturer'),
    'rewrite' =>  array('regexp' => '[_a-zA-Z0-9-\pL\pM]*'),
    'meta_keywords' => array('regexp' => '[_a-zA-Z0-9-\pL\pM]*'),
    'meta_title' =>  array('regexp' => '[_a-zA-Z0-9-\pL\pM]*'),
      ),
     ),
     'cms_rule' => array(
      'controller' => 'cms',
      'rule' =>  'content/{id}-{rewrite}',
      'keywords' => array(
    'id' =>	array('regexp' => '[0-9]+', 'param' => 'id_cms'),
    'rewrite' =>  array('regexp' => '[_a-zA-Z0-9-\pL\pM]*'),
    'meta_keywords' => array('regexp' => '[_a-zA-Z0-9-\pL\pM]*'),
    'meta_title' =>  array('regexp' => '[_a-zA-Z0-9-\pL\pM]*'),
      ),
     ),
     'cms_category_rule' => array(
      'controller' => 'cms',
      'rule' =>  'content/category/{id}-{rewrite}',
      'keywords' => array(
    'id' =>	array('regexp' => '[0-9]+', 'param' => 'id_cms_category'),
    'rewrite' =>  array('regexp' => '[_a-zA-Z0-9-\pL\pM]*'),
    'meta_keywords' => array('regexp' => '[_a-zA-Z0-9-\pL\pM]*'),
    'meta_title' =>  array('regexp' => '[_a-zA-Z0-9-\pL\pM]*'),
      ),
     ),
     '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:/}{id}-{rewrite}{-:ean13}.html',
      'keywords' => array(
    'id' =>	array('regexp' => '[0-9]+', 'param' => 'id_product'),
    'rewrite' =>  array('regexp' => '[_a-zA-Z0-9-\pL\pM]*'),
    'ean13' =>   array('regexp' => '[0-9\pL]*'),
    'category' =>  array('regexp' => '[_a-zA-Z0-9-\pL\pM]*'),
    'categories' =>  array('regexp' => '[/_a-zA-Z0-9-\pL\pM]*'),
    'reference' =>  array('regexp' => '[_a-zA-Z0-9-\pL\pM]*'),
    'meta_keywords' => array('regexp' => '[_a-zA-Z0-9-\pL\pM]*'),
    'meta_title' =>  array('regexp' => '[_a-zA-Z0-9-\pL\pM]*'),
    'manufacturer' => array('regexp' => '[_a-zA-Z0-9-\pL\pM]*'),
    'supplier' =>  array('regexp' => '[_a-zA-Z0-9-\pL\pM]*'),
    'price' =>   array('regexp' => '[0-9\.,]*'),
    'tags' =>   array('regexp' => '[a-zA-Z0-9-\pL]*'),
      ),
     ),
     // Must be after the product and category rules in order to avoid conflict
     'layered_rule' => array(
      'controller' => 'category',
      'rule' =>  '{id}-{rewrite}{/:selected_filters}',
      'keywords' => array(
    'id' =>	array('regexp' => '[0-9]+', 'param' => 'id_category'),
    /* Selected filters is used by the module blocklayered */
    'selected_filters' =>  array('regexp' => '.*', 'param' => 'selected_filters'),
    'rewrite' =>  array('regexp' => '[_a-zA-Z0-9-\pL\pM]*'),
    'meta_keywords' => array('regexp' => '[_a-zA-Z0-9-\pL\pM]*'),
    'meta_title' =>  array('regexp' => '[_a-zA-Z0-9-\pL\pM]*'),
      ),
     ),
    

×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More