Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong redirection when using the quick search for a category #17920

Merged
merged 2 commits into from Mar 26, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
15 changes: 8 additions & 7 deletions classes/Tools.php
Expand Up @@ -2861,10 +2861,10 @@ public static function getRobotsContent()
$tab['Files'] = array();
if (Configuration::get('PS_REWRITING_SETTINGS')) {
$sql = 'SELECT DISTINCT ml.url_rewrite, l.iso_code
FROM ' . _DB_PREFIX_ . 'meta m
INNER JOIN ' . _DB_PREFIX_ . 'meta_lang ml ON ml.id_meta = m.id_meta
INNER JOIN ' . _DB_PREFIX_ . 'lang l ON l.id_lang = ml.id_lang
WHERE l.active = 1 AND m.page IN (\'' . implode('\', \'', $disallow_controllers) . '\')';
FROM ' . _DB_PREFIX_ . 'meta m
INNER JOIN ' . _DB_PREFIX_ . 'meta_lang ml ON ml.id_meta = m.id_meta
INNER JOIN ' . _DB_PREFIX_ . 'lang l ON l.id_lang = ml.id_lang
WHERE l.active = 1 AND m.page IN (\'' . implode('\', \'', $disallow_controllers) . '\')';
if ($results = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql)) {
foreach ($results as $row) {
$tab['Files'][$row['iso_code']][] = $row['url_rewrite'];
Expand Down Expand Up @@ -4264,10 +4264,11 @@ public static function getPath($url_base, $id_category, $path = '', $highlight =
$n = 1;
$n_categories = (int) count($categories);
foreach ($categories as $category) {
$link = Context::getContext()->link->getAdminLink('AdminCategories');
$edit = '<a href="' . Tools::safeOutput($link . '&id_category=' . (int) $category['id_category'] . '&' . (($category['id_category'] == 1 || $home) ? 'viewcategory' : 'updatecategory')) . '" title="' . ($category['id_category'] == Category::getRootCategory()->id_category ? 'Home' : 'Modify') . '"><i class="icon-' . (($category['id_category'] == Category::getRootCategory()->id_category || $home) ? 'home' : 'pencil') . '"></i></a> ';
$action = (($category['id_category'] == (int) Configuration::get('PS_HOME_CATEGORY') || $home) ? 'index' : 'updatecategory');
$link = Context::getContext()->link->getAdminLink('AdminCategories', true, ['action' => $action, 'id_category' => (int) $category['id_category']]);
$edit = '<a href="' . Tools::safeOutput($link) . '" title="' . ($category['id_category'] == Category::getRootCategory()->id_category ? 'Home' : 'Modify') . '"><i class="icon-' . (($category['id_category'] == Category::getRootCategory()->id_category || $home) ? 'home' : 'pencil') . '"></i></a> ';
$full_path .= $edit .
($n < $n_categories ? '<a href="' . Tools::safeOutput($url_base . '&id_category=' . (int) $category['id_category'] . '&viewcategory&token=' . Tools::getAdminToken('AdminCategories' . (int) Tab::getIdFromClassName('AdminCategories') . (int) $context->employee->id)) . '" title="' . htmlentities($category['name'], ENT_NOQUOTES, 'UTF-8') . '">' : '') .
($n < $n_categories ? '<a href="' . Tools::safeOutput($link) . '" title="' . htmlentities($category['name'], ENT_NOQUOTES, 'UTF-8') . '">' : '') .
(!empty($highlight) ? str_ireplace($highlight, '<span class="highlight">' . htmlentities($highlight, ENT_NOQUOTES, 'UTF-8') . '</span>', $category['name']) : $category['name']) .
($n < $n_categories ? '</a>' : '') .
(($n++ != $n_categories || !empty($path)) ? ' > ' : '');
Expand Down
Expand Up @@ -5,6 +5,8 @@ admin_categories_index:
_controller: PrestaShopBundle:Admin\Sell\Catalog\Category:index
_legacy_controller: AdminCategories
_legacy_link: AdminCategories
_legacy_parameters:
id_category: categoryId
PululuK marked this conversation as resolved.
Show resolved Hide resolved
categoryId: null
requirements:
categoryId: '\d+'
Expand Down