1

I've got a module which works fine, however I need a different frontName for each store.

The stores are 'english' and 'french', and as such, the frontName should be translated for each.

I've tried a couple of things in config XML, namely:

<?xml version="1.0"?>
  <config>
     <modules>
        <Lw_Listbundles>
          <version>1.0.0</version>
        </Lw_Listbundles>
     </modules>
     <frontend>
       <routers>
          <listbundles>
              <use>standard</use>
              <args>
                 <module>Lw_Listbundles</module>
                 <frontName>bundles</frontName>
              </args>
           </listbundles>
          <listbundles>
              <use>standard</use>
              <args>
                 <module>Lw_Listbundles</module>
                 <frontName>agencements</frontName>
              </args>
           </listbundles>
       </routers>
    <layout>
        <updates>
            <listbundles>
                <file>listbundles.xml</file>
            </listbundles>
        </updates>
    </layout>
    </frontend>
    <global>
        <blocks>
            <listbundles>
                <class>Lw_Listbundles_Block</class>
            </listbundles>
        </blocks>
    </global>

</config>

and

<?xml version="1.0"?>
  <config>
     <modules>
        <Lw_Listbundles>
          <version>1.0.0</version>
        </Lw_Listbundles>
     </modules>
     <frontend>
       <routers>
          <listbundles>
              <use>standard</use>
              <args>
                 <module>Lw_Listbundles</module>
                 <frontName>bundles</frontName>
              </args>
           </listbundles>
       </routers>
    <layout>
        <updates>
            <listbundles>
                <file>listbundles.xml</file>
            </listbundles>
        </updates>
    </layout>
    </frontend>
    <global>
        <blocks>
            <listbundles>
                <class>Lw_Listbundles_Block</class>
            </listbundles>
        </blocks>
    </global>

    <stores>
        <french>
          <frontend>
              <routers>
              <listbundles>
                  <use>standard</use>
                  <args>
                     <module>Lw_Listbundles</module>
                     <frontName>agencements</frontName>
                  </args>
               </listbundles>

              </routers>
          </frontend>
        </french>
    </stores>

</config>

But I'm not getting much luck - I don't mind too much if both frontNames are available on both stores, but I do need both frontNames on way or another!

Any advice would be appreciated!

3

I think you are almost there.

In your first try, just make the route identifier different for each route. Those identifiers should be unique, so if you set the same name, the second will override the first and only one route will be defined.

Change to some like this:

<listbundles_1>
    <use>standard</use>
        <args>
            <module>Lw_Listbundles</module>
            <frontName>bundles</frontName>
        </args>
</listbundles_1>
<listbundles_2>
    <use>standard</use>
        <args>
            <module>Lw_Listbundles</module>
            <frontName>agencements</frontName>
        </args>
</listbundles_2>

Both routes will be available in both stores but you can limit that in your controller code if needed.

0

You could make your frontName configurable in the backend and allow the administrator to chose another for each store view. Then in your router, simply get the config and check if the requested frontName is one of yours.

I have answered a similar question here: Customizable router frontName

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.