1
votes

I have a magento shop with 2 languages. The language switcher works with set a different store view in the url.

  • /shop/?___store=myshop_view for mainlanguage
  • /shop/?___store=myshop_view_fr for french

That works fine and how it should work. Now first problem comes when I am in french store and switch to mainlanguage with /shop/?___store=myshop_view, now I see the shop in the mainlanguage, but when I call /shop/ without any storeview paramenters it switches back to french. Why is that and can I change that?

The second problem comes with externall add to card links. A add to card link would look like: /shop/checkout/cart/add/uenc/aHR0cDovL3d3dy5teS13aW5lLmNoLnJ1dGlzaGF1c2VyLm5pbmUuY2gv/product/2169/?___SID=U&___store=myshop_view So this link is for the main language. If the shop was in french before and I click this link, i get the success message in the main language, but the rest of the shop is french again.

I think the first and second problem are nearly the same. Then the add to card link will redirect to the shop overview without any store view paramenter in the url.

Any idea how I can get a add to card link that can switch the language of the shop?

1
Normally when you switch store for first time the store code gets stored in cookie.That is the reason why when you acess your base url (/shop/) next time it determines the store view based on the store code saved in the cookie.Rohit S
@RohitS Thx alot. Your comment helped me solve the problemnbar

1 Answers

0
votes

As @RohitS said. Magento saves the storeview in the cookie, and with the url you can change the storeview temporary, but the value in the cookie is still the same.

Good thing is, that the external add to card link is on a subdomain, so I was able to set the cookie for the hole domain (by adding a dot before the domain name: .domain.com). In the cookie I just had to set document.cookie = "store=myshop_view_fr;path=/;domain=.my-shop.com"; The path attribute was important for me, cause the shop is in /shop/.