Jump to content

Recommended Posts

Hi,

I have multistore enabled, and I wish to have a page before accessing the website that let an user chose a store (according to his location).

So the idea is that when an user access store1.website.com or store2.website.com, he lands on a store selector page "store_selector.html"

And then, the user clicks on a link "store1.website.com/index" or "store2.website.com/index" that leads to the default index.

I tried to modify the .htaccess that way :

RewriteEngine on
RewriteRule ^index$ /index.php [L]
DirectoryIndex store_selector.html 

But that was before discovering that every page is redirected to index.php, and then the "Dispatcher" is used to redirect to the right page.

I also tired to go in Shop Parameter / select store1 / select "index" page and add "index" in the "Rewritten URL" field. But that does not seems to change anything.

 In Advance parameter / multi store, I could set a "Virtual URL" to "index", but that means that it change every link on my store, which is already online (not good for SEO).

 

I hope that I don't have to play with the Dispatcher in PHP and that there is a simpler solution.

Any help would be welcomed.

Link to comment
Share on other sites

Here is an update :

 

In my store selector page, I set a cookie with the store id inside.

My new idea is to not mess with .htaccess, but each time "index.tpl" in rendered, check if the cookie with id store exist.

If it does not exist, I want to redirect to my store selector page.

If it exist, I want to display index.tpl.

So I want either to put php in index.tpl, or before calling index.tpl make a redirect.

 

EDIT :

So I made a override of FrontControllerCore to add new variable accessible in .tpl containing my cookie, and then in index.tpl I made a condition "if the cookie is not set, then load "store_selector.html" with js".

 

I also had to delete ./var/cache/prod/class_index.php (override cache)

Edited by loic-pcpt (see edit history)
  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...