How to add a website switcher instead of store view switcher?












2














I have 3 websites (mydomain.com/us/, mydomain.com/en/ and mydomain.com/eu/), each has one store view. I want to switch between these 3 Magento websites with a dropdown switcher similar to that used for switching store views, but there isn't one for switching websites. There are dropdowns for switching language, currency and storeviews but not for switching websites.



I know this has been asked previously and I have tried to apply those solutions.



I found a previous solution to this at;
https://stackoverflow.com/questions/4270490/how-do-i-get-a-website-switcher-instead-of-store-switcher



Following these instructions, I copied;




app/design/frontend/base/default/template/page/switch/stores.phtml




to;




app/design/frontend/{my_theme_package}/{my_theme}/page/switch/stores.phtml




and replaced existing with following code;



<?php
$websites = Mage::app()->getWebsites();

if (count($websites) > 1): ?>
<div class="website-switcher">
<label for="select-website"><?php echo $this->__('Select Store:') ?></label>
<select id="select-website" title="<?php echo $this->__('Select Store') ?>" onchange="location.href=this.value">
<?php foreach ($websites as $website): // print out each website name and code as a dropdown box item ?>
<?php $_selected = $website->getCode() == Mage::app()->getWebsite()->getCode() ? ' selected="selected"' : '' ?>
<option value="<?php echo $website->getDefaultStore()->getBaseUrl()?>"<?php echo $_selected ?>><?php echo $this->htmlEscape($website->getName()) ?></option>
<?php endforeach; ?>
</select>
</div>
<?php endif; ?>


I then refresh cache and when I check the site, there is no switcher where I expect it to be?



Currently each website has one storeview but I may want to add additional storeviews to the EU site for different language versions at some future point.
I have already tested this by adding an additional storeview to the EU website and when I go to mydomain.com/eu/ the storeview switcher does appear for these eu-en and eu-de storeviews.

Additionally, for testing purposes I have also added an additional storeview to US website, the storeview switcher does appear for us or canada storeviews.
When I go to either the mydomain.com/ or mydomain.com/uk/ websites there is no storeview switcher which is correct.
Looking at it now I probably need a website switcher and possibly a storeview switcher together in the scenario of having more than one EU storeview, other than Geo-IP Default Store, is there an extension for this?










share|improve this question
















bumped to the homepage by Community yesterday


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.















  • Do you actually have multiple websites installed? Try var dumping $websites.
    – mbalparda
    Apr 10 '15 at 20:18








  • 2




    If each website has just one store, why not just use the store switcher?
    – Sander Mangel
    Apr 11 '15 at 10:38






  • 1




    I cannot see how the unmodified storeview switcher could be used to take a user to a different website only another storeview within the same website.
    – Calimo
    Apr 11 '15 at 15:25










  • Do you have any reason to not have all the store views under the same "website" - but with different URLs? I manage a 5 store-view Magento 1.9 install on 5 separate domains. We had our store switcher customized into tabs instead of the dropdown provided with Magento. If you don't need to separate your customers based on the store-view they are GEO-ip'd to, then this is your solution.
    – Steven J
    Jul 28 '17 at 16:16
















2














I have 3 websites (mydomain.com/us/, mydomain.com/en/ and mydomain.com/eu/), each has one store view. I want to switch between these 3 Magento websites with a dropdown switcher similar to that used for switching store views, but there isn't one for switching websites. There are dropdowns for switching language, currency and storeviews but not for switching websites.



I know this has been asked previously and I have tried to apply those solutions.



I found a previous solution to this at;
https://stackoverflow.com/questions/4270490/how-do-i-get-a-website-switcher-instead-of-store-switcher



Following these instructions, I copied;




app/design/frontend/base/default/template/page/switch/stores.phtml




to;




app/design/frontend/{my_theme_package}/{my_theme}/page/switch/stores.phtml




and replaced existing with following code;



<?php
$websites = Mage::app()->getWebsites();

if (count($websites) > 1): ?>
<div class="website-switcher">
<label for="select-website"><?php echo $this->__('Select Store:') ?></label>
<select id="select-website" title="<?php echo $this->__('Select Store') ?>" onchange="location.href=this.value">
<?php foreach ($websites as $website): // print out each website name and code as a dropdown box item ?>
<?php $_selected = $website->getCode() == Mage::app()->getWebsite()->getCode() ? ' selected="selected"' : '' ?>
<option value="<?php echo $website->getDefaultStore()->getBaseUrl()?>"<?php echo $_selected ?>><?php echo $this->htmlEscape($website->getName()) ?></option>
<?php endforeach; ?>
</select>
</div>
<?php endif; ?>


I then refresh cache and when I check the site, there is no switcher where I expect it to be?



Currently each website has one storeview but I may want to add additional storeviews to the EU site for different language versions at some future point.
I have already tested this by adding an additional storeview to the EU website and when I go to mydomain.com/eu/ the storeview switcher does appear for these eu-en and eu-de storeviews.

Additionally, for testing purposes I have also added an additional storeview to US website, the storeview switcher does appear for us or canada storeviews.
When I go to either the mydomain.com/ or mydomain.com/uk/ websites there is no storeview switcher which is correct.
Looking at it now I probably need a website switcher and possibly a storeview switcher together in the scenario of having more than one EU storeview, other than Geo-IP Default Store, is there an extension for this?










share|improve this question
















bumped to the homepage by Community yesterday


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.















  • Do you actually have multiple websites installed? Try var dumping $websites.
    – mbalparda
    Apr 10 '15 at 20:18








  • 2




    If each website has just one store, why not just use the store switcher?
    – Sander Mangel
    Apr 11 '15 at 10:38






  • 1




    I cannot see how the unmodified storeview switcher could be used to take a user to a different website only another storeview within the same website.
    – Calimo
    Apr 11 '15 at 15:25










  • Do you have any reason to not have all the store views under the same "website" - but with different URLs? I manage a 5 store-view Magento 1.9 install on 5 separate domains. We had our store switcher customized into tabs instead of the dropdown provided with Magento. If you don't need to separate your customers based on the store-view they are GEO-ip'd to, then this is your solution.
    – Steven J
    Jul 28 '17 at 16:16














2












2








2







I have 3 websites (mydomain.com/us/, mydomain.com/en/ and mydomain.com/eu/), each has one store view. I want to switch between these 3 Magento websites with a dropdown switcher similar to that used for switching store views, but there isn't one for switching websites. There are dropdowns for switching language, currency and storeviews but not for switching websites.



I know this has been asked previously and I have tried to apply those solutions.



I found a previous solution to this at;
https://stackoverflow.com/questions/4270490/how-do-i-get-a-website-switcher-instead-of-store-switcher



Following these instructions, I copied;




app/design/frontend/base/default/template/page/switch/stores.phtml




to;




app/design/frontend/{my_theme_package}/{my_theme}/page/switch/stores.phtml




and replaced existing with following code;



<?php
$websites = Mage::app()->getWebsites();

if (count($websites) > 1): ?>
<div class="website-switcher">
<label for="select-website"><?php echo $this->__('Select Store:') ?></label>
<select id="select-website" title="<?php echo $this->__('Select Store') ?>" onchange="location.href=this.value">
<?php foreach ($websites as $website): // print out each website name and code as a dropdown box item ?>
<?php $_selected = $website->getCode() == Mage::app()->getWebsite()->getCode() ? ' selected="selected"' : '' ?>
<option value="<?php echo $website->getDefaultStore()->getBaseUrl()?>"<?php echo $_selected ?>><?php echo $this->htmlEscape($website->getName()) ?></option>
<?php endforeach; ?>
</select>
</div>
<?php endif; ?>


I then refresh cache and when I check the site, there is no switcher where I expect it to be?



Currently each website has one storeview but I may want to add additional storeviews to the EU site for different language versions at some future point.
I have already tested this by adding an additional storeview to the EU website and when I go to mydomain.com/eu/ the storeview switcher does appear for these eu-en and eu-de storeviews.

Additionally, for testing purposes I have also added an additional storeview to US website, the storeview switcher does appear for us or canada storeviews.
When I go to either the mydomain.com/ or mydomain.com/uk/ websites there is no storeview switcher which is correct.
Looking at it now I probably need a website switcher and possibly a storeview switcher together in the scenario of having more than one EU storeview, other than Geo-IP Default Store, is there an extension for this?










share|improve this question















I have 3 websites (mydomain.com/us/, mydomain.com/en/ and mydomain.com/eu/), each has one store view. I want to switch between these 3 Magento websites with a dropdown switcher similar to that used for switching store views, but there isn't one for switching websites. There are dropdowns for switching language, currency and storeviews but not for switching websites.



I know this has been asked previously and I have tried to apply those solutions.



I found a previous solution to this at;
https://stackoverflow.com/questions/4270490/how-do-i-get-a-website-switcher-instead-of-store-switcher



Following these instructions, I copied;




app/design/frontend/base/default/template/page/switch/stores.phtml




to;




app/design/frontend/{my_theme_package}/{my_theme}/page/switch/stores.phtml




and replaced existing with following code;



<?php
$websites = Mage::app()->getWebsites();

if (count($websites) > 1): ?>
<div class="website-switcher">
<label for="select-website"><?php echo $this->__('Select Store:') ?></label>
<select id="select-website" title="<?php echo $this->__('Select Store') ?>" onchange="location.href=this.value">
<?php foreach ($websites as $website): // print out each website name and code as a dropdown box item ?>
<?php $_selected = $website->getCode() == Mage::app()->getWebsite()->getCode() ? ' selected="selected"' : '' ?>
<option value="<?php echo $website->getDefaultStore()->getBaseUrl()?>"<?php echo $_selected ?>><?php echo $this->htmlEscape($website->getName()) ?></option>
<?php endforeach; ?>
</select>
</div>
<?php endif; ?>


I then refresh cache and when I check the site, there is no switcher where I expect it to be?



Currently each website has one storeview but I may want to add additional storeviews to the EU site for different language versions at some future point.
I have already tested this by adding an additional storeview to the EU website and when I go to mydomain.com/eu/ the storeview switcher does appear for these eu-en and eu-de storeviews.

Additionally, for testing purposes I have also added an additional storeview to US website, the storeview switcher does appear for us or canada storeviews.
When I go to either the mydomain.com/ or mydomain.com/uk/ websites there is no storeview switcher which is correct.
Looking at it now I probably need a website switcher and possibly a storeview switcher together in the scenario of having more than one EU storeview, other than Geo-IP Default Store, is there an extension for this?







multistore websites ce-1.9.1.0






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited May 23 '17 at 12:37









Community

1




1










asked Apr 10 '15 at 20:13









Calimo

2315




2315





bumped to the homepage by Community yesterday


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.







bumped to the homepage by Community yesterday


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.














  • Do you actually have multiple websites installed? Try var dumping $websites.
    – mbalparda
    Apr 10 '15 at 20:18








  • 2




    If each website has just one store, why not just use the store switcher?
    – Sander Mangel
    Apr 11 '15 at 10:38






  • 1




    I cannot see how the unmodified storeview switcher could be used to take a user to a different website only another storeview within the same website.
    – Calimo
    Apr 11 '15 at 15:25










  • Do you have any reason to not have all the store views under the same "website" - but with different URLs? I manage a 5 store-view Magento 1.9 install on 5 separate domains. We had our store switcher customized into tabs instead of the dropdown provided with Magento. If you don't need to separate your customers based on the store-view they are GEO-ip'd to, then this is your solution.
    – Steven J
    Jul 28 '17 at 16:16


















  • Do you actually have multiple websites installed? Try var dumping $websites.
    – mbalparda
    Apr 10 '15 at 20:18








  • 2




    If each website has just one store, why not just use the store switcher?
    – Sander Mangel
    Apr 11 '15 at 10:38






  • 1




    I cannot see how the unmodified storeview switcher could be used to take a user to a different website only another storeview within the same website.
    – Calimo
    Apr 11 '15 at 15:25










  • Do you have any reason to not have all the store views under the same "website" - but with different URLs? I manage a 5 store-view Magento 1.9 install on 5 separate domains. We had our store switcher customized into tabs instead of the dropdown provided with Magento. If you don't need to separate your customers based on the store-view they are GEO-ip'd to, then this is your solution.
    – Steven J
    Jul 28 '17 at 16:16
















Do you actually have multiple websites installed? Try var dumping $websites.
– mbalparda
Apr 10 '15 at 20:18






Do you actually have multiple websites installed? Try var dumping $websites.
– mbalparda
Apr 10 '15 at 20:18






2




2




If each website has just one store, why not just use the store switcher?
– Sander Mangel
Apr 11 '15 at 10:38




If each website has just one store, why not just use the store switcher?
– Sander Mangel
Apr 11 '15 at 10:38




1




1




I cannot see how the unmodified storeview switcher could be used to take a user to a different website only another storeview within the same website.
– Calimo
Apr 11 '15 at 15:25




I cannot see how the unmodified storeview switcher could be used to take a user to a different website only another storeview within the same website.
– Calimo
Apr 11 '15 at 15:25












Do you have any reason to not have all the store views under the same "website" - but with different URLs? I manage a 5 store-view Magento 1.9 install on 5 separate domains. We had our store switcher customized into tabs instead of the dropdown provided with Magento. If you don't need to separate your customers based on the store-view they are GEO-ip'd to, then this is your solution.
– Steven J
Jul 28 '17 at 16:16




Do you have any reason to not have all the store views under the same "website" - but with different URLs? I manage a 5 store-view Magento 1.9 install on 5 separate domains. We had our store switcher customized into tabs instead of the dropdown provided with Magento. If you don't need to separate your customers based on the store-view they are GEO-ip'd to, then this is your solution.
– Steven J
Jul 28 '17 at 16:16










1 Answer
1






active

oldest

votes


















0














You stated you copied it over to




app/design/frontend/{my_theme_package}/{my_theme}/page/switch/stores.phtml




which lacks the template folder



The correct path would have been




app/design/frontend/{my_theme_package}/{my_theme}/template/page/switch/stores.phtml







share|improve this answer





















    Your Answer








    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "479"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: false,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f63347%2fhow-to-add-a-website-switcher-instead-of-store-view-switcher%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    You stated you copied it over to




    app/design/frontend/{my_theme_package}/{my_theme}/page/switch/stores.phtml




    which lacks the template folder



    The correct path would have been




    app/design/frontend/{my_theme_package}/{my_theme}/template/page/switch/stores.phtml







    share|improve this answer


























      0














      You stated you copied it over to




      app/design/frontend/{my_theme_package}/{my_theme}/page/switch/stores.phtml




      which lacks the template folder



      The correct path would have been




      app/design/frontend/{my_theme_package}/{my_theme}/template/page/switch/stores.phtml







      share|improve this answer
























        0












        0








        0






        You stated you copied it over to




        app/design/frontend/{my_theme_package}/{my_theme}/page/switch/stores.phtml




        which lacks the template folder



        The correct path would have been




        app/design/frontend/{my_theme_package}/{my_theme}/template/page/switch/stores.phtml







        share|improve this answer












        You stated you copied it over to




        app/design/frontend/{my_theme_package}/{my_theme}/page/switch/stores.phtml




        which lacks the template folder



        The correct path would have been




        app/design/frontend/{my_theme_package}/{my_theme}/template/page/switch/stores.phtml








        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Jun 14 '18 at 13:42









        muhkuh2005

        113




        113






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Magento Stack Exchange!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.





            Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


            Please pay close attention to the following guidance:


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f63347%2fhow-to-add-a-website-switcher-instead-of-store-view-switcher%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            An IMO inspired problem

            Management

            Has there ever been an instance of an active nuclear power plant within or near a war zone?