Jump to content

1.7 multistore using wrong URL


Aris S.

Recommended Posts

We have a problem using the 1.7 multistore feature. We have 2 stores defined, store A and store B.

Store A is the default shop. When logging in to Store A there is no problem.

When logging in to Store B, the URLs of store A is used, for example in the AJAX calls to refresh the dashboard data.

This result in errors like:

-  Failed to load <URL>: Response for preflight is invalid (redirect)

- Request has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin <URL> is therefore not allowed access.

 

In fact Store B should use it's own URL and not the URL of store A.

Anyone experience with the same issue?

Found this topic: https://stackoverflow.com/questions/43910748/xml-http-request-error-on-prestashop-multiistore

but there is no response...

 

  • Like 1
Link to comment
Share on other sites

as author of first 'ever' multishop module let me try to help.

how did you point domain b to main domain within your hosting?

for plesk alias b to a 

for older cpanel park b to a

for newer cpanel alias b to a (we found however if a files not  in root, cpanel alias cannot point to it).  WE RECOMMEND PLESK lol

ps does not give idea about pointing other domains to main domain as it's outside of PS.

Link to comment
Share on other sites

I am using "alias b to a" , via DirectAdmin.

But also on a local environment using MAMP and virtual hosts the issue persist. You can reproduce it as follows with PS 1.7.3.0:

- Perform clean installation of PS 1.7.3.0.

- In backoffice, enable multistore feature

- Add second store and fill in second store URL

- Login into store A (on the URL of store A), and switch in PrestaShop to shop B.

- Now the URL to e.g. the Dashboard page is the URL to store B.

- Clicking on the Dasboard URL takes you to the login page of the backoffice on the URL of store B.
That had to be the URL of store A! Only the context needs to be changed to store B, not the URL!

 

Hope you can help us out!

Link to comment
Share on other sites

I have investigated the issue further by comparing the latest PS 1.6 and latest PS 1.7 releases and found the following in classes/Link.php, getAdminLink():

In 1.6 the link is created as follows:

return Dispatcher::getInstance()->createUrl($controller, $id_lang, $params, false);

In 1.7 the link is created as follows, if the link is not handled by Symfony:

return $this->getBaseLink().basename(_PS_ADMIN_DIR_).'/'.Dispatcher::getInstance()->createUrl($controller, $idLang, $params, false);

So, in 1.7 a full URL is created, where in 1.6 a relative URL is created.

In multistore, this is not want. It creates a full URL to shop B when you are logged in using the URL of store A.

Now I'm wondering if I am the only one experiencing this issue?

  • Thanks 1
Link to comment
Share on other sites

  • 3 weeks later...

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...