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
Change brand and supplier default rule for SEO purposes #9458
Conversation
We need to add a way to add 301 from old urls. |
I'm not very fond of this solution for redirection. The need is real though, because once you change the setting in the BO then it should add a permanent route that redirects to the new one, and same for every change. That is a more complex issue that should be handled in a separate PR. In the meantime, I suggest keeping the solution we discussed about for current shops (writing the current route in DB during the upgrade so that their URLs don't change). |
I agree with you about the url in database which would be better, but I didn't find a way to do it with database changes only.
This is what is stored in database: So if we add a config PS_ROUTE_supplier_rule it will override the default one (not alias it), and if we add a rule with another name, say PS_ROUTE_legacy_supplier_rule, the Dispatcher won't be able to know which controller it is linked to. |
{ | ||
Configuration::loadConfiguration(); | ||
$legacyRoutes = array( | ||
'supplier_rule' => '{id}__{rewrite}', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Double underscore here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah I know that was the former rule.. no really clear since the manufacturer_rule is the same with one underscore
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello @PierreRambaud any other remarks about this PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
last comment and I approve, sorry for the delay ;)
7d8bc31
to
51f33e9
Compare
c88c51b
to
5a088e3
Compare
@@ -303,6 +303,8 @@ private function initContext() | |||
if (!isset(Context::getContext()->language) || !Validate::isLoadedObject(Context::getContext()->language)) { | |||
if ($id_lang = (int) $this->getConfValue('PS_LANG_DEFAULT')) { | |||
Context::getContext()->language = new Language($id_lang); | |||
} else { | |||
Context::getContext()->language = new Language(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
easier to read and refactor
$langId = (int) $this->getConfValue('PS_LANG_DEFAULT');
Context::getContext()->language = new Language(
$langId ?
$langId :
null
);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is it really necessary to write on three lines?
Context::getContext()->language = new Language($langId ? $langId : null);
the one line style is readable as well no?
@jolelievre Little rebase and go for merge :) |
ok done :) |
Fixes #9509 |
Thanks @jolelievre |
Yep, I figured that out in some other PRs :P |
This change is