I am trying to build multilingual website with webshop. I have home node for each language. Each home node has some content pages and Shop node (uCommerce).
Home nodes are configured with hostnames like site.com/da/ or site.com/en/. So structure is like this:
So now how do I make Ucommerce.Api.CatalogLibrary.GetNiceUrlFor* methods return correct path with /da/ or /en/ or whatnot prefix? Is there another way to do what I describe here? Should I manually generate urls somehow? How does GetNiceUrlFor* know what to put in front of /c-11/c-22/p-33?
It only uses relative paths, so it would point to the right hostname as long as you're on the hostname allready. It also takes care of giving you the right url in the right language.
produces niceUrl that starts with '/'. So niceUrl in this case will be something like /store-name/category-name/c-22/c-33. Correct form would be /en/store-name/category-name/c-22/c-33.
Any ideas?
How does CatalogLibrary.GetNiceUrlFor* work?
Hi,
I am trying to build multilingual website with webshop. I have home node for each language. Each home node has some content pages and Shop node (uCommerce). Home nodes are configured with hostnames like site.com/da/ or site.com/en/. So structure is like this:
So this works ok. On top of this there is some URL rewriting rules for each page/language. So url
points to
or somethigs similar.
So now how do I make Ucommerce.Api.CatalogLibrary.GetNiceUrlFor* methods return correct path with /da/ or /en/ or whatnot prefix? Is there another way to do what I describe here? Should I manually generate urls somehow? How does GetNiceUrlFor* know what to put in front of /c-11/c-22/p-33?
Hello Gustas,
It only uses relative paths, so it would point to the right hostname as long as you're on the hostname allready. It also takes care of giving you the right url in the right language.
Hope that helps.
Best regards
Morten
Hi Morten,
Relative path to site root, yes. This code
produces niceUrl that starts with '/'. So niceUrl in this case will be something like /store-name/category-name/c-22/c-33. Correct form would be /en/store-name/category-name/c-22/c-33. Any ideas?
Can't you just concatinate from what the hostname is at the point ?
So you would get the url for the site that would either be site.com/da or site.com/en and then concatinate /store-name/category-name/c-22/c-33
Regards
Morten
Hi Morten,
Thanks for reply. I ended up doing this
Work pretty well as long as you keep naming different language sites using same scheme.
Great to hear.
Regards
Morten
is working on a reply...