// Blocklayered: Fix bug with urlrewrite
This commit is contained in:
+14
-2
@@ -64,6 +64,18 @@ class DispatcherCore
|
||||
'tags' => array('regexp' => '[a-zA-Z0-9-\pL]*'),
|
||||
),
|
||||
),
|
||||
'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]*'),
|
||||
'meta_keywords' => array('regexp' => '[a-zA-Z0-9-\pL]*'),
|
||||
'meta_title' => array('regexp' => '[a-zA-Z0-9-\pL]*'),
|
||||
),
|
||||
),
|
||||
'category_rule' => array(
|
||||
'controller' => 'category',
|
||||
'rule' => '{id}-{rewrite}',
|
||||
@@ -249,8 +261,8 @@ class DispatcherCore
|
||||
$controllers['authentication'] = $controllers['auth'];
|
||||
if (isset($controllers['compare']))
|
||||
$controllers['productscomparison'] = $controllers['compare'];
|
||||
if (isset($controllers['contact']))
|
||||
$controllers['contactform'] = $controllers['contact'];
|
||||
if (isset($controllers['contact']))
|
||||
$controllers['contactform'] = $controllers['contact'];
|
||||
|
||||
if (!isset($controllers[$this->controller]))
|
||||
$this->controller = $this->controller_not_found;
|
||||
|
||||
+14
-2
@@ -133,9 +133,10 @@ class LinkCore
|
||||
* @param mixed $category Category object (can be an ID category, but deprecated)
|
||||
* @param string $alias
|
||||
* @param int $id_lang
|
||||
* @param string $selected_filters Url parameter to autocheck filters of the module blocklayered
|
||||
* @return string
|
||||
*/
|
||||
public function getCategoryLink($category, $alias = null, $id_lang = null)
|
||||
public function getCategoryLink($category, $alias = null, $id_lang = null, $selected_filters = null)
|
||||
{
|
||||
if (!$id_lang)
|
||||
$id_lang = Context::getContext()->language->id;
|
||||
@@ -150,8 +151,19 @@ class LinkCore
|
||||
$params['rewrite'] = (!$alias) ? $category->link_rewrite : $alias;
|
||||
$params['meta_keywords'] = Tools::str2url($category->meta_keywords);
|
||||
$params['meta_title'] = Tools::str2url($category->meta_title);
|
||||
|
||||
// Selected filters is used by the module blocklayered
|
||||
$selected_filters = is_null($selected_filters) ? Tools::getValue('selected_filters') : $selected_filters;
|
||||
|
||||
if (empty($selected_filters))
|
||||
$rule = 'category_rule';
|
||||
else
|
||||
{
|
||||
$rule = 'layered_rule';
|
||||
$params['selected_filters'] = $selected_filters;
|
||||
}
|
||||
|
||||
return $url.Dispatcher::getInstance()->createUrl('category_rule', $params, $this->allow);
|
||||
return $url.Dispatcher::getInstance()->createUrl($rule, $params, $this->allow);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -591,7 +591,7 @@ class FrontControllerCore extends Controller
|
||||
|
||||
$matchUrl = (($this->ssl && Configuration::get('PS_SSL_ENABLED')) ? 'https://' : 'http://').$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
|
||||
$matchUrl = rawurldecode($matchUrl);
|
||||
if (!preg_match('/^'.Tools::pRegexp($canonicalURL, '/').'([&?].*)?$/', $matchUrl))
|
||||
if (!preg_match('/^'.Tools::pRegexp(rawurldecode($canonicalURL), '/').'([&?].*)?$/', $matchUrl))
|
||||
{
|
||||
$params = array();
|
||||
$excludedKey = array('isolang', 'id_lang', 'controller', 'fc');
|
||||
|
||||
Reference in New Issue
Block a user