Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to get the request path in a multiple store Magento setup to use in hreflang?
    primarykey
    data
    text
    <p>We would like to get request path to build dynamic URL for <pre><code> public function countryStoresAlternateLinks(){ $stores = Mage::app()-&gt;getStores(false); $countryAlternateLinks = ''; foreach($stores as $store) { $countryAlternateLinks[] = '&lt;link rel="alternate" hreflang="' . substr(Mage::getStoreConfig('general/locale/code', $store-&gt;getId()), 0, 2) . (Mage::getStoreConfig('general/country/default', $store-&gt;getId()) != '' ? "-" . Mage::getStoreConfig('general/country/default', $store-&gt;getId()) : '') . '" href="' . $store-&gt;getCurrentUrl(false) .'" /&gt;' . "\n"; } return $countryAlternateLinks; } </code></pre> <p>Which gives the following output :</p> <pre><code> &lt;link rel="alternate" hreflang="en-GB" href="http://our_domain.com/magento/thee/losse- bladthee/groene?SID=4d6ec9b2ada547a58c7b57dfb35b8d95&amp;amp;___store=english" /&gt; &lt;link rel="alternate" hreflang="nl-NL" href="http://www.our_domain.nl/magento/thee/losse-bladthee/groene?___store=dutch" /&gt; &lt;link rel="alternate" hreflang="nl-BE" href="http://our_domain.com/magento/thee/losse-bladthee/groene?SID=4d6ec9b2ada547a58c7b57dfb35b8d95&amp;amp;___store=nl_be" /&gt; &lt;link rel="alternate" hreflang="fr-BE" href="http://our_domain.com/magento/thee/losse-bladthee/groene?SID=4d6ec9b2ada547a58c7b57dfb35b8d95&amp;amp;___store=fr_be" /&gt; </code></pre> <p></p> <p>The function will print the base URL per store but the category path will not change per store view, it will remind in the same language. </p> <p>*<strong><em>The question is – how can we specify the “href” to get the category path per store view / language?</em>*</strong></p> <p>That is what we have got at the moment “href="' . $store->getCurrentUrl(false) .'” Has anyone knows how we can achieve this?</p> <hr> <p>thanks for the reply but not entirely what we are looking for. maybe i didn't explain very well in my first message, sorry.</p> <p>In the end what we want to cal is the rewrite URL from the other shop, so for example:</p> <p>instead of:</p> <pre><code> www.domain.com/cat1/sub2/info-english.html </code></pre> <p>we want to call:</p> <pre><code> www.domain.com/cat-fr/sub-fr/info-french.html </code></pre> <p>and this on the original english store, so we have nice clean links? Is there a way to achieve this in Magento?</p> <p>Thanks</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload